2021-05-03 23:23:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#Start over
|
2022-05-21 01:07:02 +00:00
|
|
|
# SwITNet Ltd © - 2022, https://switnet.net/
|
2021-05-04 05:37:08 +00:00
|
|
|
# GPLv3 or later.
|
2021-05-03 23:23:03 +00:00
|
|
|
|
|
|
|
while getopts m: option
|
|
|
|
do
|
2022-05-21 01:07:02 +00:00
|
|
|
case "${option}"
|
|
|
|
in
|
|
|
|
m) MODE=${OPTARG};;
|
|
|
|
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
|
|
|
|
esac
|
2021-05-03 23:23:03 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
#DEBUG
|
|
|
|
if [ "$MODE" = "debug" ]; then
|
2022-05-21 01:07:02 +00:00
|
|
|
set -x
|
2021-05-03 23:23:03 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
#Check if user is root
|
2022-05-21 01:07:02 +00:00
|
|
|
if ! [ "$(id -u)" = 0 ]; then
|
2021-05-03 23:23:03 +00:00
|
|
|
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() {
|
2022-05-21 01:07:02 +00:00
|
|
|
if [ -d "$1" ]; then
|
|
|
|
rm -r "$1"
|
2021-05-06 06:08:25 +00:00
|
|
|
fi
|
|
|
|
}
|
2021-05-03 23:23:03 +00:00
|
|
|
purge_debconf() {
|
2022-05-21 01:07:02 +00:00
|
|
|
echo PURGE | debconf-communicate "$1"
|
2021-05-03 23:23:03 +00:00
|
|
|
}
|
2021-05-06 06:08:25 +00:00
|
|
|
remove_services() {
|
2022-05-21 01:07:02 +00:00
|
|
|
systemctl disable "$1"
|
|
|
|
systemctl stop "$1"
|
2021-05-06 06:08:25 +00:00
|
|
|
}
|
|
|
|
echo -e '
|
|
|
|
########################################################################
|
|
|
|
Welcome to the Start Over cleaner script
|
|
|
|
########################################################################
|
|
|
|
by Software, IT & Networks Ltd
|
|
|
|
\n'
|
|
|
|
|
2022-05-21 01:07:02 +00:00
|
|
|
SYNC_USER="$(find /home -maxdepth 1 -type d |awk '/jbsync/{print}')"
|
|
|
|
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
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
|
|
|
|
|
2022-05-21 01:07:02 +00:00
|
|
|
echo "#Purging debconf db"
|
2021-05-03 23:23:03 +00:00
|
|
|
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
|
2022-05-21 01:07:02 +00:00
|
|
|
if [ -n "$SYNC_USER" ]; then
|
|
|
|
deluser --remove-home "$SYNC_USER"
|
2021-05-06 06:08:25 +00:00
|
|
|
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..."
|