mirror of
https://github.com/brain-hackers/brain-config.git
synced 2025-10-15 04:38:41 +09:00
Run root check before attempting nonint functions
Fixes #191, fixes #113
This commit is contained in:
12
raspi-config
12
raspi-config
@@ -2809,6 +2809,12 @@ nonint() {
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Everything needs to be run as root
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
printf "Script must be run as root. Try 'sudo raspi-config'\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Command line options for non-interactive use
|
||||
#
|
||||
@@ -2854,12 +2860,6 @@ done
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
# Everything else needs to be run as root
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
printf "Script must be run as root. Try 'sudo raspi-config'\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${OPT_MEMORY_SPLIT:-}" ]; then
|
||||
set -e # Fail when a command errors
|
||||
set_memory_split "${OPT_MEMORY_SPLIT}"
|
||||
|
Reference in New Issue
Block a user