summaryrefslogtreecommitdiffstats
path: root/liveinit.tpl
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2021-01-12 17:28:17 +0100
committer Eric Hameleers <alien@slackware.com>2021-01-12 17:28:17 +0100
commita28f988a5d95a3c29cdf615af6d5d5ec8b4fd92a (patch)
tree6fa3fc726aadd7d805f57d144115fb4175407601 /liveinit.tpl
parentca9704c956144f191de680a269df847721dc7a91 (diff)
downloadliveslak-a28f988a5d95a3c29cdf615af6d5d5ec8b4fd92a.tar.gz
liveslak-a28f988a5d95a3c29cdf615af6d5d5ec8b4fd92a.tar.xz
Implement a small Console OS - a rescue environment in RAM1.3.9
This uses two squashfs modules that are currently only found in the LEAN and XFCE images: 'min' and 'noxbase'. These two provide a functional console-only Slackware with a lot of useful programs. It will connect to a DHCP server automatically and it also contains the 'setup2hd' script to be able to install Slackware from a network mirror. And since the Console OS gets loaded into RAM, you can remove your USB stick after booting and use that stick for other purposes. Use-case: - You have one computer with a network connection and one USB stick, and want to create a persistent Slackware Live on USB. - Download an ISO supporting 'Console OS' to the computer's hard drive, and transfer the ISO to the USB stick using the computer's ISO imaging tools, making the stick bootable but not persistent. - Boot from the USB stick, select the "Console OS in RAM" option. - After you logged into the Console Slackware, mount the computer's hard drive. - Use the 'iso2usb.sh' script that comes with liveslak to extract the ISO content to the USB stick, making it persistent. See the README.txt for instructions. ----------------------------------------------------------------------------- Implemented as an extension of the liveslak 'toram' boot parameter. Adding 'toram=core' to the boot commandline will load circa 500 MB of squashfs modules into RAM and boot into a sparse but functional console environment. For supported Live variants (currently LEAN and XFCE) the script 'make_slackware_live.sh' will automatically add a menu item "Console OS in RAM" to the Syslinux and Grub bootloaders, using this 'toram=core' parameter. TODO: add this as an option to all liveslak variants. Not so trivial to do.
Diffstat (limited to 'liveinit.tpl')
-rw-r--r--liveinit.tpl84
1 files changed, 58 insertions, 26 deletions
diff --git a/liveinit.tpl b/liveinit.tpl
index ad9d279..79da5bb 100644
--- a/liveinit.tpl
+++ b/liveinit.tpl
@@ -44,6 +44,9 @@ DISTRO="@DISTRO@"
CDISTRO="@CDISTRO@"
VERSION="@VERSION@"
+CORE2RAMMODS="@CORE2RAMMODS@"
+CORE2RAM=0
+
LIVEUID="@LIVEUID@"
LIVEMEDIA=""
@@ -240,6 +243,8 @@ for ARG in $(cat /proc/cmdline); do
TORAM=1
if [ "$(echo $ARG | cut -f2 -d=)" = "os" ]; then
VIRGIN=0 # load OS modules into RAM, write persistent data to disk
+ elif [ "$(echo $ARG | cut -f2 -d=)" = "core" ]; then
+ CORE2RAM=1 # load Core OS modules into RAM
elif [ "$(echo $ARG | cut -f2 -d=)" = "all" ]; then
VIRGIN=1 # prevent writes to disk since we are supposed to run from RAM
fi
@@ -514,11 +519,24 @@ if [ "$RESCUE" = "" ]; then
find_mod() {
MY_LOC="$1"
-
- ( for MY_EXT in ${SQ_EXT_AVAIL} ; do
- echo "$(find ${MY_LOC} -name "*.${MY_EXT}" 2>/dev/null)"
- done
- ) | sort
+ MY_SUBSYS=$(basename "$1")
+ MY_SYSROOT=$(dirname "$1")
+ MY_COREMODS="$(echo boot ${CORE2RAMMODS} zzzconf |tr ' ' '|')"
+
+ # For all except core2ram, this is a simple find & sort, but for core2ram
+ # we have to search two locations (system and core2ram) and filter the
+ # results to return only the Core OS modules:
+ if [ "${MY_SUBSYS}" = "core2ram" ]; then
+ ( for MY_EXT in ${SQ_EXT_AVAIL} ; do
+ echo "$(find ${MY_SYSROOT}/core2ram/ ${MY_SYSROOT}/system/ -name "*.${MY_EXT}" 2>/dev/null |grep -Ew ${DISTRO}_"(${MY_COREMODS})")"
+ done
+ ) | sort
+ else
+ ( for MY_EXT in ${SQ_EXT_AVAIL} ; do
+ echo "$(find ${MY_LOC} -name "*.${MY_EXT}" 2>/dev/null)"
+ done
+ ) | sort
+ fi
}
find_modloc() {
@@ -540,7 +558,7 @@ if [ "$RESCUE" = "" ]; then
}
load_modules() {
- # SUBSYS can be 'system', 'addons', 'optional':
+ # SUBSYS can be 'system', 'addons', 'optional', 'core2ram':
SUBSYS="$1"
# Find all supported modules:
@@ -580,9 +598,18 @@ if [ "$RESCUE" = "" ]; then
else
echo "${MARKER}: Failed to mount $SUBSYS module '${MODBASE}', excluding it from the overlay."
echo "$MODBASE" >> /mnt/live/modules/failed
+ rmdir /mnt/live/modules/${MODBASE} 2>/dev/null
fi
fi
done
+
+ # Warn if Core OS modules were requested but none were found/mounted;
+ if [ "$SUBSYS" = "core2ram" ]; then
+ MY_COREMODS="$(echo ${CORE2RAMMODS} |tr ' ' '|')"
+ if [ -z "$(ls -1 /mnt/live/modules/ |grep -Ew ${DISTRO}_"(${MY_COREMODS})")" ] ; then
+ echo "${MARKER}: '$SUBSYS' modules were not found. Trouble ahead..."
+ fi
+ fi
}
# Function input is a series of device node names. Return all block devices:
@@ -833,26 +860,31 @@ if [ "$RESCUE" = "" ]; then
RODIRS=""
FS2HD=""
- # First, the base Slackware system components:
- load_modules system
-
- # Next, the add-on (3rd party etc) components, if any:
- # Remember, module name must adhere to convention: "NNNN-modname-*.sxz"
- # where 'N' is a digit and 'modname' must not contain a dash '-'.
- load_modules addons
-
- # And finally any explicitly requested optionals (like nvidia drivers):
- ## TODO:
- ## Automatically load the nvidia driver if we find a supported GPU:
- # NVPCIID=$(lspci -nn|grep NVIDIA|grep VGA|rev|cut -d'[' -f1|rev|cut -d']' -f1|tr -d ':'|tr [a-z] [A-Z])
- # if cat /mnt/media/${LIVEMAIN}/optional/nvidia-*xx.ids |grep -wq $NVPCIID ;
- # then
- # LOAD="nvidia,${LOAD}"
- # fi
- ## END TODO:
- # Remember, module name must adhere to convention: "NNNN-modname-*.sxz"
- # where 'N' is a digit and 'modname' must not contain a dash '-'.
- load_modules optional
+ if [ $CORE2RAM -eq 1 ]; then
+ # Only load the Core OS modules:
+ load_modules core2ram
+ else
+ # First, the base Slackware system components:
+ load_modules system
+
+ # Next, the add-on (3rd party etc) components, if any:
+ # Remember, module name must adhere to convention: "NNNN-modname-*.sxz"
+ # where 'N' is a digit and 'modname' must not contain a dash '-'.
+ load_modules addons
+
+ # And finally any explicitly requested optionals (like nvidia drivers):
+ ## TODO:
+ ## Automatically load the nvidia driver if we find a supported GPU:
+ # NVPCIID=$(lspci -nn|grep NVIDIA|grep VGA|rev|cut -d'[' -f1|rev|cut -d']' -f1|tr -d ':'|tr [a-z] [A-Z])
+ # if cat /mnt/media/${LIVEMAIN}/optional/nvidia-*xx.ids |grep -wq $NVPCIID ;
+ # then
+ # LOAD="nvidia,${LOAD}"
+ # fi
+ ## END TODO:
+ # Remember, module name must adhere to convention: "NNNN-modname-*.sxz"
+ # where 'N' is a digit and 'modname' must not contain a dash '-'.
+ load_modules optional
+ fi
# Get rid of the starting colon:
RODIRS=$(echo $RODIRS |cut -c2-)