Files
VPS-scripts_MeetServer/Install-JMS.sh

164 lines
3.8 KiB
Bash

#######################
# JitsiMeet - JMS #
#######################
##-----------------##
# Defining Vars #
##-----------------##
OUTPUT='/dev/tty'
#PackageManager-config
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
if [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
PKGM="apt"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=deb10
else
echo "This os in not supported"
exit
fi
unset dist_ver dist
#Repo Vars
repo=https://git.ictmaatwerk.com/VPS-scripts/MeetServer
branch=main/JVB
branchtype=branch
#SelfBuilding Vars
mtype=""$repo"/raw/"$branchtype"/"$branch""
jibsec=${cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 16}
jibrsec=${cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 16}
##---------------##
# Functions #
##---------------##
msg () {
echo "$1"
}
##--------------------------##
# Installer-Requirements #
##--------------------------##
msg " Starting installer" 8 78
$PKGM update > $OUTPUT 2>&1
$PKGI curl > $OUTPUT 2>&1
##----------##
# Menu #
##----------##
read -p 'Domain name: ' domain
PS3='Installation type: '
options=("Scalable" "Stand alone" "Full stand alone" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Scalable")
jitsipack=sc
genjvbsec=1
extcon=1
;;
"Stand alone")
jitsipack=sa
extcon=1
;;
"Full stand alone")
jitsipack=sa
extcon=0
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done
while true; do
read -p "Do you wish to install this program?" yn
case $yn in
[Yy]* ) lecert=1; break;;
[Nn]* ) lecert=0; break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ "$extcon" = "1" ] ; then
ip link show
read -p 'Enter full name of internal network interface: ' innetworkif
intip=$(ip -o -4 addr list "$innetworkif" | awk '{print $4}' | cut -d/ -f1)
fi
read -p 'Enter Jitsi username: ' jituser
read -p 'Enter Jitsi password: ' -s jitpasswd
echo ""
##-------------------------##
# Generating APT list #
##-------------------------##
#General aptList
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/generic.pkg.list; then
curl "$mtype"/generic.pkg.list >>/tmp/pkg.list
fi
##--------------------##
# Pre-Requirements #
##--------------------##
msg " Preconfiguring"
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
$PKGM update
$PKGM upgrade -y
##-------------------##
# Pre-configuring #
##-------------------##
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/preconf.sh)
fi
##-------------##
# Installer #
##-------------##
$PKGM update
cat /tmp/pkg.list | xargs $PKGI
##---------------##
# Configuring #
##---------------##
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/conf.sh)
fi
#storing config
if [ "$jitsipack" = "sa" ] ; then
jvbsec=$(sed -n ' s/org.jitsi.videobridge.xmpp.user.shard.PASSWORD=\(.*\)/\1/p' /etc/jitsi/videobridge/sip-communicator.properties)
fi
mkdir -p /etc/ICTM/
echo "InstDate=$(date "+%d-%B-%Y")" >> /etc/ICTM/JitsiMeet.var
for storeme in domain intip jvbsec jibsec jibrsec; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list
done
##-------##
# end #
##-------##
msg " Done!"