postinst is in gitolite3 3.5.3.1-2.
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #!/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
# tighten permissions when initial instalation was pre-3.5.3.1.
if [ "$action" = "configure" ]; then
db_get gitolite3/gitdir
GITDIR="${RET:-/var/lib/gitolite3}"
repos="$GITDIR/repositories"
if [ -d "$repos" ]; then
# lack of recursion here is intentional; we don't know what the user may have
# set up underneath. We also leave the x permission to allow existing
# projects.list based gitweb installations to (hopefully) continue working.
chmod go-r "$repos"
for subdir in gitolite-admin.git testing.git; do
if [ -d $subdir ]; then
chmod -R og-rx "$repos/$subdir"
fi
done
fi
fi
# only on new install or reconfigure
if [ "x$version" = "x" ] || [ "$action" = "reconfigure" ]; then
db_get gitolite3/gituser
GITUSER="${RET:-gitolite3}"
db_get gitolite3/gitdir
GITDIR="${RET:-/var/lib/gitolite3}"
db_get gitolite3/adminkey
ADMINKEY="$RET"
# set it back to empty after use
db_set gitolite3/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 - $GITUSER -c "gitolite setup -pk '$tmpdir/admin.pub'"
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. Do a dpkg-reconfigure to setup." 1>&2
fi
fi
exit 0
|