Update gitea checks and group permissions
This commit is contained in:
parent
e78fa63e58
commit
57bac39365
1 changed files with 19 additions and 16 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue