uninstall improve
Some checks failed
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled

This commit is contained in:
qiaofeng1227 2024-11-22 14:42:22 +08:00
parent 35bb2d93f6
commit 84ca12d507
2 changed files with 38 additions and 40 deletions

View file

@ -4,24 +4,6 @@ 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:
#
# $ sudo sh install.sh --files
#
#
# ==============================================================================
install_path="/data/websoft9/source"
systemd_path="/opt/websoft9/systemd"
cockpit_plugin_path="/usr/share/cockpit"
@ -35,14 +17,44 @@ sudo systemctl disable websoft9
sudo systemctl stop websoft9
rm -rf /lib/systemd/system/websoft9.service
remove_cockpit() {
echo -e "\n---Remove Cockpit---"
sudo systemctl stop cockpit.socket cockpit
for package in $cockpit_packages; do
sudo pkcon remove $package -y || true
sudo systemctl disable cockpit.socket cockpit
dnf --version >/dev/null 2>&1
dnf_status=$?
yum --version >/dev/null 2>&1
yum_status=$?
apt --version >/dev/null 2>&1
apt_status=$?
if [ $dnf_status -eq 0 ]; then
for pkg in $cockpit_packages
do
echo "Uninstalling $pkg"
sudo dnf remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done
elif [ $yum_status -eq 0 ]; then
for pkg in $cockpit_packages
do
echo "Uninstalling $pkg"
sudo yum remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done
elif [ $apt_status -eq 0 ]; then
export DEBIAN_FRONTEND=noninteractive
for pkg in $cockpit_packages
do
echo "Uninstalling $pkg"
sudo apt-get remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done
else
echo "Neither apt,dnf nor yum found. Please install one of them and try again."
end
sudo rm -rf /etc/cockpit/*
}
@ -51,22 +63,7 @@ remove_files() {
sudo rm -rf $install_path/* $systemd_path/* $cockpit_plugin_path/*
}
for arg in "$@"
do
case $arg in
--cockpit)
remove_cockpit
shift
;;
--files)
remove_files
shift
;;
*)
echo "Unknown argument: $arg"
exit 1
;;
esac
done
echo -e "\nCongratulations, Websoft9 uninstall is complete!"

View file

@ -24,6 +24,7 @@
"7"
],
"Oracle Linux": [
"9",
"8",
"7"
],