Live Scan Grub Menu lsgm.rwx.work
at dev 54 lines 1.7 kB view raw
1function scan { 2 if [ "${1}" ] ; then 3 paths="${1}/*" 4 else 5 regexp --set default '(\(.*\))' "${cmdpath}" 6 paths='(*)' 7 fi 8 for path in ${paths} ; do 9 if [ "${1}" ] ; then 10 regexp --set tmp '.*/(.*)' "${path}" 11 else 12 if [ "${path}" == "${default}" ] ; then 13 tmp="${path}" 14 else 15 tmp=" ${path}" 16 fi 17 probe_set "${path}" 18 tmp="${tmp}${probe_entry}" 19 fi 20 if [ "${tmp}" != '*' ] ; then 21 if [ -d "${path}" ] ; then 22 menuentry "${tmp}" "${path}" --id "${path}" { 23 scan="${2}" 24 menu 25 } 26 else 27 menuentry "${tmp}" { 28 nop 29 } 30 fi 31 fi 32 if [ ! "${1}" ] ; then 33 if [ "${probe_fs}" == 'fat' ] ; then 34 if [ -f "${path}/efi/boot/bootx64.efi" ] ; then 35 menuentry ' efi/boot/bootx64.efi →' "${path}" { 36 chainloader "${2}/efi/boot/bootx64.efi" 37 } 38 fi 39 elif [ "${probe_fs}" ] ; then 40 if [ -d "${path}/boot/bash" ] ; then 41 for x in ${path}/boot/bash/* ; do 42 if [ -f "${x}/gui/filesystem.squashfs" ] ; then 43 regexp --set y '\(.*\)/(.*)' "${x}/gui" 44 menuentry " ${y}" { 45 nop 46 } 47 fi 48 done 49 fi 50 fi 51 probe_unset 52 fi 53 done 54}