uninstall upgrade

This commit is contained in:
qiaofeng1227 2024-12-03 16:23:36 +08:00
parent fec0cb8dbd
commit e9a9fb440b
2 changed files with 14 additions and 13 deletions

View File

@ -13,12 +13,15 @@ echo -e "\n---Remove Websoft9 backend service containers---"
sudo docker compose -p websoft9 down -v sudo docker compose -p websoft9 down -v
echo -e "\n---Remove Websoft9 systemd service---" echo -e "\n---Remove Websoft9 systemd service---"
sudo systemctl disable websoft9 if systemctl list-units --full --all | grep -Fq websoft9.service; then
sudo systemctl stop websoft9 sudo systemctl disable websoft9
rm -rf /lib/systemd/system/websoft9.service sudo systemctl stop websoft9
rm -rf /lib/systemd/system/websoft9.service
else
echo "websoft9.service does not exist."
fi
remove_cockpit() { remove_cockpit() {
echo -e "\n---Remove Cockpit---" echo -e "\n---Remove Cockpit---"
sudo systemctl stop cockpit.socket cockpit sudo systemctl stop cockpit.socket cockpit
sudo systemctl disable cockpit.socket cockpit sudo systemctl disable cockpit.socket cockpit
@ -33,27 +36,24 @@ remove_cockpit() {
apt_status=$? apt_status=$?
if [ $dnf_status -eq 0 ]; then if [ $dnf_status -eq 0 ]; then
for pkg in $cockpit_packages for pkg in $cockpit_packages; do
do
echo "Uninstalling $pkg" echo "Uninstalling $pkg"
sudo dnf remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall" sudo dnf remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done done
elif [ $yum_status -eq 0 ]; then elif [ $yum_status -eq 0 ]; then
for pkg in $cockpit_packages for pkg in $cockpit_packages; do
do
echo "Uninstalling $pkg" echo "Uninstalling $pkg"
sudo yum remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall" sudo yum remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done done
elif [ $apt_status -eq 0 ]; then elif [ $apt_status -eq 0 ]; then
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
for pkg in $cockpit_packages for pkg in $cockpit_packages; do
do
echo "Uninstalling $pkg" echo "Uninstalling $pkg"
sudo apt-get remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall" sudo apt-get remove -y "$pkg" > /dev/null || echo "$pkg failed to uninstall"
done done
else else
echo "Neither apt,dnf nor yum found. Please install one of them and try again." echo "Neither apt, dnf nor yum found. Please install one of them and try again."
end fi # 修正这里,使用 fi 而不是 end
sudo rm -rf /etc/cockpit/* sudo rm -rf /etc/cockpit/*
} }

View File

@ -17,6 +17,7 @@
], ],
"RedHat": [ "RedHat": [
"9", "9",
"8",
"7" "7"
], ],
"CentOS": [ "CentOS": [