diff options
-rw-r--r-- | README.txt | 16 | ||||
-rw-r--r-- | grub.tpl | 5 | ||||
-rw-r--r-- | liveinit.tpl | 84 | ||||
-rwxr-xr-x | make_slackware_live.sh | 77 | ||||
-rw-r--r-- | menu.tpl | 9 | ||||
-rw-r--r-- | upslak.sh | 8 |
6 files changed, 141 insertions, 58 deletions
@@ -395,6 +395,10 @@ toram => copy the OS from the media to to RAM before running it. toram=all => Prevent writes to disk since we are supposed to run from RAM; equivalent to parameter "toram". +toram=core => Load Console OS modules into RAM. Console-only Slackware + loads fast, contains 'setup2hd' and frees up your USB drive so you can + overwrite it with a Persistent Live OS. + toram=os => Load OS modules into RAM, but write persistent data to USB. === Troubleshooting === @@ -699,16 +703,17 @@ The script's parameters are: Use i586 for a 32bit ISO, x86_64 for 64bit. -c comp Squashfs compression (default: xz). Can be any of 'gzip lzma lzo xz zstd'. - -d desktoptype SLACKWARE (full Slack), KDE4 (basic KDE4), - XFCE (basic XFCE), KTOWN (ktown Plasma5 replacement), - MATE (Gnome2 fork replaces KDE4), CINNAMON (fork of Gnome3 - Shell replaces KDE4), DLACK (adds Gnome3, PAM and systemd). + -d desktoptype SLACKWARE (full Slack), LEAN (basic Plasma5/XFCE), + DAW (Digital Audio Workstation), XFCE (basic XFCE, + stripped), KTOWN (ktown Plasma5 replacement), MATE + (Gnome2 fork replaces KDE), CINNAMON (fork of Gnome3 Shell + replaces KDE), DLACK (Gnome3 replaces KDE). -e Use ISO boot-load-size of 32 for computers where the ISO won't boot otherwise (default: 4). -f Forced re-generation of all squashfs modules, custom configurations and new initrd.img. -l <localization> Enable a different default localization - (script-default is 'us'). + (script-default is 'en'). -m pkglst[,pkglst] Add modules defined by pkglists/<pkglst>,... -r series[,series] Refresh only one or a few package series. -s slackrepo_dir Directory containing Slackware repository. @@ -716,6 +721,7 @@ The script's parameters are: Trim the ISO (remove man and/or doc and/or bloat). -v Show debug/error output. -z version Define your Slackware version (default: current). + -C Add RAM-based Console OS to boot menu. -G Generate ISO file from existing directory tree -H hostname Hostname of the Live OS (default: darkstar). -M Add multilib (x86_64 only). @@ -67,3 +67,8 @@ menuentry "Help on boot parameters" --hotkey h { unset pager } +@C2RMH@menuentry "Console OS in RAM ($sl_lang)" --hotkey c { +@C2RMH@ linux ($root)/boot/generic @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=$sl_kbd tz=$sl_tz locale=$sl_locale xkb=$sl_xkb toram=core 3 +@C2RMH@ initrd ($root)/boot/initrd.img +@C2RMH@} + 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-) 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" \ @@ -12,7 +12,7 @@ f4 f4.txt #00000000 menu hshift 1 menu vshift 9 -menu width 45 +menu width 55 menu margin 1 menu rows 10 menu helpmsgrow 14 @@ -75,3 +75,10 @@ menu label Memory test with memtest86+ label localboot menu label Boot from local drive localboot -1 + +label core2ram + @C2RMH@menu hide + menu label Console OS in RAM + kernel /boot/generic + append initrd=/boot/initrd.img @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=@KBD@ locale=@LOCALE@ tz=@TZ@ toram=core 3 + @@ -81,6 +81,7 @@ LIVEUID="" MARKER="" MEDIALABEL="" PERSISTENCE="" +CORE2RAMMODS="" SQ_EXT_AVAIL="" VERSION="" @@ -359,7 +360,7 @@ collect_kmods() { else chroot ${IMGDIR} depmod $KVER 2>/dev/null fi -} +} # End of collect_kmods () # Read configuration data from old initrd: read_initrd() { @@ -371,7 +372,7 @@ read_initrd() { OLDWAIT=$(cat ./wait-for-root) # Read the values of liveslak template variables in the init script: - for TEMPLATEVAR in DEF_KBD DEF_LOCALE DEF_TZ DISTRO LIVE_HOSTNAME LIVEMAIN LIVEUID MARKER MEDIALABEL PERSISTENCE SQ_EXT_AVAIL VERSION ; do + for TEMPLATEVAR in DEF_KBD DEF_LOCALE DEF_TZ DISTRO LIVE_HOSTNAME LIVEMAIN LIVEUID MARKER MEDIALABEL PERSISTENCE CORE2RAMMODS SQ_EXT_AVAIL VERSION ; do eval $(grep "^ *${TEMPLATEVAR}=" ./init |head -1) done @@ -544,10 +545,13 @@ parse_template() { -e "s/@PERSISTENCE@/${PERSISTENCE:-persistence}/g" \ -e "s/@DARKSTAR@/${LIVE_HOSTNAME:-darkstar}/g" \ -e "s/@LIVEUID@/${LIVEUID:-live}/g" \ + -e "s/@LIVEUIDNR@/${LIVEUIDNR:-1000}/g" \ -e "s/@DISTRO@/$DISTRO/g" \ -e "s/@CDISTRO@/${DISTRO^}/g" \ -e "s/@UDISTRO@/${DISTRO^^}/g" \ + -e "s/@CORE2RAMMODS@/${CORE2RAMMODS:-"min noxbase"}/g" \ -e "s/@VERSION@/${VERSION}/g" \ + -e "s/@KVER@/$KVER/g" \ -e "s/@SQ_EXT_AVAIL@/${SQ_EXT_AVAIL}/g" \ -e "s,@DEF_KBD@,${DEF_KBD},g" \ -e "s,@DEF_LOCALE@,${DEF_LOCALE},g" \ |