85319150e9a9c82de8485397d441d4b19a6a6bb2
[openafs.git] / src / packaging / Debian / openafs-fileserver.postinst
1 #!/bin/sh
2
3 set -e
4
5 case "$1" in
6 configure)
7     . /usr/share/debconf/confmodule
8     db_version 2.0
9
10     db_get openafs-fileserver/thiscell
11     echo $RET >/etc/openafs/server/ThisCell
12
13     if [ ! -f /etc/openafs/server/CellServDB ] ; then
14         sed -n "/^>$RET/,/^>/p" /etc/openafs/CellServDB | sed '$d' \
15             >/etc/openafs/server/CellServDB
16         if [ ! -s /etc/openafs/server/CellServDB ] ; then
17             echo ">$RET" >/etc/openafs/server/CellServDB
18         fi
19     fi
20
21     # Move the contents of the old /etc/openafs/server-local directory into
22     # /var/lib/openafs/local.  Most of the files in this directory are
23     # automatically generated, so it didn't belong in /etc.
24     #
25     # Change the paths to upserver and upclient in BosConfig from older
26     # versions that had the binaries in /usr/sbin.
27     if [ "x$2" != "x" ] && dpkg --compare-versions $2 lt 1.4.4.dfsg1-4 ; then
28         for f in sysid sysid.old NetInfo NetRestrict ; do
29             if [ -e "/etc/openafs/server-local/$f" ] ; then
30                 cp "/etc/openafs/server-local/$f" "/var/lib/openafs/local/$f"
31             fi
32         done
33         if [ -e /etc/openafs/BosConfig ] ; then
34             sed -i -e 's,/usr/sbin/upserver,/usr/lib/openafs/upserver,' \
35                    -e 's,/usr/sbin/upclient,/usr/lib/openafs/upclient,' \
36                        /etc/openafs/BosConfig
37         fi
38     fi
39     db_stop
40     ;;
41
42 abort-upgrade|abort-remove|abort-deconfigure)
43     ;;
44
45 *)
46     echo "postinst called with unknown argument \`$1'" >&2
47     exit 0
48     ;;
49 esac
50
51 # dh_installdeb will replace this with shell code automatically generated by
52 # other debhelper scripts.
53 #DEBHELPER#
54
55 exit 0