2023-09-27 06:50:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Define PATH
|
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
|
|
|
# Export PATH
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
|
|
|
|
# Command-line options
|
|
|
|
# ==============================================================================
|
|
|
|
#
|
|
|
|
# --cockpit
|
|
|
|
# Use the --cockpit option to remove cockpit:
|
|
|
|
#
|
|
|
|
# $ sudo sh install.sh --cockpit
|
|
|
|
#
|
|
|
|
# --files
|
|
|
|
# Use the --files option remove files have installed:
|
|
|
|
#
|
2023-10-07 09:10:33 +00:00
|
|
|
# $ sudo sh install.sh --files
|
2023-09-27 06:50:42 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
install_path="/data/websoft9/source"
|
|
|
|
systemd_path="/opt/websoft9/systemd"
|
|
|
|
cockpit_plugin_path="/usr/share/cockpit"
|
|
|
|
cockpit_packages="cockpit cockpit-ws cockpit-bridge cockpit-system cockpit-pcp cockpit-storaged cockpit-networkmanager cockpit-session-recording cockpit-doc cockpit-packagekit cockpit-sosreport"
|
|
|
|
|
|
|
|
echo -e "\n---Remove Websoft9 backend service containers---"
|
|
|
|
sudo docker compose -p websoft9 down -v
|
|
|
|
|
|
|
|
echo -e "\n---Remove Websoft9 systemd service---"
|
|
|
|
sudo systemctl disable websoft9
|
|
|
|
sudo systemctl stop websoft9
|
|
|
|
rm -rf /lib/systemd/system/websoft9.service
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-06 08:45:57 +00:00
|
|
|
remove_cockpit() {
|
2023-09-27 06:50:42 +00:00
|
|
|
echo -e "\n---Remove Cockpit---"
|
|
|
|
sudo systemctl stop cockpit.socket cockpit
|
|
|
|
for package in $cockpit_packages; do
|
|
|
|
sudo pkcon remove $package -y || true
|
|
|
|
done
|
2023-10-06 08:45:57 +00:00
|
|
|
sudo rm -rf /etc/cockpit/*
|
2023-09-27 06:50:42 +00:00
|
|
|
}
|
|
|
|
|
2023-10-06 08:45:57 +00:00
|
|
|
remove_files() {
|
2023-09-27 06:50:42 +00:00
|
|
|
echo -e "\n---Remove files---"
|
|
|
|
sudo rm -rf $install_path/* $systemd_path/* $cockpit_plugin_path/*
|
|
|
|
}
|
|
|
|
|
|
|
|
for arg in "$@"
|
|
|
|
do
|
|
|
|
case $arg in
|
|
|
|
--cockpit)
|
2023-10-06 08:45:57 +00:00
|
|
|
remove_cockpit
|
2023-09-27 06:50:42 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--files)
|
2023-10-06 08:45:57 +00:00
|
|
|
remove_files
|
2023-09-27 06:50:42 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown argument: $arg"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo -e "\nCongratulations, Websoft9 uninstall is complete!"
|