bigbluebutton-Github/bbb-libreoffice/uninstall.sh

38 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-07-24 13:42:51 +08:00
set -e
if [ "$EUID" -ne 0 ]; then
2020-07-24 13:42:51 +08:00
echo "Please run this script as root ( or with sudo )" ;
exit 1;
fi;
IMAGE_CHECK=`docker image inspect bbb-libreoffice 2>&1 > /dev/null && echo 1 || echo 0`
if [ "$IMAGE_CHECK" = "1" ]; then
2020-07-24 13:42:51 +08:00
echo "Stopping services"
systemctl --no-pager --no-legend --value --state=running | grep bbb-libreoffice | awk -F '.service' '{print $1}' | xargs --no-run-if-empty -n 1 systemctl stop
2020-07-03 03:20:36 +08:00
echo "Removing image"
docker image rm bbb-libreoffice
fi
FOLDER_CHECK=`[ -d /usr/share/bbb-libreoffice/ ] && echo 1 || echo 0`
if [ "$FOLDER_CHECK" = "1" ]; then
echo "Stopping services"
2020-07-24 13:42:51 +08:00
systemctl --no-pager --no-legend --value --state=running | grep bbb-libreoffice | awk -F '.service' '{print $1}' | xargs --no-run-if-empty -n 1 systemctl stop
echo "Removing install folder"
rm -rf /usr/share/bbb-libreoffice/
echo "Removing service definitions"
2020-07-24 13:42:51 +08:00
rm /lib/systemd/system/bbb-libreoffice@.service
find /etc/systemd/ | grep bbb-libreoffice | xargs --no-run-if-empty -n 1 -I __ rm __
systemctl daemon-reload
fi;
2020-07-24 23:29:24 +08:00
NETWORK_CHECK=`docker network inspect bbb-libreoffice &> /dev/null && echo 1 || echo 0`
if [ "$NETWORK_CHECK" = "1" ]; then
echo "Removing docker network"
docker network remove bbb-libreoffice
fi