]> git.pld-linux.org Git - packages/efi-boot-update.git/commitdiff
Do not fail on modules with strange names
authorJacek Konieczny <j.konieczny@eggsoft.pl>
Wed, 31 Oct 2012 12:24:02 +0000 (13:24 +0100)
committerJacek Konieczny <jajcus@jajcus.net>
Wed, 31 Oct 2012 12:24:02 +0000 (13:24 +0100)
efi-boot-update would fail on /etc/efi-boot/update.d/grub-installed.conf
because of the '-'

efi-boot-update

index 3acffd87db782d35d0ae2ded842b4799b236cdf7..930e93628fac224dac4d98729cd8ecbe8f1fff69 100755 (executable)
@@ -145,6 +145,10 @@ add_bootmgr_entry () {
     echo -n "$bootnum"
 }
 
+safe_string () {
+    echo -n "$*" | tr -c '[a-zA-Z0-9_]' '_'
+}
+
 FORCE_UPDATES="no"
 MOUNT_EFI_PARTITION="no"
 LABEL_PREFIX=""
@@ -257,7 +261,7 @@ for bootloader_conf in /etc/efi-boot/update.d/*.conf ; do
     install_files
     if [ -n "$BINARY" ] ; then
             bootnum="$(add_bootmgr_entry "$LABEL" "$BINARY" "$ARGS")"
-            eval "_${CONFIG_NAME}_bootnum=\"$bootnum\""
+            eval "_$(safe_string ${CONFIG_NAME})_bootnum=\"$bootnum\""
     fi
 done
 
@@ -266,9 +270,9 @@ if [ -n "$ORDER" -a "$EFIBOOTMGR" != "/bin/true" ] ; then
     tail="$($EFIBOOTMGR | awk '/^BootOrder:/ {gsub(/,/," ",$2); print $2}')"
     head=""
     for config_name in $ORDER ; do
-        eval "bootnum=\$_${config_name}_bootnum"
+        eval "bootnum=\$_$(safe_string ${config_name})_bootnum"
         if [ -z "$bootnum" ] ; then
-            msg "Cannot find '$config_name' config - won't add to boot order."
+            verbose "Cannot find '$config_name' config - won't add to boot order."
             continue
         fi
         tail="$(list_remove "$tail" "$bootnum")"
This page took 0.077639 seconds and 4 git commands to generate.