v1.0.0beta15.3
~优化脚本语句和结构 ~完美适配支持wget!!! ~优化非root用户体验 ~增加Gitee下载源 ~增加脚本日志以及查看日志功能 ~修复部分情况下开机自启显示错误的bug
This commit is contained in:
@@ -5,7 +5,7 @@ getconfig(){
|
||||
#服务器缺省地址
|
||||
[ -z "$update_url" ] && update_url=https://cdn.jsdelivr.net/gh/juewuy/ShellClash
|
||||
#文件路径
|
||||
[ -z "$clashdir" ] && clashdir=$(dirname $(readlink -f "$0")) && echo "export clashdir=\"$clashdir\"" >> /etc/profile
|
||||
[ -z "$clashdir" ] && echo 环境变量配置有误!请重新安装脚本!
|
||||
ccfg=$clashdir/mark
|
||||
yaml=$clashdir/config.yaml
|
||||
#检查/读取标识文件
|
||||
|
||||
@@ -434,10 +434,12 @@ gettar(){
|
||||
sed -i '/versionsh_l=*/'d $clashdir/mark
|
||||
sed -i "1i\versionsh_l=$release_new" $clashdir/mark
|
||||
#设置环境变量
|
||||
sed -i '/alias clash=*/'d /etc/profile
|
||||
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> /etc/profile #设置快捷命令环境变量
|
||||
sed -i '/export clashdir=*/'d /etc/profile
|
||||
echo "export clashdir=\"$clashdir\"" >> /etc/profile #设置clash路径环境变量
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
sed -i '/alias clash=*/'d $profile
|
||||
echo "alias clash=\"$shtype $clashdir/clash.sh\"" >> $profile #设置快捷命令环境变量
|
||||
sed -i '/export clashdir=*/'d $profile
|
||||
echo "export clashdir=\"$clashdir\"" >> $profile #设置clash路径环境变量
|
||||
#删除临时文件
|
||||
rm -rf /tmp/clashfm.tar.gz
|
||||
rm -rf $clashdir/clashservice
|
||||
@@ -860,13 +862,17 @@ update(){
|
||||
rm -rf /etc/systemd/system/clash.service
|
||||
rm -rf /usr/lib/systemd/system/clash.service
|
||||
rm -rf /www/clash
|
||||
sed -i '/alias clash=*/'d /etc/profile
|
||||
sed -i '/export clashdir=*/'d /etc/profile
|
||||
sed -i '/http*_proxy/'d /etc/profile
|
||||
sed -i '/HTTP*_PROXY/'d /etc/profile
|
||||
source /etc/profile > /dev/null 2>&1
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo 已卸载ShellClash相关文件!有缘再会!
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
sed -i '/alias clash=*/'d $profile
|
||||
sed -i '/export clashdir=*/'d $profile
|
||||
sed -i '/http*_proxy/'d $profile
|
||||
sed -i '/HTTP*_PROXY/'d $profile
|
||||
source $profile > /dev/null 2>&1
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[36m已卸载ShellClash相关文件!有缘再会!\033[0m"
|
||||
echo -e "\033[33m请手动关闭当前窗口以重置环境变量!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
exit
|
||||
fi
|
||||
echo -e "\033[31m操作已取消!\033[0m"
|
||||
@@ -941,7 +947,7 @@ testcommand(){
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
exit;
|
||||
elif [ "$num" = 6 ]; then
|
||||
echo 注意:依赖curl,且测试结果不保证一定准确!
|
||||
echo "注意:依赖curl(不支持wget),且测试结果不保证一定准确!"
|
||||
delay=`curl -kx ${authentication}@127.0.0.1:$mix_port -o /dev/null -s -w '%{time_starttransfer}' 'https://google.tw' & { sleep 3 ; kill $! & }` > /dev/null 2>&1
|
||||
delay=`echo |awk "{print $delay*1000}"` > /dev/null 2>&1
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
getconfig(){
|
||||
#加载配置文件
|
||||
[ -z "$clashdir" ] && source /etc/profile > /dev/null 2>&1
|
||||
[ -z "$clashdir" ] && source /etc/profile > /dev/null
|
||||
[ -z "$clashdir" ] && source ~/.bashrc > /dev/null
|
||||
ccfg=$clashdir/mark
|
||||
[ -f $ccfg ] && source $ccfg
|
||||
#默认设置
|
||||
@@ -432,8 +433,10 @@ set_proxy)
|
||||
kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key "Proxy Config Script" "http://127.0.0.1${3}/pac"
|
||||
#环境变量方式
|
||||
else
|
||||
echo 'export all_proxy=http://127.0.0.1:'"$2" >> /etc/profile
|
||||
echo 'export ALL_PROXY=$all_proxy' >> /etc/profile
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
echo 'export all_proxy=http://127.0.0.1:'"$2" >> $profile
|
||||
echo 'export ALL_PROXY=$all_proxy' >> $profile
|
||||
fi
|
||||
;;
|
||||
unset_proxy)
|
||||
@@ -445,8 +448,10 @@ unset_proxy)
|
||||
kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key "ProxyType" 0
|
||||
#环境变量方式
|
||||
else
|
||||
sed -i '/all_proxy/'d /etc/profile
|
||||
sed -i '/ALL_PROXY/'d /etc/profile
|
||||
[ -w ~/.bashrc ] && profile=~/.bashrc
|
||||
[ -w /etc/profile ] && profile=/etc/profile
|
||||
sed -i '/all_proxy/'d $profile
|
||||
sed -i '/ALL_PROXY/'d $profile
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user