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() {
if [[ -d "$giteaDir" ]]; then
echo "Cleaning out old Gitea backups..."
rm -f "$giteaDir"/* || return 1
else
mkdir -p "$giteaDir" | return 1
GITEA_CONFIG=${GITEA_CONFIG:-/etc/gitea/app.ini}
if [[ ! -r "$GITEA_CONFIG" ]]; then
echo "ERROR: Cannot read gitea app.ini in $GITEA_CONFIG"
return 4
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
if [[ -n "$GITEA_BIN" ]]; then
@ -40,17 +47,13 @@ check() {
fi
fi
GITEA_CONFIG=${GITEA_CONFIG:-/etc/gitea/app.ini}
if [[ ! -r "$GITEA_CONFIG" ]]; then
echo "ERROR: Cannot read gitea app.ini in $GITEA_CONFIG"
return 4
fi
GITEA_USER=${GITEA_USER:-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
if [[ -d "$giteaDir" ]]; then
echo "Cleaning out old Gitea backups..."
rm -f "$giteaDir"/* || return 1
else
mkdir -p "$giteaDir" | return 1
chgrp "$GITEA_GROUP" "$giteaDir"
chmod g+wx "$giteaDir"
fi
}