34 lines
774 B
Bash
34 lines
774 B
Bash
#!/bin/sh
|
|
# doinst.sh - Post-installation script for gitea
|
|
|
|
# Create git group if it doesn't exist
|
|
if ! getent group git > /dev/null 2>&1; then
|
|
groupadd -r git
|
|
fi
|
|
|
|
# Create git user if it doesn't exist
|
|
if ! getent passwd git > /dev/null 2>&1; then
|
|
useradd -r -g git -d /var/lib/gitea -s /bin/bash -c "Gitea service" git
|
|
fi
|
|
|
|
# Set ownership on gitea directories
|
|
chown -R git:git /var/lib/gitea/
|
|
chmod -R 750 /var/lib/gitea/
|
|
chown root:git /etc/gitea
|
|
chmod 770 /etc/gitea
|
|
|
|
# Handle .new configuration files
|
|
config()
|
|
{
|
|
NEW="$1"
|
|
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
|
if [ ! -r "$OLD" ]; then
|
|
mv "$NEW" "$OLD"
|
|
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
|
rm "$NEW"
|
|
fi
|
|
}
|
|
|
|
config etc/gitea/app.ini.new
|
|
config etc/rc.d/rc.gitea.new
|