summaryrefslogtreecommitdiff
path: root/update.sh
blob: 720ea900044a8debcea071c53ab9cce618d7c2a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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!"