postinst is in gwsetup 6.08+git20160228+dfsg-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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #! /bin/sh
# postinst script for Gwsetup
#
set -e 
# These will be used here and there below
RCFILE=/etc/default/gwsetup
INITFILE=/etc/init.d/gwsetup
# We we'll need some variables defined there
# We first define some defaults values...just in case
USERS_GROUP=geneweb
GENEWEBUSER=geneweb
LOGFILE=/var/log/gwsetup.log
# Default settings
DEFAULTPORT=2316
DEFAULTRUNMODE="Always on"
# Reads config file (will override defaults above)
[ -r $RCFILE ] && . $RCFILE
. /usr/share/debconf/confmodule
db_version 2.0
write_rcfile() {
   cat >$RCFILE <<EOF
#
# Gwsetup Configuration Data
#
# This file may be changed manually, or by running "dpkg-reconfigure gwsetup"
# The port which the daemon listens to
PORT="${PORT}"
# The default language is not setup here. It will be Geneweb's default 
# language
# The run mode
# Two possible values: "Always on" or "Manual"
# You need to use quotes
RUN_MODE="${RUN_MODE}"
EOF
}
get_debconf() {
    db_get gwsetup/port
    PORT=$RET
    # If not present, use default
    if [ "$PORT" = "" ]
    then
	PORT=$DEFAULTPORT
    fi
    db_get gwsetup/run_mode
    RUN_MODE="$RET"
    # If not present, use default
    if [ "$RUN_MODE" = "" ]
    then
	RUN_MODE="$DEFAULTRUNMODE"
    fi
}
case "$1" in
    configure)
	# RCFILE has to be world-readable if we want the entry menu to work
	[ -f $RCFILE ] && chmod g+r,a+r $RCFILE
	[ -f $INITFILE ] && chmod a+rx $INITFILE
	# Make sure geneweb user exists
	if ! getent passwd ${GENEWEBUSER} >/dev/null
	then
	    echo "Adding $GENEWEBUSER user ... "
	    adduser --quiet --system --home /var/lib/geneweb --no-create-home --ingroup $USERS_GROUP $GENEWEBUSER
	fi
	
	# Permissions and groups changes come back
	# to the configure stage again.
	# Problems may remains if users previously messed up
	# the permissions...but more huge problems will
	# occur if this stage occurs _before_ the geneweb
	# group creation (was bug 171570 on 4.07-3 release)
	if [ ! -f $LOGFILE ]
	then
	    touch $LOGFILE
	fi
	# The log file is written by gwsetup running as the geneweb user
	# Make it readable/writable by this user only
	chown $GENEWEBUSER:$USERS_GROUP $LOGFILE
	chmod 600 $LOGFILE
	# Values are read from debconf
	# to update variables
	get_debconf
	# The settings file is written
	# Moved to postinst
	write_rcfile
	;;
    *)
	;;
esac
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
	if [ -x "/etc/init.d/gwsetup" ]; then
		update-rc.d gwsetup defaults >/dev/null
	fi
	if [ -x "/etc/init.d/gwsetup" ] || [ -e "/etc/init/gwsetup.conf" ]; then
		invoke-rc.d gwsetup start || exit $?
	fi
fi
# End automatically added section
 |