forked from switnet/quick-jibri-installer
add missing debug modes and standardize initial checks.
This commit is contained in:
parent
09f8f4ccec
commit
c4ea620a73
|
@ -16,9 +16,13 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
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
|
fi
|
||||||
|
|
||||||
#Make sure the file name is the required one
|
#Make sure the file name is the required one
|
||||||
|
@ -28,12 +32,6 @@ if [ ! "$(basename "$0")" = "add-jibri-node.sh" ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
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
|
### 0_VAR_DEF
|
||||||
MAIN_SRV_DIST=TBD
|
MAIN_SRV_DIST=TBD
|
||||||
MAIN_SRV_REPO=TBD
|
MAIN_SRV_REPO=TBD
|
||||||
|
|
|
@ -16,9 +16,13 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
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
|
fi
|
||||||
|
|
||||||
#Make sure the file name is the required one
|
#Make sure the file name is the required one
|
||||||
|
@ -28,13 +32,6 @@ if [ ! "$(basename "$0")" = "add-jvb2-node.sh" ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
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
|
### 0_VAR_DEF
|
||||||
MAIN_SRV_DIST=TBD
|
MAIN_SRV_DIST=TBD
|
||||||
MAIN_SRV_REPO=TBD
|
MAIN_SRV_REPO=TBD
|
||||||
|
|
|
@ -7,6 +7,24 @@
|
||||||
# SwITNet Ltd © - 2024, https://switnet.net/
|
# SwITNet Ltd © - 2024, https://switnet.net/
|
||||||
# GPLv3 or later.
|
# 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
|
# Reset
|
||||||
Color_Off='\e[0m' # Text Reset
|
Color_Off='\e[0m' # Text Reset
|
||||||
# Regular Colors
|
# Regular Colors
|
||||||
|
@ -52,24 +70,6 @@ else
|
||||||
fi
|
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
|
clear
|
||||||
echo -e '\n
|
echo -e '\n
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
|
@ -21,9 +21,8 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
if [ "$MODE" = "debug" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ "$(id -u)" = 0 ]; then
|
if ! [ "$(id -u)" = 0 ]; then
|
||||||
|
|
|
@ -3,11 +3,24 @@
|
||||||
# SwITNet Ltd © - 2024, https://switnet.net/
|
# SwITNet Ltd © - 2024, https://switnet.net/
|
||||||
# GPLv3 or later.
|
# 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
|
if ! [ "$(id -u)" = 0 ]; then
|
||||||
echo "You need to be root or have sudo privileges!"
|
echo "You need to be root or have sudo privileges!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_if_not_installed() {
|
exit_if_not_installed() {
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then
|
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..."
|
echo " This instance doesn't have $1 installed, exiting..."
|
||||||
|
|
|
@ -13,9 +13,13 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
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
|
fi
|
||||||
|
|
||||||
Blue='\e[0;34m'
|
Blue='\e[0;34m'
|
||||||
|
@ -27,11 +31,7 @@ Color_Off='\e[0m'
|
||||||
printwc() {
|
printwc() {
|
||||||
printf "%b$2%b" "$1" "${Color_Off}"
|
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
|
if [ ! -f jm-bm.sh ]; then
|
||||||
echo "Please check that you are running the jitsi updater while being on the project folder"
|
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..."
|
echo "other wise the updater might have errors or be incomplete. Exiting..."
|
||||||
|
|
8
jm-bm.sh
8
jm-bm.sh
|
@ -13,9 +13,13 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
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
|
fi
|
||||||
|
|
||||||
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
||||||
|
|
|
@ -12,7 +12,6 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
if [ "$MODE" = "debug" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
@ -21,6 +20,7 @@ if ! [ "$(id -u)" = 0 ]; then
|
||||||
echo "You need to be root or have sudo privileges!"
|
echo "You need to be root or have sudo privileges!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_if_not_installed() {
|
exit_if_not_installed() {
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then
|
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..."
|
echo " This instance doesn't have $1 installed, exiting..."
|
||||||
|
|
|
@ -14,7 +14,6 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#DEBUG
|
|
||||||
if [ "$MODE" = "debug" ]; then
|
if [ "$MODE" = "debug" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue