mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update config_menu.sh
This commit is contained in:
parent
6f47e5b0d9
commit
c0d1eb4fcd
@ -159,15 +159,17 @@ uninstall_proxmenu() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Show checklist for dependencies
|
||||||
DEPS_TO_REMOVE=$(whiptail --title "Remove Dependencies" --checklist \
|
DEPS_TO_REMOVE=$(whiptail --title "Remove Dependencies" --checklist \
|
||||||
"$(translate "Select dependencies to remove:")" 15 60 3 \
|
"Select dependencies to remove:" 15 60 3 \
|
||||||
"python3-venv" "Python virtual environment" OFF \
|
"python3-venv" "Python virtual environment" OFF \
|
||||||
"python3-pip" "Python package installer" OFF \
|
"python3-pip" "Python package installer" OFF \
|
||||||
"jq" "JSON processor" OFF \
|
"jq" "JSON processor" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
echo "Uninstalling ProxMenu..."
|
echo "Uninstalling ProxMenu..."
|
||||||
|
|
||||||
|
# Remove googletrans if virtual environment exists
|
||||||
if [ -f "$VENV_PATH/bin/activate" ]; then
|
if [ -f "$VENV_PATH/bin/activate" ]; then
|
||||||
echo "Removing googletrans..."
|
echo "Removing googletrans..."
|
||||||
source "$VENV_PATH/bin/activate"
|
source "$VENV_PATH/bin/activate"
|
||||||
@ -175,17 +177,25 @@ uninstall_proxmenu() {
|
|||||||
deactivate
|
deactivate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove virtual environment
|
||||||
if [ -d "$VENV_PATH" ]; then
|
if [ -d "$VENV_PATH" ]; then
|
||||||
echo "Removing virtual environment..."
|
echo "Removing virtual environment..."
|
||||||
rm -rf "$VENV_PATH"
|
rm -rf "$VENV_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove selected dependencies
|
||||||
if [ -n "$DEPS_TO_REMOVE" ]; then
|
if [ -n "$DEPS_TO_REMOVE" ]; then
|
||||||
echo "Removing selected dependencies..."
|
echo "Removing selected dependencies..."
|
||||||
|
|
||||||
|
# Remove quotes and process each package
|
||||||
read -r -a DEPS_ARRAY <<< "$(echo "$DEPS_TO_REMOVE" | tr -d '"')"
|
read -r -a DEPS_ARRAY <<< "$(echo "$DEPS_TO_REMOVE" | tr -d '"')"
|
||||||
for dep in "${DEPS_ARRAY[@]}"; do
|
for dep in "${DEPS_ARRAY[@]}"; do
|
||||||
echo "Removing $dep..."
|
echo "Removing $dep..."
|
||||||
|
|
||||||
|
# Mark package as auto-installed
|
||||||
apt-mark auto "$dep" >/dev/null 2>&1
|
apt-mark auto "$dep" >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Try to remove with apt-get
|
||||||
if ! apt-get -y --purge autoremove "$dep" >/dev/null 2>&1; then
|
if ! apt-get -y --purge autoremove "$dep" >/dev/null 2>&1; then
|
||||||
echo "Failed to remove $dep with apt-get. Trying with dpkg..."
|
echo "Failed to remove $dep with apt-get. Trying with dpkg..."
|
||||||
if ! dpkg --purge "$dep" >/dev/null 2>&1; then
|
if ! dpkg --purge "$dep" >/dev/null 2>&1; then
|
||||||
@ -193,41 +203,52 @@ uninstall_proxmenu() {
|
|||||||
dpkg --force-all --purge "$dep" >/dev/null 2>&1
|
dpkg --force-all --purge "$dep" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Verify if the package was actually removed
|
||||||
if dpkg -l "$dep" 2>/dev/null | grep -q '^ii'; then
|
if dpkg -l "$dep" 2>/dev/null | grep -q '^ii'; then
|
||||||
echo "Warning: Failed to completely remove $dep. You may need to remove it manually."
|
echo "Warning: Failed to completely remove $dep. You may need to remove it manually."
|
||||||
else
|
else
|
||||||
echo "$dep successfully removed."
|
echo "$dep successfully removed."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Run autoremove to clean up any leftover dependencies
|
||||||
echo "Cleaning up unnecessary packages..."
|
echo "Cleaning up unnecessary packages..."
|
||||||
apt-get autoremove -y --purge >/dev/null 2>&1
|
apt-get autoremove -y --purge >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Restore original .bashrc if backup exists
|
||||||
if [ -f /root/.bashrc.bak ]; then
|
if [ -f /root/.bashrc.bak ]; then
|
||||||
echo "Restoring original .bashrc..."
|
echo "$(translate "Restoring original .bashrc...")"
|
||||||
mv /root/.bashrc.bak /root/.bashrc
|
mv /root/.bashrc.bak /root/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Restore original MOTD if backup exists
|
||||||
if [ -f /etc/motd.bak ]; then
|
if [ -f /etc/motd.bak ]; then
|
||||||
echo "Restoring original MOTD..."
|
echo "$(translate "Restoring original MOTD...")"
|
||||||
mv /etc/motd.bak /etc/motd
|
mv /etc/motd.bak /etc/motd
|
||||||
else
|
else
|
||||||
|
# Remove custom MOTD line if present
|
||||||
sed -i '/This system is optimised by: ProxMenux/d' /etc/motd
|
sed -i '/This system is optimised by: ProxMenux/d' /etc/motd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Remove ProxMenu files
|
||||||
rm -f "/usr/local/bin/menu"
|
rm -f "/usr/local/bin/menu"
|
||||||
rm -rf "$BASE_DIR"
|
rm -rf "$BASE_DIR"
|
||||||
|
|
||||||
echo "ProxMenu has been uninstalled."
|
echo "ProxMenu has been uninstalled."
|
||||||
|
|
||||||
if [ -n "$DEPS_TO_REMOVE" ]; then
|
if [ -n "$DEPS_TO_REMOVE" ]; then
|
||||||
echo "The following dependencies have been removed successfully: $DEPS_TO_REMOVE"
|
echo "The following dependencies have been removed successfully: $DEPS_TO_REMOVE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "ProxMenux uninstallation complete. Thank you for using it!"
|
echo "ProxMenux uninstallation complete. Thank you for using it!"
|
||||||
echo
|
echo
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
show_proxmenux_logo
|
show_proxmenux_logo
|
||||||
show_config_menu
|
show_config_menu
|
||||||
|
Loading…
x
Reference in New Issue
Block a user