fix updater

This commit is contained in:
guochao 2022-07-18 16:04:10 +08:00
parent 1c484f8caa
commit da81d2436c
2 changed files with 8 additions and 9 deletions

View File

@ -10,11 +10,11 @@
dontPatchELF = true;
dontUnpack = true;
checkPhase = ''
patchShebangs bin
'';
installPhase = ''
makeWrapper $src $out/bin/clash-updater --set SUBSCRIPTION_URL "${subscription}"
mkdir -pv $out/bin
cp -v $src $out/bin/updater.sh
patchShebangs $out/bin/updater.sh
makeWrapper $out/bin/updater.sh $out/bin/clash-updater --set SUBSCRIPTION_URL "${subscription}"
'';
}

View File

@ -3,18 +3,17 @@
set -euo pipefail
IFS=$'\n\t'
TEMP=${TEMP:-$(mktemp /tmp/clash-config-XXXXXX)}
OUTPUT=${OUTPUT:-$HOME/.config/clash/testoutput.yaml}
TEMP=$(mktemp /tmp/clash-config-XXXXXX)
OUTPUT=${OUTPUT:-$HOME/.config/clash/config.yaml}
OUTDIR=$(dirname $OUTPUT)
LOG="/tmp/clash-updater.log"
exec > ${LOG}
exec 2>&1 > ${LOG}
set -x
while true; do
curl -v --continue -o ${TEMP} ${SUBSCRIPTION_URL}
curl -v -o ${TEMP} ${SUBSCRIPTION_URL}
RET=$?
if [[ $RET -eq 0 ]]; then