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
|
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
log() {
logger -t colo-installer "$@"
}
error() {
log "error: $@"
}
info() {
log "info: $@"
}
findfs () {
mount | grep "on /target${1%/} " | cut -d' ' -f1
}
db_progress START 0 3 colo-installer/progress
# detect the partitions /target and /target/boot
rootfs_devfs=$(findfs /)
bootfs_devfs=$(findfs /boot)
[ "$bootfs_devfs" ] || bootfs_devfs="$rootfs_devfs"
rootfs=$(mapdevfs $rootfs_devfs)
bootfs=$(mapdevfs $bootfs_devfs)
bootfs_no_dev=${bootfs#/dev/}
db_progress INFO colo-installer/apt-install
if ! apt-install colo ; then
info "Calling 'apt-install colo' failed"
db_input critical colo-installer/apt-install-failed || [ $? -eq 30 ]
if ! db_go; then
exit 10 # back up to menu
fi
db_get colo-installer/apt-install-failed
if [ true != "$RET" ] ; then
exit 1
fi
fi
db_progress STEP 2
db_progress INFO colo-installer/conf
if [ -e /target/boot/vmlinux ]; then
kernel=/boot/vmlinux
else
if [ "$rootfs" = "$bootfs" ] ; then
kernel=/vmlinux
else
kernel=`find /target/boot -name 'vmlinu*cobalt*' | tail -1`
kernel=${kernel#/target}
fi
fi
# Is /boot on a separate partition?
if [ "$rootfs" != "$bootfs" ] ; then
kernel="${kernel#/boot}"
fi
info "Using kernel '$kernel'"
cat > /target/boot/default.colo <<EOF
#:CoLo:#
#
# load the Debian kernel from $bootfs_no_dev
#
mount $bootfs_no_dev
load $kernel
lcd "Booting Debian"
var cons_opts ''
-var cons_opts console=ttyS0,{console-speed}
execute root=$rootfs {cons_opts}
EOF
db_progress STEP 1
db_progress STOP
|