Skip to content

Commit

Permalink
Update Uninstall Option (alireza0#942)
Browse files Browse the repository at this point in the history
after uninstall, script will delete itself and show Install & Upgrade command for installing again if user need that.
  • Loading branch information
jalalsaberi authored Feb 13, 2024
1 parent b829ebc commit fbc4ba1
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,14 @@ custom_version() {
eval $install_command
}

# Function to handle the deletion of the script file
delete_script() {
rm "$0" # Remove the script file itself
exit 1
}

uninstall() {
confirm "Are you sure you want to uninstall the panel? xray will also uninstalled!" "n"
confirm "Are you sure you want to uninstall the panel? xray will also uninstalled!" " n"
if [[ $? != 0 ]]; then
if [[ $# == 0 ]]; then
show_menu
Expand All @@ -148,14 +154,14 @@ uninstall() {
systemctl reset-failed
rm /etc/x-ui/ -rf
rm /usr/local/x-ui/ -rf

echo -e "\nUninstalled Successfully."
echo ""
echo -e "Uninstalled Successfully,If you want to remove this script,then after exiting the script run ${green}rm /usr/bin/x-ui -f${plain} to delete it."
echo -e "If you need to install this panel again, you can use below command:"
echo -e "${green}bash <(curl -Ls https://raw.githubusercontent.com/alireza0/x-ui/master/install.sh)${plain}"
echo ""

if [[ $# == 0 ]]; then
before_show_menu
fi
# Trap the SIGTERM signal
trap delete_script SIGTERM
delete_script
}

reset_user() {
Expand Down

0 comments on commit fbc4ba1

Please sign in to comment.