# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.

version=0.9.39

LIBDIR='/usr/lib/manjaro-architect'
DATADIR='/usr/share/manjaro-architect'
PROFILES="$DATADIR/profiles"
[[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh

import ${LIBDIR}/ini_val.sh
import ${LIBDIR}/util-base.sh
import ${LIBDIR}/util-desktop.sh
import ${LIBDIR}/util-disk.sh
import ${LIBDIR}/util-menu.sh
import ${LIBDIR}/util-advanced.sh
import ${DATADIR}/translations/english.trans

if [[ $TERM == "linux" ]] && [[ -e /usr/bin/maia-console ]]; then
    export DIALOGRC="/usr/share/manjaro-architect/dialogrc"
else
    export DIALOGRC="/usr/share/manjaro-architect/dialogrc_gui"
fi

# run in debug mode with -d option
[[ $1 == "-d" ]] && declare -i debug=1

case $(tty) in /dev/tty[0-9]*)
    setterm -blank 0 -powersave off ;;
esac

check_root
id_system
set_language
mk_connection
check_connection
#greeting
if [[ -e /run/miso/bootmnt ]]; then
	hostcache=false
	cachepath="/mnt/var/cache/pacman/pkg/"
else
	hostcache=true
	cachepath="/var/cache/pacman/pkg/"
fi
profile-validate -r &
main_menu
