Update Uninstall Option ()

after uninstall, script will delete itself and show Install & Upgrade command for installing again if user need that.
This commit is contained in:
Jalal Saberi 2024-02-17 19:53:02 +03:30 committed by GitHub
parent 9f38e19b81
commit 2b7ad7cb9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

17
x-ui.sh
View file

@ -150,6 +150,12 @@ custom_version() {
eval $install_command eval $install_command
} }
# Function to handle the deletion of the script file
delete_script() {
rm "$0" # Remove the script file itself
exit 1
}
uninstall() { 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
@ -167,12 +173,13 @@ uninstall() {
rm /usr/local/x-ui/ -rf rm /usr/local/x-ui/ -rf
echo "" 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 "Uninstalled Successfully.\n"
echo "If you need to install this panel again, you can use below command:"
echo -e "${green}bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)${plain}"
echo "" echo ""
# Trap the SIGTERM signal
if [[ $# == 0 ]]; then trap delete_script SIGTERM
before_show_menu delete_script
fi
} }
reset_user() { reset_user() {