From 4bbdc3ca3afc71605bcb312d026ac73e501fd4f2 Mon Sep 17 00:00:00 2001 From: juewuy Date: Tue, 1 Aug 2023 22:24:56 +0800 Subject: [PATCH] =?UTF-8?q?v1.7.10d=20~=E4=BF=AE=E5=A4=8D=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E8=8A=82=E7=82=B9=E5=8F=8A=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=AD=96=E7=95=A5=E7=BB=84=E6=97=A0=E6=B3=95=E8=A2=AB?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=8A=A0=E8=BD=BD=E7=9A=84bug=20~=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DTUN=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=A4=B1=E8=B4=A5=E7=9A=84bug=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=B7=A5=E5=85=B7=E6=9F=A5=E7=9C=8Byaml?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=97=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 2 +- scripts/misnap_init.sh | 2 +- scripts/start.sh | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 6275cef..405fe6c 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -1582,7 +1582,7 @@ testcommand(){ exit; elif [ "$num" = 5 ]; then echo ----------------------------------------------- - sed -n '1,40p' $YAMLSDIR/config.yaml + sed -n '1,40p' $clashdir/config.yaml echo ----------------------------------------------- exit; elif [ "$num" = 6 ]; then diff --git a/scripts/misnap_init.sh b/scripts/misnap_init.sh index 2a8f2f5..d361559 100644 --- a/scripts/misnap_init.sh +++ b/scripts/misnap_init.sh @@ -34,7 +34,7 @@ tunfix(){ mkdir -p /tmp/overlay/work mount -o noatime,lowerdir=${ko_dir},upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work -t overlay "overlay_mods_only" ${ko_dir} #将tun.ko链接到lib - ln -s $clashdir/configs/tun.ko ${ko_dir}/tun.ko + ln -sf $clashdir/tools/tun.ko ${ko_dir}/tun.ko } init(){ #等待启动完成 diff --git a/scripts/start.sh b/scripts/start.sh index c4a578a..445a97d 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -376,16 +376,16 @@ EOF #插入自定义策略组 sed -i "/#自定义策略组开始/,/#自定义策略组结束/d" $TMPDIR/proxy-groups.yaml sed -i "/#自定义策略组/d" $TMPDIR/proxy-groups.yaml - [ -n "$(grep -Ev '^#' $clashdir/proxy-groups.yaml 2>/dev/null)" ] && { + [ -n "$(grep -Ev '^#' $clashdir/yamls/proxy-groups.yaml 2>/dev/null)" ] && { #获取空格数 space_name=$(grep -aE '^ *- name: ' $TMPDIR/proxy-groups.yaml | head -n 1 | grep -oE '^ *') space_proxy=$(grep -A 1 'proxies:$' $TMPDIR/proxy-groups.yaml | grep -aE '^ *- ' | head -n 1 | grep -oE '^ *') #合并自定义策略组到proxy-groups.yaml - cat $clashdir/proxy-groups.yaml | sed "/^#/d" | sed "s/#.*//g" | sed '1i\ #自定义策略组开始' | sed '$a\ #自定义策略组结束' | sed "s/^ */${space_name} /g" | sed "s/^ *- /${space_proxy}- /g" | sed "s/^ *- name: /${space_name}- name: /g" > $TMPDIR/proxy-groups_add.yaml + cat $clashdir/yamls/proxy-groups.yaml | sed "/^#/d" | sed "s/#.*//g" | sed '1i\ #自定义策略组开始' | sed '$a\ #自定义策略组结束' | sed "s/^ */${space_name} /g" | sed "s/^ *- /${space_proxy}- /g" | sed "s/^ *- name: /${space_name}- name: /g" > $TMPDIR/proxy-groups_add.yaml cat $TMPDIR/proxy-groups.yaml >> $TMPDIR/proxy-groups_add.yaml mv -f $TMPDIR/proxy-groups_add.yaml $TMPDIR/proxy-groups.yaml oldIFS="$IFS" - grep "\- name: " $clashdir/proxy-groups.yaml | sed "/^#/d" | while read line;do #将自定义策略组插入现有的proxy-group + grep "\- name: " $clashdir/yamls/proxy-groups.yaml | sed "/^#/d" | while read line;do #将自定义策略组插入现有的proxy-group new_group=$(echo $line | grep -Eo '^ *- name:.*#' | cut -d'#' -f1 | sed 's/.*name: //g') proxy_groups=$(echo $line | grep -Eo '#.*' | sed "s/#//" ) IFS="#" @@ -404,11 +404,11 @@ EOF #插入自定义代理 sed -i "/#自定义代理/d" $TMPDIR/proxies.yaml sed -i "/#自定义代理/d" $TMPDIR/proxy-groups.yaml - [ -n "$(grep -Ev '^#' $clashdir/proxies.yaml 2>/dev/null)" ] && { + [ -n "$(grep -Ev '^#' $clashdir/yamls/proxies.yaml 2>/dev/null)" ] && { space_proxy=$(cat $TMPDIR/proxies.yaml | grep -aE '^ *- ' | head -n 1 | grep -oE '^ *') #获取空格数 - cat $clashdir/proxies.yaml | sed "s/^ *- /${space_proxy}- /g" | sed "/^#/d" | sed "/^ *$/d" | sed 's/#.*/ #自定义代理/g' >> $TMPDIR/proxies.yaml #插入节点 + cat $clashdir/yamls/proxies.yaml | sed "s/^ *- /${space_proxy}- /g" | sed "/^#/d" | sed "/^ *$/d" | sed 's/#.*/ #自定义代理/g' >> $TMPDIR/proxies.yaml #插入节点 oldIFS="$IFS" - cat $clashdir/proxies.yaml | sed "/^#/d" | while read line;do #将节点插入proxy-group + cat $clashdir/yamls/proxies.yaml | sed "/^#/d" | while read line;do #将节点插入proxy-group proxy_name=$(echo $line | grep -Eo 'name: .+, ' | cut -d',' -f1 | sed 's/name: //g') proxy_groups=$(echo $line | grep -Eo '#.*' | sed "s/#//" ) IFS="#"