postinst is in gitolite 2.3-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #!/bin/sh
# postinst script for gitolite
# Copyright 2010-2011 by Gerfried Fuchs <rhonda@debian.org>
# Licenced under WTFPLv2
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 http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# Source debconf library.
if [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
action=$1
version=$2
if [ "${DEBCONF_RECONFIGURE}" = "1" ]; then
# workaround until reconfigure is really available
action=reconfigure
fi
# only on new install or reconfigure
if [ "x$version" = "x" ] || [ "$action" = "reconfigure" ]; then
db_get gitolite/gituser
GITUSER="${RET:-gitolite}"
db_get gitolite/gitdir
GITDIR="${RET:-/var/lib/gitolite}"
db_get gitolite/adminkey
ADMINKEY="$RET"
# set it back to empty after use
db_set gitolite/adminkey ""
# all this makes only sense when we have been given an admin key
# to initialize with
if [ -n "$ADMINKEY" ]; then
if ! getent passwd "$GITUSER" >/dev/null; then
adduser --quiet --system --home "$GITDIR" --shell /bin/bash \
--no-create-home --gecos 'git repository hosting' \
--group "$GITUSER"
fi
if [ ! -r "$GITDIR/.gitolite.rc" ]; then
if [ ! -d "$GITDIR" ]; then
mkdir -p "$GITDIR"
chown "$GITUSER":"$GITUSER" "$GITDIR"
fi
# create admin repository
tmpdir="$(mktemp -d)"
if [ -r "$ADMINKEY" ]; then
# key file
cat "$ADMINKEY" > "$tmpdir/admin.pub"
else
# possibly pasted key
echo "$ADMINKEY" > "$tmpdir/admin.pub"
fi
chown -R "$GITUSER" "$tmpdir"
su -c "gl-setup -q '$tmpdir/admin.pub'" "$GITUSER"
rm -r "$tmpdir"
else
echo "gitolite seems to be already set up in $GITDIR, doing nothing." 1>&2
fi
else
echo "No adminkey given - not setting up gitolite." 1>&2
fi
fi
exit 0
|