From db70f3856f1245207c2521d90075575b675c10c4 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Tue, 3 Jan 2023 22:16:28 +0100 Subject: Make Ventoy detection compatible with Slackware 14.2 --- liveinit.tpl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/liveinit.tpl b/liveinit.tpl index 6d24184..32c7986 100644 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -823,8 +823,15 @@ if [ "$RESCUE" = "" ]; then # Detect Ventoy in memory (don't use the provided hooks), see # https://www.ventoy.net/en/doc_compatible_format.html: dd if=/dev/mem of=/vent.dmp bs=1 skip=$((0x80000)) count=$((0xA0000-0x80000)) 2>/dev/null + # Use 'strings' to find the decimal offset of the magic string; # With 'xargs' we remove leading and ending spaces: - OFFSET=$(strings -t d /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + if strings -t d /vent.dmp 1>/dev/null 2>/dev/null ; then + # Busybox in Slackware 15.0 or newer: + OFFSET=$(strings -t d /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + else + # Busybox in Slackware 14.2 or older: + OFFSET=$(strings -o /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + fi if [ -n "${OFFSET}" ]; then echo "${MARKER}: (BIOS) Ventoy ISO boot detected..." ISOBOOT="ventoy" -- cgit v1.2.3