Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

383 Commits   1 Branch   1 Tag
Index: scripts/setup
===================================================================
--- scripts/setup	(revision 28)
+++ scripts/setup	(revision 29)
@@ -2332,12 +2332,60 @@
   fi
 }
 #
-# End of install packages:
+# End of install packages.
 #
 ####################################################################
 
 ####################################################################
 #
+# Set EFI boot entry:
+#
+set_efiboot_entry() {
+  local uefi=${1}
+  local loader="${2}"
+
+  local devlen=${#device}
+  local partlen=
+
+  let 'partlen = devlen + 1'
+  if [ "${#p}" -gt "0" ] ; then
+    let 'plen++'
+  fi
+
+  local uefi_device=
+  local uefi_partition=
+
+  modprobe efivarfs 1> /dev/null 2> /dev/null
+
+  if [ ! -d '/sys/firmware/efi/efivars' ] ; then return ; fi
+  if [ -z "${uefi}" -o -z "${loader}" ] ; then return ; fi
+
+  uefi_device=$(echo "${uefi}" | cut -b 1-${devlen})
+  uefi_partition=$(echo "${uefi}" | cut -b ${partlen}- | sed 's/[^0-9]*//g')
+
+  #
+  # Remove the previous boot entry if set:
+  #
+  efibootmgr -v | rev | cut -f2- | rev | grep Boot0 | grep "${DISTRO_CAPTION}" | while read line ; do
+    if ! $(echo ${line} | cut -f2- -d' ' | grep -q "${DISTRO_CAPTION}") ; then
+      continue
+    fi
+    efibootmgr -q -B -b $(echo ${line} | cut -b5-8)
+    sleep 1
+  done
+
+  #
+  # Set boot entry:
+  #
+  efibootmgr -q -c -d ${uefi_device} -p ${uefi_partition} -l "${loader}" -L "${DISTRO_CAPTION}-${DISTRO_FULL_VERSION}"
+}
+#
+# End of set EFI boot entry.
+#
+####################################################################
+
+####################################################################
+#
 # Install GRUB:
 #
 UEFI=
@@ -2447,6 +2495,8 @@
                         --config="${grub_load_cfg}" \
                         --output=${UEFI_MPOINT}/efi/boot/bootx64.efi \
                         ${grub_modules}  2>/dev/null 1>/dev/null
+
+  set_efiboot_entry "${UEFI}" "\\efi\\boot\\bootx64.efi"
 }
 
 install_intel_pc32_grub()