]> code.delx.au - refind/blobdiff - debian/postinst
Add warning to refind-install when --alldrivers is used without
[refind] / debian / postinst
index 76df587a028eeac8f840e429c4d04164cd37ed4f..af7330876e687cd437255b4d86c55bf17ac55a2e 100755 (executable)
@@ -7,12 +7,16 @@ set -e
 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
 ExistingEntry=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
 if [[ -n $ExistingEntry ]] ; then
-   efibootmgr --bootnum $ExistingEntry --delete-bootnum
+   efibootmgr --bootnum $ExistingEntry --delete-bootnum &> /dev/null
 fi
 
 cd /usr/share/refind
 
-declare VarFile=`ls -d /sys/firmware/efi/vars/SecureBoot* 2> /dev/null`
+if [[ -f /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data ]] ; then
+   IsSecureBoot=`od -An -t u1 /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data | tr -d '[[:space:]]'`
+else
+   IsSecureBoot="0"
+fi
 # Note: Two find operations for ShimFile favors shim over PreLoader -- if both are
 # present, the script uses shim rather than PreLoader.
 declare ShimFile=`find /boot -name shim\.efi -o -name shimx64\.efi -o -name PreLoader\.efi 2> /dev/null | head -n 1`
@@ -31,12 +35,16 @@ declare OpenSSL=`which openssl 2> /dev/null`
 # enroll an extra MOK. I'm including it here because I'm NOT a
 # distribution maintainer, and I want to encourage users to use
 # their own local keys.
-if [[ -n $VarFile && -n $ShimFile ]] ; then
+if [[ $IsSecureBoot == "1" && -n $ShimFile ]] ; then
    if [[ -n $SBSign && -n $OpenSSL ]] ; then
-      ./install.sh --shim $ShimFile --localkeys --yes
+      ./refind-install --shim $ShimFile --localkeys --yes
    else
-      ./install.sh --shim $ShimFile --yes
+      ./refind-install --shim $ShimFile --yes
    fi
 else
-   ./install.sh --yes
+   if [[ -n $SBSign && -n $OpenSSL ]] ; then
+      ./refind-install --localkeys --yes
+   else
+      ./refind-install --yes
+   fi
 fi