postinst script, nicer pathnames, and read password hash from a file
[invirt/packages/invirt-autoinstaller.git] / debian / sipb-xen-guest-installer.postinst
1 #!/bin/sh
2 # postinst script for sipb-xen-guest-installer
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7 set -x
8 #set -n
9
10 # summary of how this script can be called:
11 #        * <postinst> `configure' <most-recently-configured-version>
12 #        * <old-postinst> `abort-upgrade' <new version>
13 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
14 #          <new-version>
15 #        * <postinst> `abort-remove'
16 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
17 #          <failed-install-package> <version> `removing'
18 #          <conflicting-package> <version>
19 # for details, see http://www.debian.org/doc/debian-policy/ or
20 # the debian-policy package
21
22
23 case "$1" in
24     configure)
25         for d in /srv/guest-installer/*; do
26             # download the actual iso, unpack it, patch it.
27             wget -nc -i $d/iso.url -O $d/cdrom.orig.iso
28             MOUNTDIR=$(mktemp -d /mnt/sipb-xen-guest-installer.cdrom.XXXXXX)
29             mount -t iso9660 -o loop $d/cdrom.orig.iso $MOUNTDIR
30             rm -rf $d/cdrom.orig; cp -a $MOUNTDIR $d/cdrom.orig
31             umount $MOUNTDIR; rmdir $MOUNTDIR
32             rm -rf $d/cdrom; cp -a $d/cdrom.orig $d/cdrom
33             patch -d $d/cdrom -p1 <$d/cdrom.patch
34         done
35     ;;
36
37     abort-upgrade|abort-remove|abort-deconfigure)
38     ;;
39
40     *)
41         echo "postinst called with unknown argument \`$1'" >&2
42         exit 1
43     ;;
44 esac
45
46 # dh_installdeb will replace this with shell code automatically
47 # generated by other debhelper scripts.
48
49 #DEBHELPER#
50
51 exit 0
52
53