Merge pull request #1179 from sofia-riese/redesign-uninstall

feat(uninstall.sh): redesign static text menu
This commit is contained in:
juewuy
2026-01-24 14:17:28 +08:00
committed by GitHub
4 changed files with 293 additions and 273 deletions

View File

@@ -250,6 +250,7 @@ settings() {
;; ;;
esac esac
separator_line "=" separator_line "="
line_break
sleep 1 sleep 1
exit 0 exit 0
;; ;;

View File

@@ -4,74 +4,74 @@
[ -n "$__IS_MODULE_6_CORECONFIG_LOADED" ] && return [ -n "$__IS_MODULE_6_CORECONFIG_LOADED" ] && return
__IS_MODULE_6_CORECONFIG_LOADED=1 __IS_MODULE_6_CORECONFIG_LOADED=1
if echo "$crashcore" | grep -q 'singbox';then if echo "$crashcore" | grep -q 'singbox'; then
CONFIG_PATH="$CRASHDIR"/yamls/config.json CONFIG_PATH="$CRASHDIR"/yamls/config.json
else else
CONFIG_PATH="$CRASHDIR"/jsons/config.yaml CONFIG_PATH="$CRASHDIR"/jsons/config.yaml
fi fi
# 配置文件主界面 # 配置文件主界面
set_core_config() { set_core_config() {
while true; do while true; do
common_tittle "\033[30;47m配置文件管理\033[0m" format_box "\033[30;47m配置文件管理\033[0m"
[ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ] && { [ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ] && {
echo -e "\033[36m输入数字可管理对应提供者\033[0m" echo -e "\033[36m输入数字可管理对应提供者\033[0m"
cat "$CRASHDIR"/configs/providers.cfg "$CRASHDIR"/configs/providers_uri.cfg 2>/dev/null | cat "$CRASHDIR"/configs/providers.cfg "$CRASHDIR"/configs/providers_uri.cfg 2>/dev/null |
awk '{print " " NR ") " $1 "\t" substr($2,1,30) "..."}' awk '{print " " NR ") " $1 "\t" substr($2,1,30) "..."}'
separator_line "-" separator_line "-"
} }
content_line "a) \033[32m添加提供者\033[0m(支持订阅/节点/本地文件)" content_line "a) \033[32m添加提供者\033[0m(支持订阅/节点/本地文件)"
content_line "b) \033[36m本地生成配置文件\033[0m(基于providers,推荐!)" content_line "b) \033[36m本地生成配置文件\033[0m(基于providers,推荐!)"
content_line "c) \033[33m在线生成配置文件\033[0m(Subconverter)" content_line "c) \033[33m在线生成配置文件\033[0m(Subconverter)"
content_line "d) \033[31m清空提供者列表\033[0m" content_line "d) \033[31m清空提供者列表\033[0m"
content_line "e) \033[36m自定义配置文件\033[0m" content_line "e) \033[36m自定义配置文件\033[0m"
content_line "f) \033[33m还原配置文件\033[0m" content_line "f) \033[33m还原配置文件\033[0m"
common_back common_back
read -r -p "$COMMON_INPUT_L > " num read -r -p "$COMMON_INPUT_L > " num
case "$num" in case "$num" in
"" | 0) "" | 0)
break break
;; ;;
[1-9] | [1-9][0-9]) [1-9] | [1-9][0-9])
line=$(cat "$CRASHDIR"/configs/providers.cfg "$CRASHDIR"/configs/providers_uri.cfg 2>/dev/null |sed -n "$num p") line=$(cat "$CRASHDIR"/configs/providers.cfg "$CRASHDIR"/configs/providers_uri.cfg 2>/dev/null | sed -n "$num p")
setproviders setproviders
;; ;;
a) a)
line='' line=''
setproviders setproviders
;; ;;
b) b)
if [ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ];then if [ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ]; then
if [ "$crashcore" = meta ] || [ "$crashcore" = singboxr ]; then if [ "$crashcore" = meta ] || [ "$crashcore" = singboxr ]; then
. "$CRASHDIR"/menus/providers.sh . "$CRASHDIR"/menus/providers.sh
providers providers
else else
error_report "\033[33m仅限Mihomo/singboxr内核使用,请更换内核!\033[0m" error_report "\033[33m仅限Mihomo/singboxr内核使用,请更换内核!\033[0m"
fi fi
else else
error_report "请先添加提供者!" error_report "请先添加提供者!"
fi fi
;; ;;
c) c)
if [ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ];then if [ -s "$CRASHDIR"/configs/providers.cfg ] || [ -s "$CRASHDIR"/configs/providers_uri.cfg ]; then
. "$CRASHDIR"/menus/subconverter.sh . "$CRASHDIR"/menus/subconverter.sh
subconverter subconverter
else else
error_report "请先添加提供者!" error_report "请先添加提供者!"
fi fi
;; ;;
d) d)
separator_line "=" separator_line "="
content_line "\033[33m警告这将删除所有提供者且无法还原\033[0m" content_line "\033[33m警告这将删除所有提供者且无法还原\033[0m"
separator_line "-" separator_line "-"
read -r -p "确认清空提供者列表?(1/0) > " res read -r -p "确认清空提供者列表?(1/0) > " res
[ "$res" = 1 ] && { [ "$res" = 1 ] && {
rm -f "$CRASHDIR"/configs/providers.cfg rm -f "$CRASHDIR"/configs/providers.cfg
rm -f "$CRASHDIR"/configs/providers_uri.cfg rm -f "$CRASHDIR"/configs/providers_uri.cfg
common_success common_success
} }
;; ;;
e) e)
checkcfg=$(cat $CFG_PATH) checkcfg=$(cat $CFG_PATH)
override override
@@ -87,7 +87,7 @@ set_core_config() {
else else
echo "-----------------------------------------------" echo "-----------------------------------------------"
content_line "备份文件共有\033[32m$(wc -l <$"$CONFIG_PATH".bak)\033[0m行内容" content_line "备份文件共有\033[32m$(wc -l <$"$CONFIG_PATH".bak)\033[0m行内容"
content_line "当前文件共有\033[32m$(wc -l <$"$CONFIG_PATH")\033[0m行内容" content_line "当前文件共有\033[32m$(wc -l <$"$CONFIG_PATH")\033[0m行内容"
read -p "确认还原配置文件?此操作不可逆![1/0] > " res read -p "确认还原配置文件?此操作不可逆![1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
mv "$CONFIG_PATH".bak "$CONFIG_PATH" mv "$CONFIG_PATH".bak "$CONFIG_PATH"
@@ -112,212 +112,218 @@ set_core_config() {
} }
setproviders() { setproviders() {
case "$(echo "$line" | cut -d ' ' -f 2)" in case "$(echo "$line" | cut -d ' ' -f 2)" in
http* | ./providers*) http* | ./providers*)
set -- $line set -- $line
name=$1; link=$2; interval=$3; interval2=$4 name=$1
ua=$5; exclude=$6; include=$7 link=$2
;; interval=$3
*) interval2=$4
set -- $line ua=$5
name=$1; link_uri=$2; exclude=$6
;; include=$7
esac ;;
[ -z "$interval" ] && interval=3 *)
[ -z "$interval2" ] && interval2=12 set -- $line
[ -z "$ua" ] && ua='clash.meta' name=$1
link_uri=$2
;;
esac
[ -z "$interval" ] && interval=3
[ -z "$interval2" ] && interval2=12
[ -z "$ua" ] && ua='clash.meta'
while true; do while true; do
link_info=$(echo "$link$link_uri" | cut -c 1-30) link_info=$(echo "$link$link_uri" | cut -c 1-30)
common_tittle "\033[36m支持添加订阅链接/分享链接/本地文件作为提供者\033[0m" format_box "\033[36m支持添加订阅链接/分享链接/本地文件作为提供者\033[0m"
content_line "1) 设置\033[36m名称或代号\033[0m \033[32m$name\033[0m" content_line "1) 设置\033[36m名称或代号\033[0m \033[32m$name\033[0m"
content_line "2) 设置\033[32m链接或路径\033[0m \033[36m$link_info...\033[0m" content_line "2) 设置\033[32m链接或路径\033[0m \033[36m$link_info...\033[0m"
[ -n "$link" ] && { [ -n "$link" ] && {
separator_line '-' separator_line '-'
content_line "3) 设置\033[33m健康检查间隔\033[0m\t\033[47;30m$interval\033[0m" content_line "3) 设置\033[33m健康检查间隔\033[0m\t\033[47;30m$interval\033[0m"
content_line "4) 设置\033[36m自动更新间隔\033[0m\t\033[47;30m$interval2\033[0m" content_line "4) 设置\033[36m自动更新间隔\033[0m\t\033[47;30m$interval2\033[0m"
content_line "5) 设置\033[31m排除节点正则\033[0m\t\033[47;30m$exclude\033[0m" content_line "5) 设置\033[31m排除节点正则\033[0m\t\033[47;30m$exclude\033[0m"
content_line "6) 设置\033[32m包含节点正则\033[0m\t\033[47;30m$include\033[0m" content_line "6) 设置\033[32m包含节点正则\033[0m\t\033[47;30m$include\033[0m"
echo "$link" | grep -q '^http' && echo "$link" | grep -q '^http' &&
content_line "7) 设置\033[33m虚拟浏览器UA\033[0m\t\033[47;30m$ua\033[0m" content_line "7) 设置\033[33m虚拟浏览器UA\033[0m\t\033[47;30m$ua\033[0m"
} }
separator_line "-" separator_line "-"
content_line "a) \033[32m添加此提供者\033[0m" content_line "a) \033[32m添加此提供者\033[0m"
[ -n "$link" ] && [ -n "$link" ] &&
content_line "b) \033[32m本地生成\033[0m仅包含此提供者的配置文件" content_line "b) \033[32m本地生成\033[0m仅包含此提供者的配置文件"
echo "$link$link_uri" | grep -q '://' && echo "$link$link_uri" | grep -q '://' &&
content_line "c) \033[33m在线生成\033[0m仅包含此提供者的配置文件" content_line "c) \033[33m在线生成\033[0m仅包含此提供者的配置文件"
[ -n "$link" ] && [ -n "$link" ] &&
content_line "e) 直接使用此配置文件(不经过转换)" content_line "e) 直接使用此配置文件(不经过转换)"
content_line "d) \033[31m删除此提供者\033[0m" content_line "d) \033[31m删除此提供者\033[0m"
common_back common_back
read -r -p "请输入对应数字> " num read -r -p "请输入对应数字> " num
case "$num" in case "$num" in
"" | 0) "" | 0)
break break
;; ;;
1) 1)
separator_line "=" separator_line "="
content_line "注意:名称或代号不可重复,且不支持纯数字!" content_line "注意:名称或代号不可重复,且不支持纯数字!"
separator_line "-" separator_line "-"
read -p "请输入具体名称或代号 > " text read -p "请输入具体名称或代号 > " text
text=$(echo $text | sed 's/ //g') #去空格 text=$(echo $text | sed 's/ //g') #去空格
if [ -n "$text" ] && [ -z "$(echo "$text" | grep -E '^[0-9]+$')" ] && ! grep -q "$text" "$CRASHDIR"/configs/providers.cfg;then if [ -n "$text" ] && [ -z "$(echo "$text" | grep -E '^[0-9]+$')" ] && ! grep -q "$text" "$CRASHDIR"/configs/providers.cfg; then
name="$text" name="$text"
else else
error_input error_input
fi fi
;; ;;
2) 2)
separator_line "=" separator_line "="
content_line "订阅链接-支持https/http开头的clash配置文件订阅链接" content_line "订阅链接-支持https/http开头的clash配置文件订阅链接"
content_line "分享链接-支持ss|vmess|vless|trojan|tuic|anytls|shadowtls|hysteria(2)..." content_line "分享链接-支持ss|vmess|vless|trojan|tuic|anytls|shadowtls|hysteria(2)..."
content_line "本地文件-必须放在此目录下:\033[32m$CRASHDIR/providers\033[0m" content_line "本地文件-必须放在此目录下:\033[32m$CRASHDIR/providers\033[0m"
separator_line "-" separator_line "-"
read -p "请输入具体链接或文件名 > " text read -p "请输入具体链接或文件名 > " text
text=$(echo "$text" | sed 's/ //g') #去空格 text=$(echo "$text" | sed 's/ //g') #去空格
if echo "$text" | grep -q '^http';then if echo "$text" | grep -q '^http'; then
text=$(echo "$text" | sed 's/ *(.*)//g; s/#.*//g') #处理注释及超链接 text=$(echo "$text" | sed 's/ *(.*)//g; s/#.*//g') #处理注释及超链接
link="$text" link="$text"
elif [ -n "$(echo $text | grep -E '^ss|vmess|vless|trojan|tuic|anytls|shadowtls|hysteria(2)')" ];then elif [ -n "$(echo $text | grep -E '^ss|vmess|vless|trojan|tuic|anytls|shadowtls|hysteria(2)')" ]; then
link_uri=$(echo "$text" | sed 's/#.*//g') # 删除注释 link_uri=$(echo "$text" | sed 's/#.*//g') # 删除注释
[ -z "$name" ] && name=$(echo "$text" | grep -o '#.*$' | cut -c2-) [ -z "$name" ] && name=$(echo "$text" | grep -o '#.*$' | cut -c2-)
elif [ -f "$CRASHDIR/providers/$text" ];then elif [ -f "$CRASHDIR/providers/$text" ]; then
link="./providers/$text" link="./providers/$text"
else else
error_input error_input
fi fi
;; ;;
3) 3)
read -p "请输入健康检查间隔(单位:分钟) > " num read -p "请输入健康检查间隔(单位:分钟) > " num
if [ -n "$num" ];then if [ -n "$num" ]; then
interval="$num" interval="$num"
else else
errornum errornum
fi fi
;; ;;
4) 4)
read -p "请输入自动更新间隔(单位:小时) > " num read -p "请输入自动更新间隔(单位:小时) > " num
if [ -n "$num" ];then if [ -n "$num" ]; then
interval2="$num" interval2="$num"
else else
errornum errornum
fi fi
;; ;;
5) 5)
read -p "请输入需要排除的节点关键字(支持正则) > " text read -p "请输入需要排除的节点关键字(支持正则) > " text
if [ -n "$text" ];then if [ -n "$text" ]; then
exclude="$text" exclude="$text"
else else
error_input error_input
fi fi
;; ;;
6) 6)
read -p "请输入需要筛选使用的节点关键字(支持正则) > " text read -p "请输入需要筛选使用的节点关键字(支持正则) > " text
if [ -n "$text" ];then if [ -n "$text" ]; then
include="$text" include="$text"
else else
error_input error_input
fi fi
;; ;;
7) 7)
read -p "请输入浏览器UA > " text read -p "请输入浏览器UA > " text
if [ -n "$text" ];then if [ -n "$text" ]; then
ua="$text" ua="$text"
else else
error_input error_input
fi fi
;; ;;
a) a)
addproviders && common_success addproviders && common_success
break break
;; ;;
b) b)
if echo "$link" | grep -q '^http';then if echo "$link" | grep -q '^http'; then
addproviders addproviders
. "$CRASHDIR"/menus/providers.sh . "$CRASHDIR"/menus/providers.sh
gen_${coretype}_providers "$name" "$link" "$interval" "$interval2" "$exclude" "$include" gen_${coretype}_providers "$name" "$link" "$interval" "$interval2" "$exclude" "$include"
else else
content_line "\033[31m$请先完成必填选项!\033[0m" content_line "\033[31m$请先完成必填选项!\033[0m"
fi fi
;; ;;
c) c)
if [ -n "$name" ] && [ -n "$link$link_uri" ];then if [ -n "$name" ] && [ -n "$link$link_uri" ]; then
addproviders addproviders
Url="$link$link_uri" Url="$link$link_uri"
Https='' Https=''
setconfig Url "'$Url'" setconfig Url "'$Url'"
setconfig Https setconfig Https
# 获取在线文件 # 获取在线文件
jump_core_config jump_core_config
else else
content_line "\033[31m请先完成必填选项\033[0m" content_line "\033[31m请先完成必填选项\033[0m"
fi fi
;; ;;
d) d)
if [ -n "$name" ] && [ -n "$link" ];then if [ -n "$name" ] && [ -n "$link" ]; then
sed -i "/^$name /d" "$CRASHDIR"/configs/providers.cfg sed -i "/^$name /d" "$CRASHDIR"/configs/providers.cfg
content_line "\033[32m$COMMON_SUCCESS\033[0m" content_line "\033[32m$COMMON_SUCCESS\033[0m"
elif [ -n "$name" ] && [ -n "$link_uri" ];then elif [ -n "$name" ] && [ -n "$link_uri" ]; then
sed -i "/^$name /d" "$CRASHDIR"/configs/providers_uri.cfg sed -i "/^$name /d" "$CRASHDIR"/configs/providers_uri.cfg
content_line "\033[32m$COMMON_SUCCESS\033[0m" content_line "\033[32m$COMMON_SUCCESS\033[0m"
fi fi
break break
;; ;;
e) e)
if [ -n "$link" ];then if [ -n "$link" ]; then
content_line "注意:\033[31m此功能不兼容“跳过证书验证”功能\033[0m" content_line "注意:\033[31m此功能不兼容“跳过证书验证”功能\033[0m"
content_line "\033[31m请确认你完全理解自己在做什么\033[0m" content_line "\033[31m请确认你完全理解自己在做什么\033[0m"
read -p "我确认遇到问题可以自行解决(1/0) > " res read -p "我确认遇到问题可以自行解决(1/0) > " res
[ "$res" = "1" ] && { [ "$res" = "1" ] && {
if [ -s "$CRASHDIR/$link" ];then if [ -s "$CRASHDIR/$link" ]; then
[ -n "$name" ] && addproviders [ -n "$name" ] && addproviders
ln -sf "$CRASHDIR/$link" "$CONFIG_PATH" ln -sf "$CRASHDIR/$link" "$CONFIG_PATH"
elif [ -n "$link" ];then elif [ -n "$link" ]; then
[ -n "$name" ] && addproviders [ -n "$name" ] && addproviders
Https="$link" Https="$link"
Url='' Url=''
setconfig Https "'$Https'" setconfig Https "'$Https'"
setconfig Url setconfig Url
# 获取在线文件 # 获取在线文件
jump_core_config jump_core_config
fi fi
} }
else else
content_line "\033[31m$请先完成必填选项!\033[0m" content_line "\033[31m$请先完成必填选项!\033[0m"
fi fi
;; ;;
*) *)
error_letter error_letter
break break
;; ;;
esac esac
done done
} }
addproviders() { addproviders() {
[ -n "$name" ] && { [ -n "$name" ] && {
[ -s "$CRASHDIR"/configs/providers.cfg ] && sed -i "/^$name /d" "$CRASHDIR"/configs/providers.cfg [ -s "$CRASHDIR"/configs/providers.cfg ] && sed -i "/^$name /d" "$CRASHDIR"/configs/providers.cfg
[ -s "$CRASHDIR"/configs/providers_uri.cfg ] && sed -i "/^$name /d" "$CRASHDIR"/configs/providers_uri.cfg [ -s "$CRASHDIR"/configs/providers_uri.cfg ] && sed -i "/^$name /d" "$CRASHDIR"/configs/providers_uri.cfg
} }
if [ -n "$name" ] && [ -n "$link" ];then if [ -n "$name" ] && [ -n "$link" ]; then
echo "$name $link $interval $interval2 $ua $exclude $include" >>"$CRASHDIR"/configs/providers.cfg echo "$name $link $interval $interval2 $ua $exclude $include" >>"$CRASHDIR"/configs/providers.cfg
return 0 return 0
elif [ -n "$name" ] && [ -n "$link_uri" ];then elif [ -n "$name" ] && [ -n "$link_uri" ]; then
echo "$name $link_uri" >>"$CRASHDIR"/configs/providers_uri.cfg echo "$name $link_uri" >>"$CRASHDIR"/configs/providers_uri.cfg
return 0 return 0
else else
error_report "\033[31m请先完成必填选项\033[0m" error_report "\033[31m请先完成必填选项\033[0m"
return 1 return 1
fi fi
} }
# 调用工具在线获取配置文件 # 调用工具在线获取配置文件
jump_core_config(){ jump_core_config() {
. "$CRASHDIR"/starts/core_config.sh && get_core_config . "$CRASHDIR"/starts/core_config.sh && get_core_config
if [ "$?" = 0 ];then if [ "$?" = 0 ]; then
if [ "$inuserguide" != 1 ];then if [ "$inuserguide" != 1 ]; then
read -p "是否启动服务以使配置文件生效?(1/0) > " res read -p "是否启动服务以使配置文件生效?(1/0) > " res
[ "$res" = 1 ] && start_core || main_menu [ "$res" = 1 ] && start_core || main_menu
exit; exit
fi fi
fi fi
} }

