diff --git a/scripts/install.sh b/scripts/install.sh index fd48b03..17c6d0e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -26,6 +26,13 @@ VENV_DIR="$EVECTION_HOME/venv" EVECTION_USER="${EVECTION_USER:-evection}" PYTHON_BIN="${PYTHON_BIN:-python3}" +# $APP_DIR ends up owned by $EVECTION_USER (see below), but the git steps +# in this script run as root — without this, git refuses to touch a repo +# it doesn't own ("detected dubious ownership"), which is exactly what +# happens re-running this script after a previous run got far enough to +# chown the checkout. +git config --global --add safe.directory "$APP_DIR" + echo "==> Installing Evection" echo " App directory: $APP_DIR" echo " Service user: $EVECTION_USER" diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index cf31dc7..020e7a9 100755 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -28,6 +28,11 @@ VENV_DIR="$EVECTION_HOME/venv" EVECTION_USER="${EVECTION_USER:-evection}" SOCKET="/run/evection/gunicorn.sock" +# $APP_DIR is owned by $EVECTION_USER, but the git steps below run as +# root — without this, git refuses to touch a repo it doesn't own +# ("detected dubious ownership"). +git config --global --add safe.directory "$APP_DIR" + if ! id -u "$EVECTION_USER" >/dev/null 2>&1; then echo "System user '$EVECTION_USER' doesn't exist — is Evection installed?" \ "Run scripts/install.sh first." >&2