Skip to content

Commit 88a01f9

Browse files
Merge pull request #1904 from EternalNooblet/dev
Added a flag to run as root if needed
2 parents eb08550 + 0653644 commit 88a01f9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

webui.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Please do not make any changes to this file, #
44
# change the variables in webui-user.sh instead #
55
#################################################
6+
67
# Read variables from webui-user.sh
78
# shellcheck source=/dev/null
89
if [[ -f webui-user.sh ]]
@@ -46,6 +47,17 @@ then
4647
LAUNCH_SCRIPT="launch.py"
4748
fi
4849

50+
# this script cannot be run as root by default
51+
can_run_as_root=0
52+
53+
# read any command line flags to the webui.sh script
54+
while getopts "f" flag
55+
do
56+
case ${flag} in
57+
f) can_run_as_root=1;;
58+
esac
59+
done
60+
4961
# Disable sentry logging
5062
export ERROR_REPORTING=FALSE
5163

@@ -61,7 +73,7 @@ printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
6173
printf "\n%s\n" "${delimiter}"
6274

6375
# Do not run as root
64-
if [[ $(id -u) -eq 0 ]]
76+
if [[ $(id -u) -eq 0 && can_run_as_root -eq 0 ]]
6577
then
6678
printf "\n%s\n" "${delimiter}"
6779
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"

0 commit comments

Comments
 (0)