move privilege check to the start

- else when running as non-root you get a bunch of errors already during language config.
Also anyway doesn't make sense to do anything as user... ;)
merge-requests/260/head
Bernhard Landauer 7 years ago
parent aa7bd1dd67
commit 5411dcdee3

@ -37,9 +37,10 @@ case $(tty) in /dev/tty[0-9]*)
setterm -blank 0 -powersave off ;;
esac
check_root
id_system
set_language
mk_connection
check_requirements
check_connection
greeting
main_menu

@ -131,6 +131,15 @@ submenu() {
fi
}
check_root() {
if [[ `whoami` != "root" ]]; then
DIALOG " $_ErrTitle " --infobox "\n$_RtFailBody\n " 0 0
sleep 3
clear
exit 1
fi
}
# Adapted from AIS. Checks if system is made by Apple, whether the system is BIOS or UEFI,
# and for LVM and/or LUKS.
id_system() {
@ -354,23 +363,17 @@ mk_connection() {
# Check user is root, and that there is an active internet connection
# Seperated the checks into seperate "if" statements for readability.
check_requirements() {
DIALOG " $_ChkTitle " --infobox "\n$_ChkBody\n " 0 0
sleep 2
if [[ `whoami` != "root" ]]; then
DIALOG " $_Erritle " --infobox "\n$_RtFailBody\n " 0 0
sleep 2
exit 1
fi
check_connection() {
# DIALOG " $_ChkTitle " --infobox "\n$_ChkBody\n " 0 0
# sleep 2
if [[ ! $(ping -c 1 google.com) ]]; then
DIALOG " $_ErrTitle " --infobox "\n$_ConFailBody\n " 0 0
sleep 2
sleep 3
clear
exit 1
fi
# This will only be executed where neither of the above checks are true.
# The error log is also cleared, just in case something is there from a previous use of the installer.
DIALOG " $_ReqMetTitle " --infobox "\n$_ReqMetBody\n\n$_UpdDb\n " 0 0
sleep 2

Loading…
Cancel
Save