pre_install() { if ! getent group gogs >/dev/null; then groupadd --system gogs fi if ! getent passwd gogs >/dev/null; then useradd -m --system -c 'gogs daemon users' -g gogs -s /bin/false gogs fi chsh gogs -s /usr/bin/bash } post_install(){ mkdir -p /var/log/gogs chown -R gogs:gogs /var/log/gogs chown -R gogs:gogs /srv/gogs systemctl daemon-reload } pre_upgrade(){ systemctl stop gogs.service pre_install $1 } post_upgrade() { post_install $1 systemctl start gogs.service } pre_remove() { systemctl stop gogs.service systemctl disable gogs.service } post_remove() { if getent passwd gogs >/dev/null; then userdel -r gogs fi if getent group gogs >/dev/null; then groupdel gogs fi }