Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJalal Saberi <130910450+jalalsaberi@users.noreply.github.com>2024-02-17 19:23:02 +0300
committerGitHub <noreply@github.com>2024-02-17 19:23:02 +0300
commit2b7ad7cb9b0ea29f00b739905de0628ae9f166f9 (patch)
tree8f5af9ee772d61eeedfdad728480952149dfbf9c /x-ui.sh
parent9f38e19b81c34642644c9dc6019bd6471722f5e6 (diff)
Update Uninstall Option (#1801)
after uninstall, script will delete itself and show Install & Upgrade command for installing again if user need that.
Diffstat (limited to 'x-ui.sh')
-rw-r--r--x-ui.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/x-ui.sh b/x-ui.sh
index d49095a1..518b9232 100644
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -150,6 +150,12 @@ 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"
if [[ $? != 0 ]]; then
@@ -167,12 +173,13 @@ uninstall() {
rm /usr/local/x-ui/ -rf
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 ""
-
- if [[ $# == 0 ]]; then
- before_show_menu
- fi
+ # Trap the SIGTERM signal
+ trap delete_script SIGTERM
+ delete_script
}
reset_user() {