preinst 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  | #!/bin/bash
set -e
# htdocs dir was moved to /var/lib/fex/htdocs after 20110610-1
if [ ! -d /var/lib/fex/htdocs -a -d /usr/share/fex/htdocs/ ]; then
    # yes, we're upgrading and not on the fresh install preinst run
    if dpkg --compare-versions "$2" le 20110610-1;then
        # copying as a backup
        mkdir -p /var/lib/fex/htdocs/
        cp -a /usr/share/fex/htdocs/* /var/lib/fex/htdocs/
        for file in /usr/share/fex/htdocs/download/*;do
            ln -sf "$file" /var/lib/fex/htdocs/download
        done
    fi
fi
if [ ! -z "$2" ];then
    # make sure we know which version we're upgrading from
    # in postinst we don't have that info anymore
    echo "Upgrade from $2 detected."
    # store away so we can put it into debconf at postinst time
    [ -d /usr/share/fex/ ]||mkdir -p /usr/share/fex/
    echo "$2" >/usr/share/fex/.lastver
fi
# 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:
 |