aboutsummaryrefslogtreecommitdiffstats
path: root/make_slackware_live.sh
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 /make_slackware_live.sh
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 'make_slackware_live.sh')
-rwxr-xr-xmake_slackware_live.sh77
1 files changed, 53 insertions, 24 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 32832c5..2c0f1f1 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -35,7 +35,7 @@
# -----------------------------------------------------------------------------
# Version of the Live OS generator:
-VERSION="1.3.8.4"
+VERSION="1.3.9"
# Timestamp:
THEDATE=$(date +%Y%m%d)
@@ -161,6 +161,10 @@ ONLY_ISO="NO"
# The name of the directory used for storing persistence data:
PERSISTENCE=${PERSISTENCE:-"persistence"}
+# Add a Core OS to load into RAM (currently only supported for XFCE and LEAN):
+CORE2RAM=${CORE2RAM:-"NO"}
+CORE2RAMMODS="${MINLIST} noxbase"
+
# Slackware version to use (note: this won't work for Slackware <= 14.1):
SL_VERSION=${SL_VERSION:-"current"}
@@ -304,6 +308,7 @@ LIVE_BOOT=${LIVE_BOOT:-"${LIVE_STAGING}/${LIVEMAIN}/bootinst"}
LIVE_MOD_SYS=${LIVE_MOD_SYS:-"${LIVE_STAGING}/${LIVEMAIN}/system"}
LIVE_MOD_ADD=${LIVE_MOD_ADD:-"${LIVE_STAGING}/${LIVEMAIN}/addons"}
LIVE_MOD_OPT=${LIVE_MOD_OPT:-"${LIVE_STAGING}/${LIVEMAIN}/optional"}
+LIVE_MOD_COS=${LIVE_MOD_COS:-"${LIVE_STAGING}/${LIVEMAIN}/core2ram"}
# ---------------------------------------------------------------------------
# Define some functions.
@@ -323,6 +328,7 @@ function cleanup() {
rmdir ${LIVE_ROOTDIR} 2>${DBGOUT}
rmdir ${LIVE_WORK}/*_$$ 2>${DBGOUT}
+ rm ${LIVE_MOD_COS}/* 2>${DBGOUT} || true
rm ${LIVE_MOD_OPT}/* 2>${DBGOUT} || true
rm ${LIVE_MOD_ADD}/* 2>${DBGOUT} || true
} # End of cleanup()
@@ -668,6 +674,7 @@ function gen_bootmenu() {
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
-e "s/@KAPPEND@/$KAPPEND/g" \
+ -e "s/@C2RMH@/$C2RMH/g" \
> ${MENUROOTDIR}/vesamenu.cfg
for LANCOD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d: -f1)
@@ -712,6 +719,7 @@ EOL
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
-e "s/@KAPPEND@/$KAPPEND/g" \
+ -e "s/@C2RMH@/$C2RMH/g" \
> ${MENUROOTDIR}/menu_${LANCOD}.cfg
# Generate custom language selection submenu for selected keyboard:
@@ -771,6 +779,7 @@ function gen_uefimenu() {
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
-e "s/@KAPPEND@/$KAPPEND/g" \
+ -e "s/@C2RMH@/$C2RMH/g" \
> ${GRUBDIR}/grub.cfg
# Set a default keyboard selection:
@@ -1048,7 +1057,7 @@ EOT
# Action!
# ---------------------------------------------------------------------------
-while getopts "a:c:d:efhl:m:r:s:t:vz:GH:MO:R:X" Option
+while getopts "a:c:d:efhl:m:r:s:t:vz:CGH:MO:R:X" Option
do
case $Option in
h )
@@ -1085,6 +1094,7 @@ do
echo " Trim the ISO (remove man and/or doc and/or bloat)."
echo " -v Show debug/error output."
echo " -z version Define your ${DISTRO^} version (default: $SL_VERSION)."
+ echo " -C Add RAM-based Console OS to boot menu."
echo " -G Generate ISO file from existing directory tree"
echo " -H hostname Hostname of the Live OS (default: $LIVE_HOSTNAME)."
echo " -M Add multilib (x86_64 only)."
@@ -1117,6 +1127,8 @@ do
;;
z ) SL_VERSION="${OPTARG}"
;;
+ C ) CORE2RAM="YES"
+ ;;
G ) ONLY_ISO="YES"
;;
H ) LIVE_HOSTNAME="${OPTARG}"
@@ -1172,6 +1184,42 @@ if [ "$SL_ARCH" != "x86_64" -a "$MULTILIB" = "YES" ]; then
exit 1
fi
+# Determine which module sequence we have to build:
+case "$LIVEDE" in
+ SLACKWARE) MSEQ="${SEQ_SLACKWARE}" ;;
+ XFCE) MSEQ="${SEQ_XFCEBASE}" ;;
+ LEAN) MSEQ="${SEQ_LEAN}" ;;
+ DAW) MSEQ="${SEQ_DAW}" ;;
+ KTOWN) MSEQ="${SEQ_KTOWN}" ;;
+ MATE) MSEQ="${SEQ_MSB}" ;;
+ CINNAMON) MSEQ="${SEQ_CIN}" ;;
+ DLACK) MSEQ="${SEQ_DLACK}" ;;
+ STUDIOWARE) MSEQ="${SEQ_STUDW}" ;;
+ *) if [ -n "${SEQ_CUSTOM}" ]; then
+ # Custom distribution with a predefined package list:
+ MSEQ="${SEQ_CUSTOM}"
+ else
+ echo "** Unsupported configuration '$LIVEDE'"; exit 1
+ fi
+ ;;
+esac
+
+if [ "${CORE2RAM}" == "YES" ] || [ "${LIVEDE}" == "XFCE" ] || [ "${LIVEDE}" == "LEAN" ] ; then
+ # For now, allow CORE2RAM only for the variants that actually
+ # have the required modules in their system list.
+ # TODO: create these modules separately in the 'core2ram' subdirectory.
+ for MY_MOD in ${CORE2RAMMODS} ; do
+ if ! echo ${MSEQ} | grep -wq ${MY_MOD} ; then
+ echo ">> Modules required for Core RAM-based OS (${CORE2RAMMODS}) not available."
+ exit 1
+ fi
+ done
+ # Whether to hide the Core OS menu on boot yes or no:
+ C2RMH="#"
+else
+ C2RMH=""
+fi
+
if ! cat ${LIVE_TOOLDIR}/languages |grep -Ev '(^ *#|^$)' |grep -q ^${DEF_LANG}:
then
echo ">> Unsupported language '${DEF_LANG}', select a supported language:"
@@ -1296,7 +1344,7 @@ if [ "$FORCE" = "YES" ]; then
fi
# Create temporary directories for building the live filesystem:
-for LTEMP in $LIVE_OVLDIR $LIVE_BOOT $LIVE_MOD_SYS $LIVE_MOD_ADD $LIVE_MOD_OPT ; do
+for LTEMP in $LIVE_OVLDIR $LIVE_BOOT $LIVE_MOD_SYS $LIVE_MOD_ADD $LIVE_MOD_OPT $LIVE_MOD_COS ; do
umount ${LTEMP} 2>${DBGOUT} || true
mkdir -p ${LTEMP}
if [ $? -ne 0 ]; then
@@ -1329,26 +1377,6 @@ RODIRS="${LIVE_BOOT}"
# Create the verification file for the install_pkgs function:
echo "${THEDATE} (${BUILDER})" > ${LIVE_BOOT}/${MARKER}
-# Determine which module sequence we have to build:
-case "$LIVEDE" in
- SLACKWARE) MSEQ="${SEQ_SLACKWARE}" ;;
- XFCE) MSEQ="${SEQ_XFCEBASE}" ;;
- LEAN) MSEQ="${SEQ_LEAN}" ;;
- DAW) MSEQ="${SEQ_DAW}" ;;
- KTOWN) MSEQ="${SEQ_KTOWN}" ;;
- MATE) MSEQ="${SEQ_MSB}" ;;
- CINNAMON) MSEQ="${SEQ_CIN}" ;;
- DLACK) MSEQ="${SEQ_DLACK}" ;;
- STUDIOWARE) MSEQ="${SEQ_STUDW}" ;;
- *) if [ -n "${SEQ_CUSTOM}" ]; then
- # Custom distribution with a predefined package list:
- MSEQ="${SEQ_CUSTOM}"
- else
- echo "** Unsupported configuration '$LIVEDE'"; exit 1
- fi
- ;;
-esac
-
# Do we need to create/include additional module(s) defined by a pkglist:
if [ -n "$SEQ_ADDMOD" ]; then
echo "-- Adding ${SEQ_ADDMOD}."
@@ -2976,7 +3004,8 @@ cat $LIVE_TOOLDIR/liveinit.tpl | sed \
-e "s/@DISTRO@/$DISTRO/g" \
-e "s/@CDISTRO@/${DISTRO^}/g" \
-e "s/@UDISTRO@/${DISTRO^^}/g" \
- -e "s/@VERSION@/$VERSION/g" \
+ -e "s/@CORE2RAMMODS@/${CORE2RAMMODS}/g" \
+ -e "s/@VERSION@/${VERSION}/g" \
-e "s/@SQ_EXT_AVAIL@/${SQ_EXT_AVAIL}/g" \
-e "s,@DEF_KBD@,${DEF_KBD},g" \
-e "s,@DEF_LOCALE@,${DEF_LOCALE},g" \