Do not demand root if not required

This commit is contained in:
Dennis ten Hoove 2024-02-20 07:43:25 +01:00
parent 1e1a3d2a6d
commit 277e0b54f4

11
arkdep
View file

@ -152,10 +152,13 @@ healthcheck () {
## Error checking
#
# Quit if not root
[[ ! $EUID -eq 0 ]] &&
printf '\e[1;31m<#>\e[0m\e[1m This program has to be run as root\n\e[0m' &&
exit 1
# Quit if not root, only run if required
if [[ ! $1 =~ ^(get-available|healthcheck) ]]; then
if [[ ! $EUID -eq 0 ]]; then
printf '\e[1;31m<#>\e[0m\e[1m This program has to be run as root\n\e[0m' &&
exit 1
fi
fi
# Check if all dependencies are installed, quit if not
for prog in btrfs wget dracut bootctl curl gpg gpgv; do