| 1 |
#! /bin/sh
|
| 2 |
|
| 3 |
# $Id $
|
| 4 |
#*********************************************************************
|
| 5 |
# postinst -- setup fai
|
| 6 |
#
|
| 7 |
# This script is part of FAI (Fully Automatic Installation)
|
| 8 |
# Copyright (c) 2000-2005 by Thomas Lange, Universitaet zu Koeln
|
| 9 |
#*********************************************************************
|
| 10 |
#
|
| 11 |
# see: dh_installdeb(1)
|
| 12 |
|
| 13 |
set -e
|
| 14 |
|
| 15 |
|
| 16 |
# summary of how this script can be called:
|
| 17 |
# * <postinst> `configure' <most-recently-configured-version>
|
| 18 |
# * <old-postinst> `abort-upgrade' <new version>
|
| 19 |
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
| 20 |
# <new-version>
|
| 21 |
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
| 22 |
# <failed-install-package> <version> `removing'
|
| 23 |
# <conflicting-package> <version>
|
| 24 |
# for details, see /usr/share/doc/packaging-manual/
|
| 25 |
#
|
| 26 |
# quoting from the policy:
|
| 27 |
# Any necessary prompting should almost always be confined to the
|
| 28 |
# post-installation script, and should be protected with a conditional
|
| 29 |
# so that unnecessary prompting doesn't happen if a package's
|
| 30 |
# installation fails and the `postinst' is called with `abort-upgrade',
|
| 31 |
# `abort-remove' or `abort-deconfigure'.
|
| 32 |
|
| 33 |
|
| 34 |
case "$1" in
|
| 35 |
configure)
|
| 36 |
|
| 37 |
. /usr/share/debconf/confmodule
|
| 38 |
# set installserver hostname to a reasonable value with debconf
|
| 39 |
db_get fai/installserver
|
| 40 |
sed -i "s/^installserver=.*\$/installserver=$RET/" /etc/fai/fai.conf
|
| 41 |
|
| 42 |
# set mirrorhost in /etc/fai.conf and /etc/fai/sources.list as
|
| 43 |
# defined in debconf db
|
| 44 |
db_get fai/mirrorhost
|
| 45 |
grep MIRRORHOST /etc/fai/fai.conf > /dev/null
|
| 46 |
if [ $? -eq 0 ] ; then
|
| 47 |
sed -i "s/MIRRORHOST/$RET/" /etc/fai/fai.conf
|
| 48 |
else
|
| 49 |
sed -i "s/^mirrorhost=.*\$/mirrorhost=$RET/" /etc/fai/fai.conf
|
| 50 |
fi
|
| 51 |
sed -i "s/MIRRORHOST/$RET/" /etc/fai/sources.list
|
| 52 |
|
| 53 |
db_get fai/run-faisetup-on-install || true
|
| 54 |
if [ "$RET" = true ]; then
|
| 55 |
echo "The script fai-setup will be executed now, this procedure can take a while."
|
| 56 |
fai-setup || true
|
| 57 |
db_unregister fai/run-faisetup-on-install
|
| 58 |
else
|
| 59 |
echo "Now edit fai.conf, make-fai-nfsroot.conf and sources.list in /etc/fai and call fai-setup."
|
| 60 |
fi
|
| 61 |
|
| 62 |
|
| 63 |
;;
|
| 64 |
|
| 65 |
abort-upgrade|abort-remove|abort-deconfigure)
|
| 66 |
|
| 67 |
;;
|
| 68 |
|
| 69 |
*)
|
| 70 |
echo "postinst called with unknown argument \`$1'" >&2
|
| 71 |
exit 0
|
| 72 |
;;
|
| 73 |
esac
|
| 74 |
|
| 75 |
# dh_installdeb will replace this with shell code automatically
|
| 76 |
# generated by other debhelper scripts.
|
| 77 |
|
| 78 |
#DEBHELPER#
|
| 79 |
|
| 80 |
exit 0
|