summaryrefslogtreecommitdiffstats
path: root/liveinit
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-03-09 14:00:30 +0100
committer Eric Hameleers <alien@slackware.com>2016-03-09 14:00:30 +0100
commita90330d1814e42c0b4f90e953dd26f75cae3a508 (patch)
tree370e5e03ff9d0d29fb7020d64dff2e35e35953f4 /liveinit
parent2ab1a58aa6eb4c3f8b86872f62419ae643e3ec65 (diff)
downloadliveslak-a90330d1814e42c0b4f90e953dd26f75cae3a508.tar.gz
liveslak-a90330d1814e42c0b4f90e953dd26f75cae3a508.tar.xz
Add preliminary support for booting a Live ISO image in your filesystem.
Boot parameter "livemedia=" has been expanded; Generic syntax for explicitly defining your live media: livemedia=/dev/sdX The syntax for pointing the initrd to an ISO image of Slackware Live Edition instead of a partition or DVD media expands on the above: livemedia=/dev/sdX:/path/to/slackwarelive.iso Note: this functionality is yet untested ;-)
Diffstat (limited to 'liveinit')
-rwxr-xr-xliveinit36
1 files changed, 28 insertions, 8 deletions
diff --git a/liveinit b/liveinit
index f043c7e..315ec52 100755
--- a/liveinit
+++ b/liveinit
@@ -110,7 +110,12 @@ for ARG in $(cat /proc/cmdline); do
LIVEMAIN=$(echo $ARG | cut -f2 -d=)
;;
livemedia=*)
- LIVEMEDIA=$(echo $ARG | cut -f2 -d=)
+ # generic syntax: livemedia=/dev/sdX
+ # ISO syntax: livemedia=/dev/sdX:/path/to/slackwarelive.iso
+ LM=$(echo $ARG | cut -f2 -d=)
+ LIVEMEDIA=$(echo $LM | cut -f1 -d:)
+ LIVEPATH=$(echo $LM | cut -f2 -d:)
+ unset LM
;;
livepw=*)
LIVEPW=$(echo $ARG | cut -f2 -d=)
@@ -375,16 +380,31 @@ if [ "$RESCUE" = "" ]; then
if [ ! -b "$LIVEMEDIA" ]; then
# Passed a UUID or LABEL?
LIVEALL=$(findfs UUID=$LIVEMEDIA 2>/dev/null) || LIVEALL=$(findfs LABEL=$LIVEMEDIA 2>/dev/null)
- if [ -z "$LIVEALL" ]; then
- echo "${MARKER}: Live media '$LIVEMEDIA' not found... trouble ahead."
- else
- LIVEMEDIA="$LIVEALL"
- fi
+ LIVEMEDIA="$LIVEALL"
else
LIVEALL="$LIVEMEDIA"
fi
- LIVEFS=$(blkid $LIVEMEDIA |rev |cut -d'"' -f2 |rev)
- mount -t $LIVEFS -o ro $LIVEMEDIA /mnt/media
+ if [ -z "$LIVEALL" ]; then
+ echo "${MARKER}: Live media '$LIVEMEDIA' not found... trouble ahead."
+ else
+ if [ -n "$LIVEPATH" -a "$LIVEPATH" != "$LIVEMEDIA" ]; then
+ # Boot option used: "livemedia=/dev/sdX:/path/to/live.iso",
+ # instead of just "livemedia=/dev/sdX".
+ # First mount the partition and then loopmount the ISO:
+ SUPERMNT=/mnt/super_$(od -An -N1 -tu1 /dev/urandom |tr -d ' ')
+ mkdir -p ${SUPERMNT}
+ SUPERFS=$(blkid $LIVEMEDIA |rev |cut -d'"' -f2 |rev)
+ mount -t $SUPERFS -o ro $LIVEMEDIA ${SUPERMNT}
+ if [ -f "${SUPERMNT}/$LIVEPATH" ]; then
+ LIVEFS=$(blkid "${SUPERMNT}/$LIVEPATH" |rev |cut -d'"' -f2 |rev)
+ LIVEALL="${SUPERMNT}/$LIVEPATH"
+ LIVEMEDIA="$LIVEALL"
+ MOUNTOPTS="loop"
+ fi
+ fi
+ LIVEFS=$(blkid $LIVEMEDIA |rev |cut -d'"' -f2 |rev)
+ mount -t $LIVEFS -o ${MOUNTOPTS:-ro} $LIVEMEDIA /mnt/media
+ fi
fi
# Finished determining the media availability, it should be mounted now.