Release new version 0.99
[grml-debootstrap.git] / chroot-script
index a27dd58..e59b829 100755 (executable)
@@ -75,8 +75,8 @@ askpass() {
 
 # define chroot mirror {{{
 chrootmirror() {
-  if [ -n "$KEEP_SRC_LIST" ] ; then
-    echo "KEEP_SRC_LIST has been set, skipping chrootmirror stage."
+  if [ "$KEEP_SRC_LIST" = "yes" ] ; then
+    echo "KEEP_SRC_LIST has been enabled, skipping chrootmirror stage."
     return
   fi
 
@@ -129,8 +129,8 @@ chrootmirror() {
 
 # remove local chroot mirror {{{
 remove_chrootmirror() {
-  if [ -n "$KEEP_SRC_LIST" ] ; then
-    echo "KEEP_SRC_LIST has been set, skipping remove_chrootmirror stage."
+  if [ "$KEEP_SRC_LIST" = "yes" ] ; then
+    echo "KEEP_SRC_LIST has been enabled, skipping remove_chrootmirror stage."
     return
   fi
 
@@ -595,6 +595,13 @@ efi_setup() {
   echo "Mounting $EFI on /boot/efi"
   mount "$EFI" /boot/efi || return 1
 
+  # if efivarfs kernel module is loaded, but efivars isn't,
+  # then we need to mount efivarfs for efibootmgr usage
+  if ! ls /sys/firmware/efi/efivars/* &>/dev/null ; then
+    echo "Mounting efivarfs on /sys/firmware/efi/efivars"
+    mount -t efivarfs efivarfs /sys/firmware/efi/efivars
+  fi
+
   echo "Invoking efibootmgr"
   efibootmgr || return 1
 }
@@ -715,6 +722,8 @@ finalize() {
 
   [ -n "$POLICYRCD" ] && rm -f /usr/sbin/policy-rc.d
 
+  umount /sys/firmware/efi/efivars &>/dev/null || true
+
   umount /sys >/dev/null 2>/dev/null || true
   umount /proc >/dev/null 2>/dev/null || true
 }