summaryrefslogtreecommitdiff
path: root/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh17
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!"