From 2b26d474cf7d4a0db76c0954be14056fbb07817c Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sun, 31 Jul 2016 22:12:20 +0200 Subject: liveinit: allow modules to be organized in subdirectories. The addons/ and optional/ directory will be searched for *.sxz modules even if they live in subdirectories. This allows you to organize your modules instead of dumping them all into a single directory. If a module fails to load (because it is corrupted for instance) liveinit will mention this on screen and write the modulename to a file '/mnt/live/modules/failed'. --- liveinit | 48 +++++++++++++++++++++++++++++------------------- make_slackware_live.sh | 4 ++++ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/liveinit b/liveinit index 6b540aa..04d2b8c 100755 --- a/liveinit +++ b/liveinit @@ -40,6 +40,10 @@ LIVEMAIN="@LIVEMAIN@" MARKER="@MARKER@" PERSISTENCE="@PERSISTENCE@" +DISTRO="@DISTRO@" +CDISTRO="@CDISTRO@" +VERSION="@VERSION@" + LIVEUID="@LIVEUID@" LIVEMEDIA="" @@ -483,27 +487,33 @@ if [ "$RESCUE" = "" ]; then # SUBSYS can be 'system', 'addons', 'optional': SUBSYS="$1" - if ls /mnt/media/${LIVEMAIN}/${SUBSYS}/*.sxz 1>/dev/null 2>/dev/null ; then - for MODULE in /mnt/media/${LIVEMAIN}/${SUBSYS}/*.sxz ; do - MODBASE="$(basename ${MODULE} .sxz)" - if [ "$SUBSYS" = "optional" ]; then - # Load one or more optionals by using boot parameter 'load': - # load=mod1[,mod2[,mod3]] - if [ -z "$LOAD" -o -z "$(echo ",${LOAD}," |grep -i ",$(echo $MODBASE |cut -d- -f2),")" ]; then - continue - fi - elif [ "$SUBSYS" = "addons" ]; then - # Skip loading one or more addons by using boot parameter 'noload': - # noload=mod1[,mod2[,mod3]] - if [ -n "$NOLOAD" -a -n "$(echo ",${NOLOAD}," |grep -i ",$(echo $MODBASE |cut -d- -f2),")" ]; then - echo "$MODBASE" >> /mnt/live/modules/skipped - continue - fi + for MODULE in $(find /mnt/media/${LIVEMAIN}/${SUBSYS}/ -name "*.sxz" 2>/dev/null) ; do + MODBASE="$(basename ${MODULE} .sxz)" + if [ "$SUBSYS" = "optional" ]; then + # Load one or more optionals by using boot parameter 'load': + # load=mod1[,mod2[,mod3]] + if [ -z "$LOAD" -o -z "$(echo ",${LOAD}," |grep -i ",$(echo $MODBASE |cut -d- -f2),")" ]; then + continue fi - MODLOC=$(find_modloc ${MODULE} /mnt/media) + elif [ "$SUBSYS" = "addons" ]; then + # Skip loading one or more addons by using boot parameter 'noload': + # noload=mod1[,mod2[,mod3]] + if [ -n "$NOLOAD" -a -n "$(echo ",${NOLOAD}," |grep -i ",$(echo $MODBASE |cut -d- -f2),")" ]; then + echo "$MODBASE" >> /mnt/live/modules/skipped + continue + fi + fi + MODLOC=$(find_modloc ${MODULE} /mnt/media) + if [ -d /mnt/live/modules/${MODBASE} ]; then + echo "${MARKER}: duplicate $SUBSYS module '${MODBASE}', excluding it from the overlay." + echo "$MODBASE" >> /mnt/live/modules/dupes + else mkdir /mnt/live/modules/${MODBASE} mount -t squashfs -o loop ${MODLOC} /mnt/live/modules/${MODBASE} if [ $? -eq 0 ]; then + if echo ${MODBASE} | grep -q ^0000 -a ; then + echo "${MARKER}: ${CDISTRO} Live based on liveslak-${VERSION} #$(cat /mnt/live/modules/${MODBASE}/${MARKER})" + fi RODIRS=":/mnt/live/modules/${MODBASE}${RODIRS}" # 0099-* are the Live customizations, exclude those for setup2hd: if ! echo ${MODBASE} | grep -q ^0099 ; then @@ -513,8 +523,8 @@ if [ "$RESCUE" = "" ]; then echo "${MARKER}: Failed to mount $SUBSYS module '${MODBASE}', excluding it from the overlay." echo "$MODBASE" >> /mnt/live/modules/failed fi - done - fi + fi + done } ## End support functions ## diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 5920950..0e5e609 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -1704,6 +1704,10 @@ cat $LIVE_TOOLDIR/liveinit | sed \ -e "s/@PERSISTENCE@/$PERSISTENCE/g" \ -e "s/@DARKSTAR@/$LIVE_HOSTNAME/g" \ -e "s/@LIVEUID@/$LIVEUID/g" \ + -e "s/@DISTRO@/$DISTRO/g" \ + -e "s/@CDISTRO@/${DISTRO^}/g" \ + -e "s/@UDISTRO@/${DISTRO^^}/g" \ + -e "s/@VERSION@/$VERSION/g" \ > ${LIVE_ROOTDIR}/boot/initrd-tree/init cat /dev/null > ${LIVE_ROOTDIR}/boot/initrd-tree/luksdev # We do not add openobex to the initrd and don't want to see irrelevant errors: -- cgit v1.2.3