mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-23 08:00:23 +00:00
uninstall improve
This commit is contained in:
parent
35bb2d93f6
commit
84ca12d507
2 changed files with 38 additions and 40 deletions
|
@ -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
|
||||
done
|
||||
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
|
||||
remove_cockpit
|
||||
remove_files
|
||||
|
||||
echo -e "\nCongratulations, Websoft9 uninstall is complete!"
|
|
@ -24,6 +24,7 @@
|
|||
"7"
|
||||
],
|
||||
"Oracle Linux": [
|
||||
"9",
|
||||
"8",
|
||||
"7"
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue