Install Importarr from repository checkout
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Run as root: sudo sh /opt/importarr/repo-upgrade.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ENV_FILE=${IMPORTARR_ENV_FILE:-/etc/importarr/importarr.env}
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$ENV_FILE"
|
||||
fi
|
||||
|
||||
REPO_DIR=${IMPORTARR_REPO_DIR:-/srv/opencode-workspace/importarr}
|
||||
SERVICE=${IMPORTARR_SERVICE:-importarr.service}
|
||||
VENV=${IMPORTARR_VENV:-/opt/importarr/venv}
|
||||
|
||||
if [ ! -d "$REPO_DIR/.git" ]; then
|
||||
echo "Importarr repo not found at $REPO_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$REPO_DIR"
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Refusing to upgrade: $REPO_DIR has uncommitted changes." >&2
|
||||
git status --short >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git fetch --prune origin
|
||||
git pull --ff-only
|
||||
"$VENV/bin/pip" install --upgrade --editable "$REPO_DIR"
|
||||
systemctl restart "$SERVICE"
|
||||
systemctl --no-pager --full status "$SERVICE"
|
||||
Reference in New Issue
Block a user