initial
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
SING_BOX="$ROOT/works/sing-box"
|
||||
|
||||
# defaults
|
||||
REPO_URL="git@git.inker.bot:arknights/sing-box.git"
|
||||
UPSTREAM_BRANCH="main"
|
||||
|
||||
CONFIG="$ROOT/works/config"
|
||||
if [ -f "$CONFIG" ]; then
|
||||
. "$CONFIG"
|
||||
fi
|
||||
|
||||
if [ -d "$SING_BOX/.git" ]; then
|
||||
echo "Updating sing-box..."
|
||||
git -C "$SING_BOX" fetch --all
|
||||
if [ -n "$UPSTREAM_BRANCH" ]; then
|
||||
git -C "$SING_BOX" checkout "$UPSTREAM_BRANCH"
|
||||
fi
|
||||
git -C "$SING_BOX" pull
|
||||
else
|
||||
echo "Cloning sing-box..."
|
||||
if [ -n "$UPSTREAM_BRANCH" ]; then
|
||||
git clone -b "$UPSTREAM_BRANCH" "$REPO_URL" "$SING_BOX"
|
||||
else
|
||||
git clone "$REPO_URL" "$SING_BOX"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Done. Version: $(git -C "$SING_BOX" describe --tags --always 2>/dev/null || git -C "$SING_BOX" rev-parse --short HEAD)"
|
||||
Reference in New Issue
Block a user