Update gitea checks and group permissions

This commit is contained in:
Eric Renfro 2024-01-09 20:44:14 -05:00
parent e78fa63e58
commit 57bac39365
Signed by: psi-jack
SSH key fingerprint: SHA256:1TKB8Z257L8EHK8GWNxKgMhD8a+FAR+f+j3nnlcuNVM

View file

@ -12,11 +12,18 @@ readConfig() {
} }
check() { check() {
if [[ -d "$giteaDir" ]]; then GITEA_CONFIG=${GITEA_CONFIG:-/etc/gitea/app.ini}
echo "Cleaning out old Gitea backups..." if [[ ! -r "$GITEA_CONFIG" ]]; then
rm -f "$giteaDir"/* || return 1 echo "ERROR: Cannot read gitea app.ini in $GITEA_CONFIG"
else return 4
mkdir -p "$giteaDir" | return 1 fi
GITEA_USER=${GITEA_USER:-git}
GITEA_GROUP=${GITEA_GROUP:-git}
GITEA_HOME=${GITEA_HOME:-$(getent passwd ${GITEA_USER} | cut -f6 -d:)}
if [[ ! -d "$GITEA_HOME" ]]; then
echo "ERROR: Cannot find Gitea home directory"
return 5
fi fi
if [[ -n "$GITEA_BIN" ]]; then if [[ -n "$GITEA_BIN" ]]; then
@ -40,17 +47,13 @@ check() {
fi fi
fi fi
GITEA_CONFIG=${GITEA_CONFIG:-/etc/gitea/app.ini} if [[ -d "$giteaDir" ]]; then
if [[ ! -r "$GITEA_CONFIG" ]]; then echo "Cleaning out old Gitea backups..."
echo "ERROR: Cannot read gitea app.ini in $GITEA_CONFIG" rm -f "$giteaDir"/* || return 1
return 4 else
fi mkdir -p "$giteaDir" | return 1
chgrp "$GITEA_GROUP" "$giteaDir"
GITEA_USER=${GITEA_USER:-git} chmod g+wx "$giteaDir"
GITEA_HOME=${GITEA_HOME:-$(getent passwd ${GITEA_USER} | cut -f6 -d:)}
if [[ ! -d "$GITEA_HOME" ]]; then
echo "ERROR: Cannot find Gitea home directory"
return 5
fi fi
} }