in Linux packaging script check for root priviledge after checking for input arg

This commit is contained in:
otavepto 2023-12-26 01:23:23 +02:00
parent 5d0fef7110
commit b568153772

View File

@ -1,11 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root" >&2
exit 1
fi
build_base_dir="build/linux" build_base_dir="build/linux"
out_dir="build/linux/package" out_dir="build/linux/package"
script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd ) script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd )
@ -15,6 +10,11 @@ script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd )
exit 1; exit 1;
} }
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root" >&2
exit 1
fi
[[ -d "$script_dir/$build_base_dir/$1" ]] || { [[ -d "$script_dir/$build_base_dir/$1" ]] || {
echo "[X] build folder wasn't found"; echo "[X] build folder wasn't found";
exit 1; exit 1;