2021-05-03 23:23:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#Start over
|
2021-05-04 05:37:08 +00:00
|
|
|
# SwITNet Ltd © - 2021, https://switnet.net/
|
|
|
|
# GPLv3 or later.
|
2021-05-03 23:23:03 +00:00
|
|
|
|
|
|
|
while getopts m: option
|
|
|
|
do
|
|
|
|
case "${option}"
|
|
|
|
in
|
|
|
|
m) MODE=${OPTARG};;
|
|
|
|
\?) echo "Usage: sudo ./start-over.sh [-m debug]" && exit;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
#DEBUG
|
|
|
|
if [ "$MODE" = "debug" ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
|
|
|
#Check if user is root
|
|
|
|
if ! [ $(id -u) = 0 ]; then
|
|
|
|
echo "You need to be root or have sudo privileges!"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
wait_seconds() {
|
|
|
|
secs=$(($1))
|
|
|
|
while [ $secs -gt 0 ]; do
|
|
|
|
echo -ne "$secs\033[0K\r"
|
|
|
|
sleep 1
|
|
|
|
: $((secs--))
|
|
|
|
done
|
|
|
|
}
|
2021-05-06 06:08:25 +00:00
|
|
|
remove_residuals() {
|
|
|
|
if [ -d $1 ]; then
|
|
|
|
rm -r $1
|
|
|
|
fi
|
|
|
|
}
|
2021-05-03 23:23:03 +00:00
|
|
|
purge_debconf() {
|
|
|
|
echo PURGE | debconf-communicate $1
|
|
|
|
}
|
2021-05-06 06:08:25 +00:00
|
|
|
remove_services() {
|
|
|
|
systemctl disable $1
|
|
|
|
systemctl stop $1
|
|
|
|
}
|
|
|
|
echo -e '
|
|
|
|
########################################################################
|
|
|
|
Welcome to the Start Over cleaner script
|
|
|
|
########################################################################
|
|
|
|
by Software, IT & Networks Ltd
|
|
|
|
\n'
|
|
|
|
|
|
|
|
SYNC_USER="$(ls /home|awk '/jbsync/{print}')"
|
2021-06-28 08:39:21 +00:00
|
|
|
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')"
|
2021-05-03 23:23:03 +00:00
|
|
|
|
2021-05-22 20:50:42 +00:00
|
|
|
echo "We are about to remove and clean all the jitsi-meet platform bits and pieces...
|
2021-05-03 23:23:03 +00:00
|
|
|
Please make sure you have backed up anything you don't want to loose."
|
|
|
|
|
|
|
|
echo "
|
|
|
|
# WARGNING #: This is only recommended if you want to start over a failed installation,
|
|
|
|
or plain and simple remove jitsi from your system."
|
|
|
|
|
|
|
|
while [[ "$CONTINUE_PURGE1" != "yes" && "$CONTINUE_PURGE1" != "no" ]]
|
|
|
|
do
|
|
|
|
read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_PURGE1
|
|
|
|
if [ "$CONTINUE_PURGE1" = "no" ]; then
|
|
|
|
echo " Good, see you next time..."
|
|
|
|
exit
|
|
|
|
elif [ "$CONTINUE_PURGE1" = "yes" ]; then
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Let me ask just one more time..."
|
|
|
|
while [[ "$CONTINUE_PURGE2" != "yes" && "$CONTINUE_PURGE2" != "no" ]]
|
|
|
|
do
|
|
|
|
read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_PURGE2
|
|
|
|
if [ "$CONTINUE_PURGE2" = "no" ]; then
|
|
|
|
echo " Good, see you next time..."
|
|
|
|
exit
|
|
|
|
elif [ "$CONTINUE_PURGE2" = "yes" ]; then
|
2022-04-07 08:48:52 +00:00
|
|
|
echo "No going back, let's start..."
|
|
|
|
wait_seconds 10
|
2021-05-03 23:23:03 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#Purging all jitsi meet packages
|
|
|
|
apt-get -y purge jibri \
|
|
|
|
jicofo \
|
|
|
|
jigasi \
|
|
|
|
jitsi-meet \
|
|
|
|
jitsi-meet-web \
|
|
|
|
jitsi-meet-web-config \
|
|
|
|
jitsi-meet-prosody \
|
|
|
|
jitsi-meet-turnserver \
|
|
|
|
jitsi-videobridge2 \
|
|
|
|
prosody
|
|
|
|
|
2021-06-28 09:53:01 +00:00
|
|
|
#Chome related packages
|
|
|
|
apt-get -y purge google-chrome-stable
|
|
|
|
rm /usr/local/bin/chromedriver
|
|
|
|
|
2021-05-06 06:08:25 +00:00
|
|
|
#Services stop
|
2021-05-06 20:19:12 +00:00
|
|
|
remove_services jibri
|
|
|
|
remove_services jibri-icewm
|
|
|
|
remove_services jibri-xorg
|
2021-05-06 06:08:25 +00:00
|
|
|
|
2021-05-03 23:23:03 +00:00
|
|
|
#Cleaning packages
|
|
|
|
apt-get -y autoremove
|
|
|
|
apt-get clean
|
|
|
|
|
|
|
|
#Removing residual files
|
2021-05-06 06:08:25 +00:00
|
|
|
remove_residuals /etc/jitsi
|
|
|
|
remove_residuals /opt/jitsi
|
|
|
|
remove_residuals /usr/share/jicofo
|
|
|
|
remove_residuals /usr/share/jitsi-*
|
2021-05-03 23:23:03 +00:00
|
|
|
|
2021-06-28 08:39:21 +00:00
|
|
|
#Clean /etc/hosts
|
|
|
|
sed -i "/$DOMAIN/d" /etc/hosts
|
|
|
|
|
2021-05-03 23:23:03 +00:00
|
|
|
#Purging debconf db
|
|
|
|
purge_debconf jicofo
|
|
|
|
purge_debconf jigasi
|
|
|
|
purge_debconf jitsi-meet
|
|
|
|
purge_debconf jitsi-meet-prosody
|
|
|
|
purge_debconf jitsi-meet-turnserver
|
|
|
|
purge_debconf jitsi-meet-web-config
|
|
|
|
purge_debconf jitsi-videobridge2
|
|
|
|
|
2021-07-02 21:50:14 +00:00
|
|
|
#Remove unused users & groups
|
2021-05-06 06:08:25 +00:00
|
|
|
if [ ! -z $SYNC_USER ]; then
|
|
|
|
deluser --remove-home $SYNC_USER
|
|
|
|
fi
|
|
|
|
if [ -d /home/jibri ]; then
|
|
|
|
deluser --remove-home jibri
|
2021-07-03 00:56:45 +00:00
|
|
|
rm -r /home/jibri
|
2021-05-06 06:08:25 +00:00
|
|
|
fi
|
2021-07-02 21:50:14 +00:00
|
|
|
groupdel jibri
|
2021-05-06 06:08:25 +00:00
|
|
|
|
2021-07-03 00:56:45 +00:00
|
|
|
#Remove crontab
|
|
|
|
crontab -l | grep -v '@weekly certbot renew --nginx' | crontab -
|
|
|
|
crontab -l
|
|
|
|
|
2021-05-03 23:23:03 +00:00
|
|
|
echo "We are done..."
|