pagure/debian/pagure-webhook-server.postinst

58 lines
1.6 KiB
Bash

#!/bin/sh
# postinst script for pagure-webhook-server
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# Source debconf library.
if test -f /usr/share/debconf/confmodule ; then
. /usr/share/debconf/confmodule
fi
case "$1" in
configure)
# We run using the same user as gitolite. For more on the
# gituser value information, see the gitolite3 package.
db_get gitolite3/gituser
GITUSER="${RET:-gitolite3}"
if test "$GITUSER" != "git" ; then
# We must replace the user specified to run the scripts.
sed -i -e "s/U=\"git\"/U=\"$GITUSER\"/" /etc/init.d/pagure-webhook-server
if test -f /lib/systemd/system/pagure-webhook-server.service ; then
sed -i -e "s/User=git/User=$GITUSER/" \
-e "s/Group=git/Group=$GITUSER/" /lib/systemd/system/pagure-webhook-server.service
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0