45 lines
1 KiB
Text
45 lines
1 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
SERVER_HOME=/var/lib/forgejo
|
||
|
SERVER_USER=git
|
||
|
SERVER_NAME="Git"
|
||
|
SERVER_GROUP=git
|
||
|
|
||
|
case "$1" in
|
||
|
install|upgrade)
|
||
|
|
||
|
# Create group if not existing
|
||
|
if ! getent group | grep -q "^$SERVER_GROUP:" ; then
|
||
|
echo -n "Adding group $SERVER_GROUP..."
|
||
|
addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
|
||
|
echo " done."
|
||
|
fi
|
||
|
|
||
|
# Create homedir if not existing
|
||
|
test -d $SERVER_HOME || mkdir $SERVER_HOME
|
||
|
|
||
|
# Create user if not existing
|
||
|
if ! getent passwd | grep -q "^$SERVER_USER:"; then
|
||
|
echo -n "Adding system user $SERVER_USER..."
|
||
|
adduser --quiet \
|
||
|
--system \
|
||
|
--ingroup $SERVER_GROUP \
|
||
|
--home $SERVER_HOME \
|
||
|
--no-create-home \
|
||
|
--disabled-password \
|
||
|
$SERVER_USER 2>/dev/null || true
|
||
|
echo " done."
|
||
|
fi
|
||
|
|
||
|
# Adjust file and directory permissions
|
||
|
if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
|
||
|
then
|
||
|
chown -R $SERVER_USER:adm $SERVER_HOME
|
||
|
chmod u=rwx,g=rxs,o= $SERVER_HOME
|
||
|
fi
|
||
|
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
#DEBHELPER#
|