2 # Post-installation script (run on USER'S system after installing the
7 if [ -f /usr
/share
/debconf
/confmodule
] ; then
8 .
/usr
/share
/debconf
/confmodule
12 # Remove any existing NVRAM entry for rEFInd, to avoid creating a duplicate.
13 ExistingEntry
=`efibootmgr | grep "rEFInd Boot Manager" | cut -c 5-8`
14 if [[ -n $ExistingEntry ]] ; then
15 efibootmgr
--bootnum $ExistingEntry --delete-bootnum &> /dev
/null
20 if [[ -f /sys
/firmware
/efi
/vars
/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c
/data
]] ; then
21 IsSecureBoot
=`od -An -t u1 /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data | tr -d '[[:space:]]'`
25 # Note: Two find operations for ShimFile favors shim over PreLoader -- if both are
26 # present, the script uses shim rather than PreLoader.
27 declare ShimFile
=`find /boot -name shim\.efi -o -name shimx64\.efi -o -name PreLoader\.efi 2> /dev/null | head -n 1`
28 if [[ ! -n $ShimFile ]] ; then
29 declare ShimFile
=`find /boot -name PreLoader\.efi 2> /dev/null | head -n 1`
31 declare SBSign
=`which sbsign 2> /dev/null`
32 declare OpenSSL
=`which openssl 2> /dev/null`
34 # Run the rEFInd installation script. Do so with the --shim option
35 # if Secure Boot mode is suspected and if a shim program can be
36 # found, or without it if not. If a shim installation is attempted
37 # and the sbsign and openssl programs can be found, do the install
38 # using a local signing key. Note that this option is undesirable
39 # for a distribution, since it would then require the user to
40 # enroll an extra MOK. I'm including it here because I'm NOT a
41 # distribution maintainer, and I want to encourage users to use
42 # their own local keys.
43 if [[ $IsSecureBoot == "1" && -n $ShimFile ]] ; then
44 if [[ -n $SBSign && -n $OpenSSL ]] ; then
45 .
/refind-install
--shim $ShimFile --localkeys --yes > /dev
/null
47 .
/refind-install
--shim $ShimFile --yes > /dev
/null
50 .
/refind-install
--yes > /dev
/null
55 # Main part of script begins
60 db_get refind
/install_to_esp || true
;
61 if [ x
"$RET" = x
"true" ]; then
62 echo "Installing rEFInd to the ESP..."
65 echo "** Not installing rEFInd to the ESP! **"
66 echo "If you want rEFInd to control the boot process, you can do so by runing:"
68 echo "dpkg-reconfigure refind"
74 db_get refind
/install_to_esp || true
;
75 if [ x
"$RET" = x
"true" ]; then
76 echo "Installing rEFInd to the ESP..."
79 echo "If rEFInd was previously configured to be your primary boot manager, you must"
80 echo "use efibootmgr to set the computer to boot with something else."
84 abort-upgrade|abort-remove|abort-deconfigure
)
89 echo "postinst called with unknown argument \`$1'" >&2