diff --git a/usr/bin/archboot-x86_64-iso.sh b/usr/bin/archboot-x86_64-iso.sh index fb9ea3d5b..6244c4fee 100755 --- a/usr/bin/archboot-x86_64-iso.sh +++ b/usr/bin/archboot-x86_64-iso.sh @@ -50,7 +50,31 @@ if ! [[ ${UID} -eq 0 ]]; then exit 1 fi +# from initcpio functions +kver() { + # this is intentionally very loose. only ensure that we're + # dealing with some sort of string that starts with something + # resembling dotted decimal notation. remember that there's no + # requirement for CONFIG_LOCALVERSION to be set. + local kver re='^[[:digit:]]+(\.[[:digit:]]+)+' + + # scrape the version out of the kernel image. locate the offset + # to the version string by reading 2 bytes out of image at at + # address 0x20E. this leads us to a string of, at most, 128 bytes. + # read the first word from this string as the kernel version. + local offset=$(hexdump -s 526 -n 2 -e '"%0d"' "/boot/vmlinuz-linux") + [[ $offset = +([0-9]) ]] || return 1 + + read kver _ < \ + <(dd if="$1" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null) + + [[ $kver =~ $re ]] || return 1 + + printf '%s' "$kver" +} + # set defaults, if nothing given +[[ -z "${KERNEL}" ]] && KERNEL="$(kver)" [[ -z "${RELEASENAME}" ]] && RELEASENAME="$(date +%Y%m%d-%H%M)" [[ -z "${IMAGENAME}" ]] && IMAGENAME="archlinux-${RELEASENAME}-archboot-X86_64" diff --git a/usr/lib/initcpio/install/archboot_motd b/usr/lib/initcpio/install/archboot_motd index 7f5198979..b43f9bb1c 100644 --- a/usr/lib/initcpio/install/archboot_motd +++ b/usr/lib/initcpio/install/archboot_motd @@ -10,15 +10,15 @@ build () echo "Consoles:" >> ${MOTD} echo " - Virtual consoles 1-6 are active." >> ${MOTD} echo " - To change virtual console use ALT + F(1-6)" >> ${MOTD} -if [ "$(echo "${HOOKS[@]}" | grep arch_keymap)" ]; then +if [ "$(echo "${HOOKS[@]}" | grep archboot_keymap)" ]; then echo "Change keymap:" >> ${MOTD} echo " - To change to a non-US keymap, type 'km' at the console." >> ${MOTD} fi -if [ "$(echo "${HOOKS[@]}" | grep arch_tz)" ]; then +if [ "$(echo "${HOOKS[@]}" | grep archboot_tz)" ]; then echo "Change time and date:" >> ${MOTD} echo " - To change your time and date, type 'tz' at the console." >> ${MOTD} fi -if [ "$(echo "${HOOKS[@]}" | grep arch_installer)" ]; then +if [ "$(echo "${HOOKS[@]}" | grep archboot_installer)" ]; then echo "Normal Setup:" >> ${MOTD} echo " - On first login /arch/setup is launched automatically." >> ${MOTD} echo " - Please run '/arch/setup' again to install Arch Linux if you left setup." >> ${MOTD}