From af83560e632183112455ea9b89d558a8b952ffb3 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 2 Dec 2015 11:26:03 +0100 Subject: Add support for alternative directorynames of 'persistence' and 'liveslak'. The persistence directory on USB is called 'persistence' by default but can now be re-defined when running 'make_slackware_live.sh' to create the ISO. Additionally it can be changed dynamically on boot of the Live OS by adding a 'persistence=' parameter to the boot. The Live OS main directory is called 'liveslak' by default but can now be re-defined when running 'make_slackware_live.sh' to create the ISO. Additionally it can be changed dynamically on boot of the Live OS by adding a 'livemain=' parameter to the boot. --- liveinit | 25 ++++++++++++++++--------- make_slackware_live.sh | 6 +++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/liveinit b/liveinit index e69ab87..53ac8f5 100755 --- a/liveinit +++ b/liveinit @@ -34,8 +34,9 @@ # The ISO creation script will create a filesystem with this label. # Nevertheless, the user may have copied the ISO content to a different device. -MEDIALABEL="@MEDIALABEL@" LIVEMAIN="@LIVEMAIN@" +MEDIALABEL="@MEDIALABEL@" +PERSISTENCE="@PERSISTENCE@" # By default, let the media determine if we can write persistent changes: VIRGIN=0 @@ -72,21 +73,27 @@ for ARG in $(cat /proc/cmdline); do kbd=*) KEYMAP=$(echo $ARG | cut -f2 -d=) ;; + livemain=*) + LIVEMAIN=$(echo $ARG | cut -f2 -d=) + ;; livepw=*) LIVEPW=$(echo $ARG | cut -f2 -d=) ;; load=*) LOAD=$(echo $ARG | cut -f2 -d=) ;; - noload=*) - NOLOAD=$(echo $ARG | cut -f2 -d=) - ;; locale=*) LOCALE=$(echo $ARG | cut -f2 -d=) ;; + noload=*) + NOLOAD=$(echo $ARG | cut -f2 -d=) + ;; nop) VIRGIN=1 ;; + persistence=*) + PERSISTENCE=$(echo $ARG | cut -f2 -d=) + ;; rescue) RESCUE=1 ;; @@ -272,7 +279,7 @@ if [ "$RESCUE" = "" ]; then # Get rid of the starting colon: RODIRS=$(echo $RODIRS |cut -c2-) - # Setup persistency in case our media is writable, *and* the user + # Setup persistence in case our media is writable, *and* the user # has created a directory "persistence" in the root of the media. # otherwise we let the block changes accumulate in RAM only. @@ -281,14 +288,14 @@ if [ "$RESCUE" = "" ]; then UPPERDIR=/mnt/live/changes OVLWORK=/mnt/live/.ovlwork if [ "$VIRGIN" = "0" ]; then - if [ "LIVEFS" != "iso9660" -a -d /mnt/media/persistence ]; then + if [ "LIVEFS" != "iso9660" -a -d /mnt/media/${PERSISTENCE} ]; then # Looks OK, but we need to remount the media in order to write to it: mount -o remount,rw /mnt/media # Try a write... just to be dead sure: - if touch /mnt/media/persistence/.rwtest 2>/dev/null && rm /mnt/media/persistence/.rwtest 2>/dev/null ; then + if touch /mnt/media/${PERSISTENCE}/.rwtest 2>/dev/null && rm /mnt/media/${PERSISTENCE}/.rwtest 2>/dev/null ; then # Writable media and we are allowed to write to it. - echo "${INITRD}: Writing persistent changes to media directory '/persistence'." - UPPERDIR=/mnt/media/persistence + echo "${INITRD}: Writing persistent changes to media directory '/${PERSISTENCE}'." + UPPERDIR=/mnt/media/${PERSISTENCE} OVLWORK=/mnt/media/.ovlwork fi fi diff --git a/make_slackware_live.sh b/make_slackware_live.sh index a29f9ad..9999035 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -91,6 +91,9 @@ LIVEMAIN=${LIVEMAIN:-"liveslak"} # The filesystem label we will be giving our ISO: MEDIALABEL=${MEDIALABEL:-"LIVESLAK"} +# The name of the directory used for storing persistence data: +PERSISTENCE=${PERSISTENCE:-"persistence"} + # Slackware version to use (note: this won't work for Slackware <= 14.1): SL_VERSION=${SL_VERSION:-"current"} @@ -1121,8 +1124,9 @@ KVER=$(ls ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |head -1 |rev | cut - echo "-- Creating initrd for kernel-generic $KVER ..." chroot ${LIVE_ROOTDIR} /sbin/mkinitrd -c -l us -o /boot/initrd_${KVER}.gz -k ${KVER} -m ${KMODS} 1>${DBGOUT} 2>${DBGOUT} cat $LIVE_TOOLDIR/liveinit | sed \ - -e "s/@MEDIALABEL@/$MEDIALABEL/g" \ -e "s/@LIVEMAIN@/$LIVEMAIN/g" \ + -e "s/@MEDIALABEL@/$MEDIALABEL/g" \ + -e "s/@PERSISTENCE@/$PERSISTENCE/g" \ -e "s/@DARKSTAR@/$LIVE_HOSTNAME/g" \ > ${LIVE_ROOTDIR}/boot/initrd-tree/init chroot ${LIVE_ROOTDIR} /sbin/mkinitrd 1>/dev/null 2>${DBGOUT} -- cgit v1.2.3-65-gdbad