diff options
author | Jordan Gong <jordan.gong@protonmail.com> | 2020-10-03 10:58:11 +0800 |
---|---|---|
committer | Jordan Gong <jordan.gong@protonmail.com> | 2020-10-03 10:58:11 +0800 |
commit | 39bb0d50ecbdd6d9669a01c7d2c170ed07291f76 (patch) | |
tree | c377f3c8adcd01c4192f00f2dd7051f65aba1423 /update.sh |
Add basic features
- Subscription support
- V2ray-core upgrade support
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..720ea90 --- /dev/null +++ b/update.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +V2RAY_HOME=${V2RAY_HOME:-$(pwd)} +V2RAY_CONFIG_DIR=${V2RAY_CONFIG_DIR:-$(pwd)} +V2RAY_LINK="$V2RAY_CONFIG_DIR/link" +V2RAY_SUB="$V2RAY_CONFIG_DIR/subscription" + +[[ -f $V2RAY_LINK ]] \ +|| { echo "Please put subscription link in $V2RAY_LINK." >&2; exit 1; } + +echo "Updating subscription..." +xargs -i < "$V2RAY_LINK" curl "{}" -o "$V2RAY_SUB" || \ +{ echo "Cannot update subscription, check your network." >&2; exit 1; } + +echo "Subscription updated!" |