prepare to upload
[debian/elilo] / debian / elilo.sh
index 17368e679592c2ba5f49616874157921df7b91ed..9857ff2729c7ba09b2c146506b2dd667d6e82bd0 100644 (file)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 ###############################################################################
 ##
@@ -38,6 +38,8 @@ TARGET=
 EFIROOT=/EFI/debian
 export LC_COLLATE=C
 
+ARCHITECTURE=$(dpkg --print-architecture)
+
 ## catch signals, clean up junk in /tmp.
 trap "cleanup" 0
 trap "cleanup; exit 129" HUP
@@ -213,7 +215,6 @@ checkconf()
     if [ -L "$boot" ] ; then
        oldboot=$boot
        boot=$(readlink -f $oldboot)
-       echo 1>&2 "$PRG: $oldboot is a symbolic link, using $boot instead"
     fi
     if [ ! -e "$boot" ] ; then
        echo 1>&2 "$PRG: $boot: No such file or directory"
@@ -283,6 +284,11 @@ checkconf()
        CONFERR=1
     fi
 
+    # efibootmgr needs efivars, make sure kernel module is loaded
+    if modprobe -q efivars ; then
+        echo "Loaded efivars kernel module to enable use of efibootmgr"
+    fi
+
     if [ ! -d /proc/efi/vars ] && [ ! -d /sys/firmware/efi/vars ] && [ "$efiboot" = 1 ] ; then
        echo 1>&2 "$PRG: no efi/vars under /proc or /sys/firmware, boot menu not updated"
        efiboot=0
@@ -357,6 +363,8 @@ copyfiles()
                sed 's/^image[[:space:]]*=[[:space:]]*//' | grep -v ':'`
     initrdfiles=`grep '^[[:space:]]*initrd[[:space:]]*=' $bootconf | \
                sed 's/.*=[[:space:]]*//' | grep -v ':'`
+    vmmfiles=`grep '^[[:space:]]*vmm[[:space:]]*=' $bootconf | \
+               sed 's/.*=[[:space:]]*//' | grep -v ':'`
 
     ## Point of no return, removing the old EFI/debian tree
     rm -rf $TARGET/$EFIROOT
@@ -391,6 +399,7 @@ recreated every time elilo runs.  Any local changes will be lost.\n\
        -e "s|\t| |g" \
        -e "s|\(^image[[:space:]]*=[[:space:]]*\)\([^:]*\)$|\1$EFIROOT\2|" \
        -e "s|\(^[[:space:]]*initrd[[:space:]]*=[[:space:]]*\)\([^:]*\)$|\1$EFIROOT\2|" \
+       -e "s|\(^[[:space:]]*vmm[[:space:]]*=[[:space:]]*\)\([^:]*\)$|\1$EFIROOT\2|" \
        < "$bootconf" > "$TARGET/$EFIROOT/$CFFILE"
     if [ $? != 0 ] ; then
        echo 1>&2 "$PRG: An error occured while writing to $boot"
@@ -399,7 +408,7 @@ recreated every time elilo runs.  Any local changes will be lost.\n\
 
     [ "$DEBUG" = 1 ] && echo "----" && cat "$TARGET/$EFIROOT/$CFFILE" && echo "----"
 
-    for i in $imagefiles $initrdfiles; do
+    for i in $imagefiles $initrdfiles $vmmfiles; do
        [ "$VERBOSE" = 1 ] && echo "$PRG: Installing $i on $boot..."
        if [ -f $i ]; then
            mkdir -p `dirname "$TARGET/$EFIROOT/$i"`
@@ -524,9 +533,8 @@ delay=$timeout
 default=$label
 " > "$TMPCONF" || return 1
 
-if [ -d /proc/sgi_sn ]
+if [ "$ARCHITECTURE" = "ia64" ]
 then
-  # aha!  This is an SGI Altix, and they need the relocatable option.
   echo "relocatable" >> "$TMPCONF" || return 1
 fi
 
@@ -569,7 +577,9 @@ chkspace()
                sed 's/^image[[:space:]]*=[[:space:]]*//' | grep -v ':'`
     initrdfiles=`grep '^[[:space:]]*initrd[[:space:]]*=' $bootconf | \
                sed 's/.*=[[:space:]]*//' | grep -v ':'`
-    bytesneeded=`cat $imagefiles $initrdfiles $install $bootconf 2>/dev/null | wc -c`
+    vmmfiles=`grep '^[[:space:]]*vmm[[:space:]]*=' $bootconf | \
+               sed 's/.*=[[:space:]]*//' | grep -v ':'`
+    bytesneeded=`cat $imagefiles $initrdfiles $vmmfiles $install $bootconf 2>/dev/null | wc -c`
     # convert to KB, allowing 5% overhead
     kbneeded=$(( bytesneeded / 1024 + bytesneeded / 20480 ))
     kbavailable=$(df -P -k $TARGET | sed -n "s|^$boot[[:space:]]\+[0-9]\+[[:space:]]\+[0-9]\+[[:space:]]\+\([0-9]\+\).*$|\1|p")