Add memtest support.
[syslinux-debian/hramrach.git] / debian / local / syslinux-installer
blob45102ff430ddcd8732136b98e6d0f764323de095
1 #!/bin/sh -e
3 . /usr/share/debconf/confmodule
5 if [ "$1" ]; then
6 ROOT=$1
7 chroot=chroot
8 else
9 ROOT=
10 chroot=
13 newline="
16 db_capb backup
18 log() {
19 logger -t syslinux-installer "$@"
22 error() {
23 log "error: $@"
26 info() {
27 log "info: $@"
30 findfs () {
31 mount | grep "on $ROOT${1%/} " | tail -n1 | cut -d' ' -f1
34 EXTLINUX="extlinux"
36 ARCH="$(archdetect)"
37 info "architecture: $ARCH"
39 rootfs=$(findfs /)
40 bootfs=$(findfs /boot)
41 [ -n "$bootfs" ] || bootfs="$rootfs"
43 db_input critical syslinux-installer/bootdev || true
44 if ! db_go; then
45 if [ "$q" ]; then
46 state=1
47 else
48 # back up to menu
49 db_progress STOP
50 exit 10
52 else
53 db_get syslinux-installer/bootdev
54 bootdev=$RET
57 exit_code=0
58 apt-install $EXTLINUX || exit_code=$?
60 if [ $exit_code -ne 0 ] ; then
61 db_progress STOP
62 info "Calling 'apt-install $EXTLINUX' failed"
63 db_subst syslinux-installer/apt-install-failed EXTLINUX "$EXTLINUX"
64 db_input critical syslinux-installer/apt-install-failed || true
65 if ! db_go; then
66 exit 10 # back up to menu
68 exit 1
71 info "Installing extlinux on '$bootdev'"
73 info "Running in-target extlinux-install \"$bootdev\""
74 if log-output -t syslinux-installer in-target extlinux-install "$bootdev"; then
75 info "extlinux-install ran successfully"
76 else
77 error "Running 'extlinux-install \"$bootdev\"' failed."
78 db_subst syslinux-installer/extlinux-install-failed BOOTDEV "$bootdev"
79 db_input critical syslinux-installer/extlinux-install-failed || [ $? -eq 30 ]
80 db_go || true
81 exit 1
84 info "Running in-target extlinux-update"
85 if log-output -t syslinux-installer in-target extlinux-update; then
86 info "extlinux-update ran successfully"
87 db_go || true
88 exit 0
89 else
90 error "Running 'in-target extlinux-update' failed."
91 db_input critical syslinux-installer/extlinux-update-failed || [ $? -eq 30 ]
92 db_go || true
93 exit 1