postinst is in fex 20130805-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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207  | #!/bin/sh
# postinst script for fex
#
# see: dh_installdeb(1)
set -e
. /usr/share/debconf/confmodule
# 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
case "$1" in
    configure)
    # lets give them a fex user/group in all cases.
    getent group fex >/dev/null 2>&1 || addgroup --system fex
    getent passwd fex >/dev/null 2>&1 || adduser --system --home /usr/share/fex --no-create-home \
        --disabled-password --ingroup fex fex
    if [ ! -d /var/lib/fex/htdocs ]; then
        echo "Installing initial copy of htdocs into /var/lib/fex/htdocs ..."
        mkdir -p /var/lib/fex/htdocs/FAQ/
        for ext in html txt ico gif jpg;do
            cp /usr/share/fex/htdocs/*.${ext} /var/lib/fex/htdocs/
        done
        for ext in html css gif faq;do
            cp /usr/share/fex/htdocs/FAQ/*.${ext} /var/lib/fex/htdocs/FAQ/
        done
        ln -sf /usr/share/javascript/jquery/jquery.js /var/lib/fex/htdocs/FAQ/jquery.js
        ln -s /usr/share/fex/htdocs/download /var/lib/fex/htdocs/
    else
        echo "/var/lib/fex/htdocs exists already, checking for default install"
	[ -d /var/lib/fex/htdocs/FAQ/ ]||mkdir /var/lib/fex/htdocs/FAQ/
        tmp=$(mktemp)
        vers=$(mktemp -d)
        (cd ${vers};tar xfz /usr/share/fex/.md5/htdocs.tgz)
        if [ -f /usr/share/fex/.lastver ];then
            lastinst=$(cat /usr/share/fex/.lastver)
            db_set fex/lastver "$lastinst"
            rm -f /usr/share/fex/.lastver
        else
            db_get fex/lastver
            lastinst=$RET
        fi
        lastinstnoepoch=$(echo $lastinst | cut -d':' -f 2)
        if [ -f ${vers}/${lastinst} ];then
            if (cd /var/lib/fex;md5sum -c --quiet "${vers}/${lastinst}" >/dev/null 2>&1);then
                # htdocs is identical
                echo "Updating $lastinst default htdocs to new default htdocs"
                for ext in html ico gif jpg;do
                    cp /usr/share/fex/htdocs/*.${ext} /var/lib/fex/htdocs/
                done
                for ext in html css gif faq;do
                    cp /usr/share/fex/htdocs/FAQ/*.${ext} /var/lib/fex/htdocs/FAQ/
                done
                rm -f "$tmp"
            fi
            if [ -L /var/lib/fex/htdocs/download ];then
                if [ "$(readlink /var/lib/fex/htdocs/download)" = "/usr/share/fex/htdocs/download" ];then
                    #echo "Download directory is up to date."
                    true
                else
                    echo "Download directory is pointing to non-default location."
                    echo "Please update client scripts yourself"
                fi
            else
                for file in /usr/share/fex/htdocs/download/*;do
                    ln -sf "$file" /var/lib/fex/htdocs/download
                done
            fi
            if [ -L /var/lib/fex/htdocs/FAQ/jquery.js ];then
                if [ "$(readlink /var/lib/fex/htdocs/FAQ/jquery.js)" = "/usr/share/javascript/jquery/jquery.js" ];then
                    #echo "jquery.js link is up to date."
                    true
                else
                    echo "jquery.js in htdocs/FAQ is pointing to non-default location."
                    echo "Please update jquery.js symlink yourself unless intended to not be system default"
                fi
            elif [ ! -f "/var/lib/fex/htdocs/FAQ/jquery.js" ];then
                ln -s /usr/share/javascript/jquery/jquery.js /var/lib/fex/htdocs/FAQ/jquery.js
            fi
        fi
        # tmp is created by mktemp and not cleaned up 
        # if we don't have ${vers}/${lastinst} - 
        # thus custom builds are always custom
        if [ -f "$tmp" ];then
            echo "Customizations in htdocs found. Not touching any files."
            echo "The new default pages are at /usr/share/fex/htdocs/."
            echo "Please check the diff yourself and update your htdocs dir if required."
            rm "$tmp"
        fi
	if [ -e /var/lib/fex/htdocs/FIX.jar ];then
		echo "F*IX is no longer supported. You should remove /var/lib/fex/htdocs/FIX.jar."
	fi
        rm -rf ${vers} 
    fi
    # make sure we don't have MYHOSTNAME.MYDOMAIN as $hostname in /etc/fex/fex.ph
    if [ ! -f /etc/fex/fex.ph ];then
        echo 'Initializing /etc/fex/fex.ph with correcting hostname (using: '$(hostname -f)')'
        zcat /usr/share/doc/fex/examples/fex.ph|sed -e 's/^\$hostname.*/\$hostname = '"'$(hostname -f)'"';/' >/var/lib/fex.ph
	# make sure we reset ucf here..
	    ucfr --purge fex /etc/fex/fex.ph
        mv /var/lib/fex.ph /etc/fex/fex.ph
	    ucfr fex /etc/fex/fex.ph
    elif egrep -q '^\$hostname.*=.*'"'MYHOSTNAME.MYDOMAIN'" /etc/fex/fex.ph 2>/dev/null;then
	    echo 'Unconfigured hostname found in /etc/fex/fex.ph! Please correct before using F*EX'
    fi
    # make sure we have correct permissions
    dpkg-statoverride --list /etc/fex/fex.ph >/dev/null || dpkg-statoverride --add fex fex 0640 /etc/fex/fex.ph
    dpkg-statoverride --list /etc/fex/fup.pl >/dev/null || dpkg-statoverride --add fex fex 0640 /etc/fex/fup.pl
    chown fex:fex /etc/fex/fex.ph /etc/fex/fup.pl
    chmod 0640 /etc/fex/fex.ph /etc/fex/fup.pl
    logdir=`sed -n '/\$logdir/s/^\$logdir\s*=\s*['"'"'"]\(.*\)['"'"'"].*/\1/p' /etc/fex/fex.ph|tail -n 1||true`
    if [ "$logdir" = "/var/log/fex" ];then
        for log in cleanup.log dop.log error.log fexsrv.log fop.log fup.log;do
            if [ -r /var/spool/fex/${log} ];then
                echo -n "Moving old log file ${log} to /var/log/fex"
                if [ ! -r /var/log/fex/${log} ];then
                    mv /var/spool/fex/${log} /var/log/fex/
                    chmod 0640 /var/log/fex/${log}
            echo '.'
                elif [ ! -r /var/log/fex/${log}.1 ];then 
                    # we already have a new logfile in /var/log/fex
                    mv /var/spool/fex/${log} /var/log/fex/${log}.1
                    chmod 0640 /var/log/fex/${log}*
            echo '.'
                else
            echo ': failed!'
                    echo "New logdir already populated."
                    echo "Please move /var/spool/fex/${log} yourself if required."
                fi
            else
                # Create new logfile with correct permissions
                touch /var/log/fex/${log}
                chmod 0640 /var/log/fex/${log}
            fi 
        done
    elif [ -z "$logdir" -o "${logdir}" = '$spooldir' ];then
    echo 'Logdir still pointing to $spooldir. Please update to /var/log/fex'
    echo 'in order to take full advantage of logrotate settings.'
    echo 'Once you have updated your configfiles just run:'
    echo '           dpkg-reconfigure fex'
    echo 'To have the logfiles moved into their new location'
    else
        echo "Custom logdir configured. Not moving logfile to /var/log/fex."
    fi
    chown -R fex:fex /usr/share/fex/
    chown -R fex:fex /var/lib/fex/
    chown -R fex:fex /var/log/fex/
    chown -R fex:fex /var/spool/fex/
    if [ -d /etc/xinetd.d ];then
        ucf --debconf-ok /usr/share/doc/fex/examples/xinetd_fex /etc/xinetd.d/fex
        remainingsrv=`grep -r /usr/share/fex/bin/fexsrv /etc/xinetd.d|grep -v '^/etc/xinetd.d/fex:'|sed -e 's#^/etc/xinetd.d/\([^:]\+\):.*#\1#'|grep -v 'fex.*-*'||true`
        if [ ! -z "$remainingsrv" ];then
            echo "User-defined services in xinetd not updated: ${remainingsrv}. Please update yourself!"
        fi
        if [ -x /etc/init.d/xinetd ]; then
            if [ -x /usr/sbin/invoke-rc.d ]; then
                invoke-rc.d xinetd reload || true
            else
                /etc/init.d/xinetd reload || true
            fi
        fi
    elif [ -r /etc/inetd.conf ];then
        # We're running openbsd-inetd or something similar
        fexsrv=`egrep '\s/usr/share/fex/bin/fexsrv' /etc/inetd.conf 2>/dev/null||true`
        if [ -x /usr/sbin/update-inetd -a -z "$fexsrv" ];then
            # as --multi is ugly we'll only support v4 through inetd.conf
            # whoever wants IPv6 needs to go xinetd or hack his own version
            # i.e. replace tcp with tcp6
            update-inetd --add '8888\tstream\ttcp\tnowait\tfex:fex\t/usr/sbin/tcpd\t/usr/share/fex/bin/fexsrv'
        elif [ -z "$fexsrv" ];then
            echo 'Unable to automatically update inetd.conf'
            echo 'Please update yourself and restart inetd'
        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.
exit 0
# vi: set smartindent ts=4 sw=4 expandtab autoindent:
 |