File: fex.preinst

package info (click to toggle)
fex 20160919-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,944 kB
  • sloc: perl: 17,699; sh: 346; makefile: 67
file content (35 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download | duplicates (4)
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/sh

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.

#DEBHELPER#

exit 0

# vi: set smartindent ts=4 sw=4 expandtab autoindent sts=4: