add missing debug modes and standardize initial checks.

This commit is contained in:
Luis Guzmán 2025-01-20 05:03:34 -06:00
parent 09f8f4ccec
commit c4ea620a73
9 changed files with 59 additions and 49 deletions

View File

@ -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

View File

@ -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

View File

@ -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
########################################################################

View File

@ -21,9 +21,8 @@ do
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
set -x
fi
if ! [ "$(id -u)" = 0 ]; then

View File

@ -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..."

View File

@ -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..."

View File

@ -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)"

View File

@ -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..."

View File

@ -14,7 +14,6 @@ do
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi