diff --git a/add-jibri-node.sh b/add-jibri-node.sh index b548bba..86aa17d 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -16,9 +16,13 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then -set -x + set -x +fi + +if ! [ "$(id -u)" = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 fi #Make sure the file name is the required one @@ -28,12 +32,6 @@ if [ ! "$(basename "$0")" = "add-jibri-node.sh" ]; then exit fi -#Check admin rights -if ! [ "$(id -u)" = 0 ]; then - echo "You need to be root or have sudo privileges!" - exit 0 -fi - ### 0_VAR_DEF MAIN_SRV_DIST=TBD MAIN_SRV_REPO=TBD diff --git a/add-jvb2-node.sh b/add-jvb2-node.sh index 7cf37d0..1afe811 100644 --- a/add-jvb2-node.sh +++ b/add-jvb2-node.sh @@ -16,9 +16,13 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then -set -x + set -x +fi + +if ! [ "$(id -u)" = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 fi #Make sure the file name is the required one @@ -28,13 +32,6 @@ if [ ! "$(basename "$0")" = "add-jvb2-node.sh" ]; then exit fi - -#Check admin rights -if ! [ "$(id -u)" = 0 ]; then - echo "You need to be root or have sudo privileges!" - exit 0 -fi - ### 0_VAR_DEF MAIN_SRV_DIST=TBD MAIN_SRV_REPO=TBD diff --git a/excalidraw-backend.sh b/excalidraw-backend.sh index 0dc4a03..fa29c3b 100644 --- a/excalidraw-backend.sh +++ b/excalidraw-backend.sh @@ -7,6 +7,24 @@ # SwITNet Ltd © - 2024, https://switnet.net/ # GPLv3 or later. +while getopts m: option +do + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;; + esac +done + +if [ "$MODE" = "debug" ]; then + set -x +fi + +if ! [ "$(id -u)" = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 +fi + # Reset Color_Off='\e[0m' # Text Reset # Regular Colors @@ -52,24 +70,6 @@ else fi } -while getopts m: option -do - case "${option}" - in - m) MODE=${OPTARG};; - \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;; - esac -done - -#DEBUG -if [ "$MODE" = "debug" ]; then -set -x -fi - -if ! [ "$(id -u)" = 0 ]; then - echo "You need to be root or have sudo privileges!" - exit 0 -fi clear echo -e '\n ######################################################################## diff --git a/grafana.sh b/grafana.sh index 4e1e896..54c7954 100644 --- a/grafana.sh +++ b/grafana.sh @@ -21,9 +21,8 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then -set -x + set -x fi if ! [ "$(id -u)" = 0 ]; then diff --git a/jigasi-vosk-backend.sh b/jigasi-vosk-backend.sh index 293bb25..3e3b3c1 100644 --- a/jigasi-vosk-backend.sh +++ b/jigasi-vosk-backend.sh @@ -3,11 +3,24 @@ # SwITNet Ltd © - 2024, https://switnet.net/ # GPLv3 or later. -#Check if user is root +while getopts m: option +do + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;; + esac +done + +if [ "$MODE" = "debug" ]; then + set -x +fi + if ! [ "$(id -u)" = 0 ]; then echo "You need to be root or have sudo privileges!" exit 0 fi + exit_if_not_installed() { if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then echo " This instance doesn't have $1 installed, exiting..." diff --git a/jitsi-updater.sh b/jitsi-updater.sh index 0e04af2..92f399b 100644 --- a/jitsi-updater.sh +++ b/jitsi-updater.sh @@ -13,9 +13,13 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then -set -x + set -x +fi + +if ! [ "$(id -u)" = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 fi Blue='\e[0;34m' @@ -27,11 +31,7 @@ Color_Off='\e[0m' printwc() { printf "%b$2%b" "$1" "${Color_Off}" } -#Check if user is root -if ! [ "$(id -u)" = 0 ]; then - echo "You need to be root or have sudo privileges!" - exit 0 -fi + if [ ! -f jm-bm.sh ]; then echo "Please check that you are running the jitsi updater while being on the project folder" echo "other wise the updater might have errors or be incomplete. Exiting..." diff --git a/jm-bm.sh b/jm-bm.sh index 58b5c10..3c81c55 100644 --- a/jm-bm.sh +++ b/jm-bm.sh @@ -13,9 +13,13 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then -set -x + set -x +fi + +if ! [ "$(id -u)" = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 fi DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)" diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index ccedcdd..c6e5b60 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -12,7 +12,6 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then set -x fi @@ -21,6 +20,7 @@ if ! [ "$(id -u)" = 0 ]; then echo "You need to be root or have sudo privileges!" exit 0 fi + exit_if_not_installed() { if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then echo " This instance doesn't have $1 installed, exiting..." diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 17c81fe..54073ae 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -14,7 +14,6 @@ do esac done -#DEBUG if [ "$MODE" = "debug" ]; then set -x fi