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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#!/bin/sh
set -e
debian_edu_config="/etc/debian-edu/config"
# Seed the debconf database with the answers for the common packages,
# in case some of these are installed before base-config is executed.
# This could fix problems with discover and locales.
print() {
# stdout is busy talking to debconf. Print to stderr
echo "$*" 1>&2
}
info() {
if [ "$debug" != "true" ] ; then
print "info: $*"
fi
}
error() {
msg="error: $0: $1"
print "$msg"
}
# Make sure we load the profile-specific answers the same way as during
# the first install.
if [ ! "$DEBIAN_HAS_FRONTEND" ]; then
# Override default values based on the profile in
# $debian_edu_config.
pkglibdir=/usr/lib/debian-edu-install
defaults=$pkglibdir/defaults
if test -r $debian_edu_config ; then
print "info: $0: Loading config from $debian_edu_config"
. $debian_edu_config
else
error "Unable to read from $debian_edu_config."
fi
load_defaults() {
filename="$defaults.$1"
if test -r $filename; then
print "info: Loading defaults from $filename"
if /usr/bin/debconf-set-selections $filename ; then
:
else
error "unable to load defaults from $filename"
fi
else
error "unable to read defaults from $filename"
fi
}
load_defaults common
info "Got profile '$PROFILE'"
for value in `echo $PROFILE |sed 's/ /-/g' | sed 's/,-/ /g'`; do
info "Testing profile '$value'"
case $value in
Workstation)
networked=true
workstation=true
;;
Thin-Client-Server|LTSP-server)
networked=true
workstation=true
ltspserver=true
;;
Main-Server|Server)
networked=true
server=true
;;
Standalone)
standalone=true
;;
Barebone)
networked=true
;;
*)
error "unknown profile '$profile'"
;;
esac
done
# Make sure the default values have priority
# 1 main-server
# 2 thin-client-server
# 3 workstation
# 4 networked (Common for non-standalone)
# 5 standalone
# 6 barebone
if test "$standalone" = true ; then
load_defaults standalone
fi
if test "$networked" = true ; then
load_defaults networked
fi
if test "$workstation" = true ; then
load_defaults workstation
fi
if test "$ltspserver" = true ; then
load_defaults thin-client-server
fi
if test "$server" = true ; then
load_defaults main-server
fi
fi
# Source the debconf confmodule to ensure that the templates are loaded.
. /usr/share/debconf/confmodule
oldversions="sarge \
terra_alpha \
terra_test01 terra_test02 terra_test03 terra_test04 \
terra_pre01 terra_pre02 \
terra_rc1 terra_rc2 terra_rc3 terra_rc4 terra_rc5"
# For the stable etch release, use '3.0r0 terra' as the version number
new_version="$(cat /usr/lib/debian-edu-install/version)"
if [ -f $debian_edu_config ] ; then
( # Subshell to avoid importing the variables into the entire script
VERSION=""
. $debian_edu_config
# Need to list versions with space here, to avoid unwanted
# word splitting
for i in $oldversions '3.0r0 terra' '3.0r1 terra'
do
if [ "$VERSION" = "$i" ] ; then
sed -i $debian_edu_config -e \
"s/^VERSION=.*$/VERSION=\"$new_version\"/"
fi
done
)
fi
# Insert firstboot script in the boot sequence if the package is
# preseeded to enable it. Use prefix 99x* to make sure it is the very
# last script in the boot sequence.
db_get debian-edu-install/run-firstboot
if [ true = "$RET" ] ; then
db_set debian-edu-install/run-firstboot false
ln -s /usr/lib/debian-edu-install/firstboot /etc/init.d/xdebian-edu-firstboot
update-rc.d xdebian-edu-firstboot start 99 2 3 4 5 . >/dev/null || exit $?
fi
db_stop
#DEBHELPER#
|