From b568153772a249d5aa785403eca52ebc17f3916c Mon Sep 17 00:00:00 2001 From: otavepto <153766569+otavepto@users.noreply.github.com> Date: Tue, 26 Dec 2023 01:23:23 +0200 Subject: [PATCH] in Linux packaging script check for root priviledge after checking for input arg --- package_linux.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package_linux.sh b/package_linux.sh index 13912c61..7ae9a36d 100644 --- a/package_linux.sh +++ b/package_linux.sh @@ -1,11 +1,6 @@ #!/usr/bin/env bash -if [ "$(id -u)" -ne 0 ]; then - echo "Please run as root" >&2 - exit 1 -fi - build_base_dir="build/linux" out_dir="build/linux/package" script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd ) @@ -15,6 +10,11 @@ script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd ) exit 1; } +if [ "$(id -u)" -ne 0 ]; then + echo "Please run as root" >&2 + exit 1 +fi + [[ -d "$script_dir/$build_base_dir/$1" ]] || { echo "[X] build folder wasn't found"; exit 1;