View File

@@ -1,22 +1,23 @@
error_report() { error_report() {
line_break line_break
separator_line "=" separator_line "="
content_line "\033[31m$1\033[0m" content_line "\033[31m$1\033[0m"
separator_line "=" separator_line "="
sleep 1 sleep 1
} }
common_tittle() { format_box() {
line_break line_break
separator_line "=" separator_line "="
content_line "$1" for line in "$@"; do
separator_line "-" content_line "$line"
done
separator_line "="
} }
common_back() { common_back() {
content_line "0) $COMMON_BACK" content_line "0) $COMMON_BACK"
separator_line "=" separator_line "="
} }
errornum() { errornum() {
@@ -24,21 +25,21 @@ errornum() {
} }
error_letter() { error_letter() {
error_report "\033[31m$COMMON_ERR_LETTER\033[0m" error_report "\033[31m$COMMON_ERR_LETTER\033[0m"
} }
error_input() { error_input() {
error_report "\033[31m$COMMON_ERR_INPUT\033[0m" error_report "\033[31m$COMMON_ERR_INPUT\033[0m"
} }
cancel_back() { cancel_back() {
separator_line "-" separator_line "-"
content_line "$COMMON_CANCEL" content_line "$COMMON_CANCEL"
sleep 1 sleep 1
} }
common_success() { common_success() {
separator_line "-" separator_line "-"
content_line "\033[32m$COMMON_SUCCESS\033[0m" content_line "\033[32m$COMMON_SUCCESS\033[0m"
sleep 1 sleep 1
} }

View File

@@ -1,19 +1,30 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
#卸载 # 卸载
uninstall() { uninstall() {
read -p "确认卸载ShellCrash(警告:该操作不可逆!)[1/0] > " res format_box "\033[31m警告\033[0m" \
"\033[31m该操作不可逆\033" \
"是否确认卸载ShellCrash"
content_line "1) 是"
content_line "0) 否"
separator_line "="
read -r -p "$COMMON_INPUT> " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
#停止服务 # 停止服务
"$CRASHDIR"/start.sh stop 2>/dev/null "$CRASHDIR"/start.sh stop 2>/dev/null
"$CRASHDIR"/start.sh cronset "clash服务" 2>/dev/null "$CRASHDIR"/start.sh cronset "clash服务" 2>/dev/null
"$CRASHDIR"/start.sh cronset "订阅链接" 2>/dev/null "$CRASHDIR"/start.sh cronset "订阅链接" 2>/dev/null
"$CRASHDIR"/start.sh cronset "ShellCrash初始化" 2>/dev/null "$CRASHDIR"/start.sh cronset "ShellCrash初始化" 2>/dev/null
"$CRASHDIR"/start.sh cronset "task.sh" 2>/dev/null "$CRASHDIR"/start.sh cronset "task.sh" 2>/dev/null
#移除安装目录
# 移除安装目录
if [ -n "$CRASHDIR" ] && [ "$CRASHDIR" != '/' ]; then if [ -n "$CRASHDIR" ] && [ "$CRASHDIR" != '/' ]; then
read -p "是否保留脚本配置及订阅文件[1/0] > " res format_box "是否保留脚本配置及订阅文件"
content_line "1) 是"
content_line "0) 否"
separator_line "="
read -r -p "$COMMON_INPUT> " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
mv -f "$CRASHDIR"/configs /tmp/ShellCrash/configs_bak mv -f "$CRASHDIR"/configs /tmp/ShellCrash/configs_bak
mv -f "$CRASHDIR"/yamls /tmp/ShellCrash/yamls_bak mv -f "$CRASHDIR"/yamls /tmp/ShellCrash/yamls_bak
@@ -26,10 +37,10 @@ uninstall() {
rm -rf "$CRASHDIR" rm -rf "$CRASHDIR"
fi fi
else else
echo -e "\033[31m环境变量配置有误请尝试手动移除安装目录\033[0m" error_report "\033[31m环境变量配置有误请尝试手动移除安装目录\033[0m"
sleep 1
fi fi
#移除其他内容
# 移除其他内容
sed -i "/alias $my_alias=*/"d /etc/profile 2>/dev/null sed -i "/alias $my_alias=*/"d /etc/profile 2>/dev/null
sed -i '/alias crash=*/'d /etc/profile 2>/dev/null sed -i '/alias crash=*/'d /etc/profile 2>/dev/null
sed -i '/export CRASHDIR=*/'d /etc/profile 2>/dev/null sed -i '/export CRASHDIR=*/'d /etc/profile 2>/dev/null
@@ -54,12 +65,13 @@ uninstall() {
userdel -r shellcrash 2>/dev/null userdel -r shellcrash 2>/dev/null
nvram set script_usbmount="" 2>/dev/null nvram set script_usbmount="" 2>/dev/null
nvram commit 2>/dev/null nvram commit 2>/dev/null
echo "-----------------------------------------------" format_box "\033[36m已卸载ShellCrash相关文件有缘再会\033[0m" \
echo -e "\033[36m已卸载ShellCrash相关文件有缘再会\033[0m" "\033[33m请手动关闭当前窗口以重置环境变量\033[0m"
echo -e "\033[33m请手动关闭当前窗口以重置环境变量\033[0m" line_break
echo "-----------------------------------------------" sleep 1
exit exit 0
else else
echo -e "\033[31m操作已取消\033[0m" format_box "\033[31m操作已取消\033[0m"
sleep 1
fi fi
} }