summaryrefslogtreecommitdiffstats
path: root/make_slackware_live.sh
diff options
context:
space:
mode:
Diffstat (limited to 'make_slackware_live.sh')
-rwxr-xr-xmake_slackware_live.sh1919
1 files changed, 1491 insertions, 428 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 4bd0559..e91f1a4 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-# Copyright 2014, 2015, 2016, 2017, 2018, 2019 Eric Hameleers, Eindhoven, NL
+# Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Eric Hameleers, Eindhoven, NL
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
@@ -35,7 +35,10 @@
# -----------------------------------------------------------------------------
# Version of the Live OS generator:
-VERSION="1.3.2.3"
+VERSION="1.8.1.1"
+
+# Timestamp:
+THEDATE=$(date +%Y%m%d)
# Directory where our live tools are stored:
LIVE_TOOLDIR=${LIVE_TOOLDIR:-"$(cd $(dirname $0); pwd)"}
@@ -64,50 +67,81 @@ BOOTLOADSIZE=${BOOTLOADSIZE:-4}
# Therefore we disable 32bit EFI by default. Enable at your own peril:
EFI32=${EFI32:-"NO"}
-# Set to YES if you want to use the SMP kernel on 32bit Slackware:
+# Set to '1' using the "-S" parameter to the script,
+# if the liveslak ISO should support SecureBoot-enabled computers:
+SECUREBOOT=0
+
+# Which shim to download and install?
+# Supported are 'debian' 'fedora' 'opensuse'.
+SHIM_3RDP=${SHIM_3RDP:-"fedora"}
+
+# When enabling SecureBoot support, we need a MOK certificate plus private key,
+# which we use to sign grub and kernel.
+# MOKCERT contains the location of the certificate,
+# to be defined through the '-S' parameter:
+MOKCERT=""
+# MOKPRIVKEY points to the location of the private key,
+# to be defined through the '-S' parameter:
+MOKPRIVKEY=""
+
+# Set to YES if you want to use a SMP-tagged kernel package
+# on 32bit Slackware 15.0 or earlier.
+# In 32bit Slackware > 15.0 all kernels support preemption and the '-smp'
+# tag has been removed.
SMP32=${SMP32:-"NO"}
# Include support for NFS root (PXE boot), will increase size of the initrd:
NFSROOTSUP=${NFSROOTSUP:-"YES"}
+# This variable can be set to a comma-separated list of package series.
+# The squashfs module(s) for these package series will then be re-generated.
+# Example commandline parameter: "-r l,kde,kdei"
+REFRESH=""
+
# Use xorriso instead of mkisofs/isohybrid to create the ISO:
USEXORR=${USEXORR:-"NO"}
-# Timestamp:
-THEDATE=$(date +%Y%m%d)
-
#
# ---------------------------------------------------------------------------
#
+# Distribution name:
+DISTRO=${DISTRO:-"slackware"}
+
+# What type of Live image?
+# Choices are: SLACKWARE, XFCE, LEAN, DAW, KTOWN, MATE, CINNAMON, DLACK, STUDIOWARE
+LIVEDE=${LIVEDE:-"SLACKWARE"}
+
# The live username of the image:
LIVEUID=${LIVEUID:-"live"}
+# The number of the live account in the image:
+LIVEUIDNR=${LIVEUIDNR:-"1000"}
+
+# The full name of the live account in the image can be set per Live variant,
+# and will always be overridden by a LIVEUIDFN definition in the .conf file.
+# The LIVEUIDFN defaults to '${DISTRO^} Live User' if not set explicitly:
+LIVEUIDFN_DAW="${DISTRO^} Live Musician"
+
# The root and live user passwords of the image:
ROOTPW=${ROOTPW:-"root"}
LIVEPW=${LIVEPW:-"live"}
-# Distribution name:
-DISTRO=${DISTRO:-"slackware"}
+# The nvidia persistence account:
+NVUID=${NVUID:-"nvidia"}
+NVUIDNR=${NVUIDNR:-"365"}
+NVGRP=${NVFRP:-"nvidia"}
+NVGRPNR=${NVUIDNR:-"365"}
# Custom name for the host:
LIVE_HOSTNAME=${LIVE_HOSTNAME:-"darkstar"}
-# What type of Live image?
-# Choices are: SLACKWARE, XFCE, KDE4, PLASMA5, MATE, CINNAMON, DLACK, STUDIOWARE
-LIVEDE=${LIVEDE:-"SLACKWARE"}
-
-# What runlevel to use if adding a DE like: XFCE, KDE4, PLASMA5 etc...
+# What runlevel to use if adding a DE like: XFCE, DAW, KTOWN etc...
RUNLEVEL=${RUNLEVEL:-4}
# Use the graphical syslinux menu (YES or NO)?
SYSMENU=${SYSMENU:-"YES"}
-# This variable can be set to a comma-separated list of package series.
-# The squashfs module(s) for these package series will then be re-generated.
-# Example commandline parameter: "-r l,kde,kdei"
-REFRESH=""
-
# The amount of seconds we want the init script to wait to give the kernel's
# USB subsystem time to settle. The default value of mkinitrd is "1" which
# is too short for use with USB sticks but "1" is fine for CDROM/DVD.
@@ -147,6 +181,11 @@ ONLY_ISO="NO"
# The name of the directory used for storing persistence data:
PERSISTENCE=${PERSISTENCE:-"persistence"}
+# Add a Core OS to load into RAM (value can be 'NO', 'YES' or 'NATIVE'):
+CORE2RAM=${CORE2RAM:-"NO"}
+# The MINLIST module must always be the first in CORE2RAMMODS:
+CORE2RAMMODS="${MINLIST} noxbase"
+
# Slackware version to use (note: this won't work for Slackware <= 14.1):
SL_VERSION=${SL_VERSION:-"current"}
@@ -164,29 +203,39 @@ SL_REPO_URL=${SL_REPO_URL:-"rsync.osuosl.org::slackware"}
DEF_SL_REPO_URL=${SL_REPO_URL}
# List of Slackware package series - each will become a squashfs module:
-SEQ_SLACKWARE="tagfile:a,ap,d,e,f,k,kde,kdei,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra"
+if [ "$(echo ${SL_VERSION}|cut -d. -f1)" == "14" ]; then
+ # Slackware up and until 14.2 has KDE4 which includes the 'kdei' package set:
+ SEQ_SLACKWARE="tagfile:a,ap,d,e,f,k,kde,kdei,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra"
+else
+ # Exclude Emacs to keep the ISO size below DVD size:
+ SEQ_SLACKWARE="tagfile:a,ap,d,f,k,kde,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra"
+fi
# Stripped-down Slackware with XFCE as the Desktop Environment:
# - each series will become a squashfs module:
-SEQ_XFCEBASE="${MINLIST},noxbase,x_base,xapbase,xfcebase"
+SEQ_XFCEBASE="pkglist:${MINLIST},noxbase,x_base,xapbase,xfcebase local:mcpp"
-# Stripped-down Slackware with KDE4 as the Desktop Environment:
-# - each series will become a squashfs module:
-SEQ_KDE4BASE="pkglist:${MINLIST},noxbase,x_base,xapbase,kde4base"
+# Stripped-down Base Slackware:
+SEQ_LEAN="pkglist:${MINLIST},noxbase,x_base,xapbase,xfcebase,slackpkgplus,z00_plasma5supp,z01_plasma5base,z01_swdev"
+
+# Stripped-down Slackware DAW with Plasma5 as the Desktop Environment:
+# - each series will become a squashfs module.
+# Note that loading the modules needs a specific order, which we force:
+SEQ_DAW="pkglist:${MINLIST},noxbase,x_base,xapbase,slackpkgplus,z00_plasma5supp,z01_plasma5base,z01_plasma5extra,z01_swdev,z02_alien4daw,z02_alienrest4daw,z03_daw"
-# List of Slackware package series with Plasma5 instead of KDE 4 (full install):
+# Slackware with 'ktown' Plasma5 instead of its own KDE (full install):
# - each will become a squashfs module:
-SEQ_PLASMA5="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:alien,alienrest,plasma5,slackextra,slackpkgplus"
+SEQ_KTOWN="tagfile:a,ap,d,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:ktownslack,ktown,ktownalien,slackextra,slackpkgplus"
-# List of Slackware package series with MSB instead of KDE 4 (full install):
+# List of Slackware package series with MSB instead of KDE (full install):
# - each will become a squashfs module:
SEQ_MSB="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:mate,slackextra,slackpkgplus"
-# List of Slackware package series with Cinnamon instead of KDE4 (full install):
+# List of Slackware package series with Cinnamon instead of KDE (full install):
# - each will become a squashfs module:
SEQ_CIN="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:cinnamon,slackextra,slackpkgplus"
-# Slackware package series with Gnome3/systemd instead of KDE4 (full install):
+# Slackware package series with Gnome3/systemd instead of KDE (full install):
# - each will become a squashfs module:
SEQ_DLACK="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap pkglist:dlackware,slackextra,systemd"
@@ -194,33 +243,46 @@ SEQ_DLACK="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap pkglist:dlackware,slackextra,sys
# - each will become a squashfs module:
SEQ_STUDW="tagfile:a,ap,d,e,f,k,kde,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra,slackpkgplus,studioware"
+# Package blacklists for variants:
+#BLACKLIST_DAW="seamonkey"
+#BLACKLIST_LEAN="seamonkey"
+BLACKLIST_SLACKWARE="calligra calligraplan gcc-gdc gcc-gfortran gcc-gnat gcc-objc krita kstars seamonkey"
+#BLACKLIST_XFCE="gst-plugins-bad-free lynx mc motif mozilla-firefox pidgin xlockmore"
+
+# Potentially we will use package(s) from 'testing' instead of regular repo:
+#TESTINGLIST_DAW="kernel-generic kernel-modules kernel-headers kernel-source"
+TESTINGLIST_DAW=""
+
# -- START: Used verbatim in upslak.sh -- #
# List of kernel modules required for a live medium to boot properly;
-# Lots of HID modules added to support keyboard input for LUKS password entry:
-KMODS=${KMODS:-"squashfs:overlay:loop:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:mmc-core:mmc-block:sdhci:sdhci-pci:sdhci-acpi:usb-storage:hid:usbhid:i2c-hid:hid-generic:hid-apple:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd:mbcache:ext3:ext4:isofs:fat:nls_cp437:nls_iso8859-1:msdos:vfat:ntfs"}
+# Lots of HID modules added to support keyboard input for LUKS password entry;
+# Virtio modules added to experiment with liveslak in a VM.
+KMODS=${KMODS:-"squashfs:overlay:loop:efivarfs:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:mmc-core:mmc-block:sdhci:sdhci-pci:sdhci-acpi:rtsx_pci:rtsx_pci_sdmmc:usb-storage:uas:hid:usbhid:i2c-hid:hid-generic:hid-apple:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd:mbcache:ext3:ext4:zstd_compress:lz4hc_compress:lz4_compress:btrfs:f2fs:jfs:xfs:isofs:fat:nls_cp437:nls_iso8859-1:msdos:vfat:exfat:ntfs:virtio_ring:virtio:virtio_blk:virtio_balloon:virtio_pci:virtio_pci_modern_dev:virtio_net"}
# Network kernel modules to include for NFS root support:
-NETMODS="kernel/drivers/net"
+NETMODS="kernel/drivers/net kernel/drivers/virtio"
# Network kernel modules to exclude from above list:
NETEXCL="appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko"
# -- END: Used verbatim in upslak.sh -- #
# Firmware for wired network cards required for NFS root support:
-NETFIRMWARE="3com acenic adaptec bnx tigon e100 sun kaweth tr_smctr cxgb3"
+NETFIRMWARE="3com acenic adaptec bnx tigon e100 sun kaweth tr_smctr cxgb3 rtl_nic"
# If any Live variant needs additional 'append' parameters, define them here,
# either using a variable name 'KAPPEND_<LIVEDE>', or by defining 'KAPPEND' in the .conf file:
KAPPEND_SLACKWARE=""
-KAPPEND_PLASMA5="threadirqs"
-KAPPEND_STUDIOWARE="threadirqs"
+KAPPEND_KTOWN="threadirqs loglevel=3 audit=0"
+KAPPEND_DAW="threadirqs preempt=full loglevel=3 audit=0"
+KAPPEND_LEAN="threadirqs preempt=full loglevel=3 audit=0"
+KAPPEND_STUDIOWARE="threadirqs preempt=full loglevel=3 audit=0"
# Add CACert root certificates yes/no?
-ADD_CACERT=${ADD_CACERT:-"YES"}
+ADD_CACERT=${ADD_CACERT:-"NO"}
-# Default language selection for the Live OS; this can be changed with the
-# coomandline switch "-l":
-DEF_LANG="us"
+# Default language selection for the Live OS; 'en' means generic English.
+# This can be changed with the commandline switch "-l":
+DEF_LANG="en"
#
# ---------------------------------------------------------------------------
@@ -249,7 +311,7 @@ SQ_COMP_PARAMS_OPT[gzip]=""
SQ_COMP_PARAMS_OPT[lzma]=""
SQ_COMP_PARAMS_OPT[lzo]=""
SQ_COMP_PARAMS_OPT[xz]="-b 1M"
-SQ_COMP_PARAMS_OPT[zstd]="-b 1M -Xcompression-level 19"
+SQ_COMP_PARAMS_OPT[zstd]="-b 1M -Xcompression-level 22"
# What compression to use for the squashfs modules?
# Default is xz, alternatives are gzip, lzma, lzo, zstd:
@@ -282,57 +344,64 @@ 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.
# ---------------------------------------------------------------------------
# Clean up in case of failure:
-cleanup() {
+function cleanup() {
# Clean up by unmounting our loopmounts, deleting tempfiles:
echo "--- Cleaning up the staging area..."
sync
umount ${LIVE_ROOTDIR}/sys 2>${DBGOUT} || true
umount ${LIVE_ROOTDIR}/proc 2>${DBGOUT} || true
umount ${LIVE_ROOTDIR}/dev 2>${DBGOUT} || true
- umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+ umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
# Need to umount the squashfs modules too:
- umount ${LIVE_WORK}/*_$$ 2>${DBGOUT} || true
+ umount -R ${LIVE_WORK}/*_$$ 2>${DBGOUT} || true
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()
+
trap 'echo "*** $0 FAILED at line $LINENO ***"; cleanup; exit 1' ERR INT TERM
# Uncompress the initrd based on the compression algorithm used:
-uncompressfs () {
+function uncompressfs() {
if $(file "${1}" | grep -qi ": gzip"); then
gzip -cd "${1}"
elif $(file "${1}" | grep -qi ": XZ"); then
xz -cd "${1}"
fi
-}
+} # End of uncompressfs()
#
# Return the full pathname of first package found below $2 matching exactly $1:
#
-full_pkgname() {
+function full_pkgname() {
PACK=$1
- TOPDIR=$2
- # Perhaps I will use this more readable code in future:
- #for FL in $(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null) ; do
- # # Weed out package names starting with "$PACK"; we want exactly "$PACK":
- # if [ "$(echo $FL |rev |cut -d- -f4- |cut -d/ -f1 |rev)" != "$PACK" ]; then
- # continue
- # else
- # break
- # fi
- #done
- #echo "$FL"
- echo "$(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null |grep -E "\<${PACK//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1)"
-}
+ if [ -e $2 ]; then
+ TOPDIR=$2
+ # Perhaps I will use this more readable code in future:
+ #for FL in $(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null) ; do
+ # # Weed out package names starting with "$PACK"; we want exactly "$PACK":
+ # if [ "$(echo $FL |rev|cut -d- -f4-|cut -d/ -f1|rev)" != "$PACK" ]; then
+ # continue
+ # else
+ # break
+ # fi
+ #done
+ #echo "$FL"
+ echo "$(find ${TOPDIR}/ -name "${PACK}-*.t?z" 2>/dev/null |grep -E "\<${PACK//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1)"
+ else
+ echo ""
+ fi
+} # End of full_pkgname()
#
# Find packages and install them into the temporary root:
@@ -362,8 +431,8 @@ function install_pkgs() {
if [ "$3" = "local" -a -d ${LIVE_TOOLDIR}/local${DIRSUFFIX}/$1 ]; then
echo "-- Installing local packages from subdir 'local${DIRSUFFIX}/$1'."
- #installpkg --terse --root "$2" "local${DIRSUFFIX}/$1/*.t?z"
- ROOT="$2" upgradepkg --install-new --reinstall "local${DIRSUFFIX}/$1/*.t?z"
+ #installpkg --terse --root "$2" "${LIVE_TOOLDIR}/local${DIRSUFFIX}/$1/*.t?z"
+ ROOT="$2" upgradepkg --install-new --reinstall "${LIVE_TOOLDIR}"/local${DIRSUFFIX}/"$1"/*.t?z
else
# Load package list and (optional) custom repo info:
if [ "$3" = "tagfile" ]; then
@@ -379,13 +448,15 @@ function install_pkgs() {
fi
if [ "${SL_REPO}" = "${DEF_SL_REPO}" ]; then
- # We need only one release from the Slackware package mirror;
+ # SL_REPO was not re-defined in ${PKGCONF},
+ # so we are dealing with an actual Slackware repository rootdir.
+ # We select only the requested release in the Slackware package mirror;
# This must *not* end with a '/' :
SELECTION="${DISTRO}${DIRSUFFIX}-${SL_VERSION}"
else
SELECTION=""
fi
- if [ ! -d ${SL_REPO} -o -z "$(find ${SL_PKGROOT} -type f 2>/dev/null)" ]; then
+ if [ ! -d ${SL_REPO} -o -z "$(find ${SL_PKGROOT}/ -type f 2>/dev/null)" ]; then
# Oops... empty local repository. Let's see if we can rsync from remote:
echo "** Slackware package repository root '${SL_REPO}' does not exist or is empty!"
RRES=1
@@ -421,21 +492,62 @@ function install_pkgs() {
# REP equal to PKG.
# - If PKG is empty then this is a request to remove the package.
REP=$(echo $PKGPAT |cut -d% -f1)
+ if [ "$CORE2RAM" != "NO" ] && [ -z "$(echo $CORE2RAMMODS |grep -w $(basename $PKGFILE .lst))" ]; then
+ # If we are adding core2ram modules,
+ # prevent re-installing their packages in another module:
+ PKGC2R="$(for MYLST in ${CORE2RAMMODS}; do grep "^${PKG}$" ${LIVE_TOOLDIR}/pkglists/${MYLST}.lst ; done)"
+ unset MYLST
+ if [ -n "${PKGC2R}" ]; then
+ # Found a package that is listed as a core2ram module:
+ continue
+ fi
+ fi
+ # Skip installation on detecting a blacklisted package:
+ for BLST in ${BLACKLIST} BLNONE; do
+ if [ "$PKG" == "$BLST" ]; then
+ # Found a blacklisted package.
+ break
+ fi
+ done
+ # Sometimes we want to use a package in 'testing' instead:
+ for PTST in ${TESTINGLIST} TSTNONE; do
+ if [ "$PKG" == "$PTST" ]; then
+ # Found a package to install from 'testing'.
+ break
+ fi
+ done
+ # Install a SMP kernel/modules if requested:
+ if [ "${PKG}" = "kernel-generic" ] && [ "$SL_ARCH" != "x86_64" -a "$SMP32" = "YES" ]; then
+ PKG="kernel-generic-smp"
+ elif [ "${PKG}" = "kernel-modules" ] && [ "$SL_ARCH" != "x86_64" -a "$SMP32" = "YES" ]; then
+ PKG="kernel-modules-smp"
+ fi
+ # Now decide what to do:
if [ -z "${PKG}" ]; then
# Package removal:
ROOT="$2" removepkg "${REP}"
+ elif [ "${PKG}" == "${BLST}" ]; then
+ echo "-- Not installing blacklisted package '$PKG'."
else
+ if [ "${PKG}" == "${PTST}" ]; then
+ echo "-- Installing package '$PKG' from 'testing'."
+ FULLPKG=$(full_pkgname ${PKG} $(dirname ${SL_PKGROOT})/testing)
+ else
+ FULLPKG=""
+ fi
# Package install/upgrade:
# Look in ./patches ; then ./${DISTRO}$DIRSUFFIX ; then ./extra
# Need to escape any '+' in package names such a 'gtk+2'.
- if [ ! -z "${SL_PATCHROOT}" ]; then
- FULLPKG=$(full_pkgname ${PKG} ${SL_PATCHROOT})
- else
- FULLPKG=""
+ if [ "x${FULLPKG}" = "x" ]; then
+ if [ ! -z "${SL_PATCHROOT}" ]; then
+ FULLPKG=$(full_pkgname ${PKG} ${SL_PATCHROOT})
+ else
+ FULLPKG=""
+ fi
fi
if [ "x${FULLPKG}" = "x" ]; then
FULLPKG=$(full_pkgname ${PKG} ${SL_PKGROOT})
- else
+ elif [ "${PKG}" != "${PTST}" ]; then
echo "-- $PKG found in patches"
fi
if [ "x${FULLPKG}" = "x" ]; then
@@ -467,39 +579,45 @@ function install_pkgs() {
done
fi
- if [ "$TRIM" = "doc" -o "$TRIM" = "mandoc" -o "$LIVEDE" = "XFCE" ]; then
+ if [ "$TRIM" = "doc" -o "$TRIM" = "mandoc" -o "$TRIM" = "waste" -o "$TRIM" = "bloat" ]; then
# Remove undesired (too big for a live OS) document subdirectories,
# but leave cups alone because it contains the CUPS service's web page:
- mv "${2}"/usr/doc/cups-* "${2}"/usr/ 2>/dev/null
- (cd "${2}/usr/doc" && find . -type d -mindepth 2 -maxdepth 2 -exec rm -rf {} \;)
+ (cd "${2}/usr/doc" && find . -type d -mindepth 2 -maxdepth 2 |grep -v /cups- |xargs rm -rf)
rm -rf "$2"/usr/share/gtk-doc
rm -rf "$2"/usr/share/help
find "$2"/usr/share/ -type d -name doc |xargs rm -rf
# Remove residual bloat:
rm -rf "${2}"/usr/doc/*/html
- rm -f "${2}"/usr/doc/*/*.{html,css,xml,pdf,db,gz,bz2,xz,txt,TXT}
+ rm -f "${2}"/usr/doc/*/*.{pdf,db,gz,bz2,xz,txt,TXT}
# This will remove more bloat but won't touch the license texts:
- find "${2}"/usr/doc/ -type f -size +50k |xargs rm -f
+ find "${2}"/usr/doc/ -type f -size +50k |grep -v /cups- |xargs rm -f
# Remove info pages:
rm -rf "$2"/usr/info
- # Move cups documentation back in place:
- mv "${2}"/usr/cups-* "${2}"/usr/doc/ 2>/dev/null
fi
- if [ "$TRIM" = "mandoc" -o "$LIVEDE" = "XFCE" ]; then
+ if [ "$TRIM" = "mandoc" -o "$TRIM" = "waste" -o "$TRIM" = "bloat" ]; then
# Also remove man pages:
rm -rf "$2"/usr/man
fi
- if [ "$LIVEDE" = "XFCE" ]; then
+ if [ "$TRIM" = "bloat" ]; then
# By pruning stuff that no one likely needs anyway,
# we make room for packages we would otherwise not be able to add.
+ # We do this only if your ISO needs to be the smallest possible:
# MySQL embedded is only used by Amarok:
rm -f "$2"/usr/bin/mysql*embedded*
- # I am against torture:
- rm -f "$2"/usr/bin/smbtorture
# Also remove the big unused/esoteric static libraries:
rm -f "$2"/usr/lib${DIRSUFFIX}/*.a
# This was inadvertantly left in the gcc package:
rm -f "$2"/usr/libexec/gcc/*/*/cc1objplus
+ # From samba we mostly want the shared runtime libraries:
+ rm -rf "$2"/usr/share/samba
+ rm -rf "$2"/usr/lib${DIRSUFFIX}/python*/site-packages/samba
+ # Guile library is all we need to satisfy make:
+ rm -f "$2"/usr/bin/guil*
+ rm -rf "$2"/usr/include/guile
+ rm -rf "$2"/usr/lib64/guile
+ rm -rf "$2"/usr/share/guile
+ # I am against torture:
+ rm -f "$2"/usr/bin/smbtorture
# From llvm we only want the shared runtime libraries so wipe the rest:
rm -f "$2"/usr/lib${DIRSUFFIX}/lib{LLVM,lldb}*.a
rm -rf "$2"/usr/lib${DIRSUFFIX}/libclang*
@@ -517,19 +635,28 @@ function install_pkgs() {
rm -rf "$2"/usr/lib${DIRSUFFIX}/d3d
rm -rf "$2"/usr/lib${DIRSUFFIX}/guile
rm -rf "$2"/usr/share/icons/HighContrast
- # Nor these datacenter NIC firmwares and drivers:
+ fi
+ if [ "$TRIM" = "waste" -o "$TRIM" = "bloat" ]; then
+ # Get rid of these datacenter NIC firmwares and drivers:
rm -rf "$2"/lib/firmware/{bnx*,cxgb4,libertas,liquidio,mellanox,netronome,qed}
rm -rf "$2"/lib/modules/*/kernel/drivers/infiniband
rm -rf "$2"/lib/modules/*/kernel/drivers/net/ethernet/{broadcom/bnx*,chelsio,mellanox,netronome,qlogic}
# Old wireless cards that eat space:
rm -rf "$2"/lib/firmware/mrvl
rm -rf "$2"/lib/modules/*/kernel/drivers/net/wireless/marvell
+ # Qualcomm GPU firmware (Android phone/tablet)
+ rm -rf "$2"/lib/firmware/qcom
+ # Texas Instruments ARM firmware:
+ rm -rf "$2"/lib/firmware/ti-connectivity
# Mediatek ARM firmware:
+ rm -rf "$2"/lib/firmware/mediatek
rm -rf "$2"/lib/firmware/vpu*.bin
+ # Firmware for Data Path Acceleration Architecture NICs:
+ rm -rf "$2"/lib/firmware/dpaa2
# Not needed:
rm -rf "$2"/boot/System.map*
# Depends on Qt:
- rm -f /usr/bin/wpa_gui /usr/share/applications/wpa_gui.desktop
+ rm -f "$2"/usr/bin/wpa_gui "$2"/usr/share/applications/wpa_gui.desktop
# Replace 3.2 MB splash with a symlink to a 33 kB file:
if [ -e "$2"/usr/share/gimp/2.0/images/gimp-splash.png -a ! -L "$2"/usr/share/gimp/2.0/images/gimp-splash.png ]; then
rm -rf "$2"/usr/share/gimp/2.0/images/gimp-splash.png
@@ -549,38 +676,41 @@ function install_pkgs() {
find "$2"/usr/ -type d -iname test |xargs rm -rf
find "$2"/usr/ -type d -iname "example*" |xargs rm -rf
# Get rid of most of the screensavers:
- KEEPXSCR="julia xflame xjack"
+ KEEPXSCR="julia|xflame|xjack"
if [ -d "${2}"/usr/libexec/xscreensaver ]; then
cd "${2}"/usr/libexec/xscreensaver
- mkdir .keep
- for XSCR in ${KEEPXSCR} ; do
- mv ${XSCR} .keep/ 2>/dev/null
- done
- rm -rf [A-Za-z]*
- mv .keep/* . 2>/dev/null
- rm -rf .keep
+ find . -type f | grep -Ev "($KEEPXSCR)" |xargs rm -f
cd - 1>/dev/null
fi
- # Remove unneeded languages from glibc:
- KEEPLANG="$(cat ${LIVE_TOOLDIR}/languages|grep -Ev "(^ *#|^$)"|cut -d: -f5)"
- for LOCALEDIR in /usr/lib${DIRSUFFIX}/locale /usr/share/i18n/locales /usr/share/locale ; do
- if [ -d "${2}"/${LOCALEDIR} ]; then
- cd "${2}"/${LOCALEDIR}
- mkdir .keep
- for KL in C ${KEEPLANG} ; do
- mv ${KL%%.utf8}* .keep/ 2>/dev/null # en_US.utf8 -> en_US*
- mv ${KL%%_*} .keep/ 2>/dev/null # en_US.utf8 -> en
- done
- rm -rf [A-Za-z]*
- mv .keep/* . 2>/dev/null
- rm -rf .keep
- cd - 1>/dev/null
- fi
- done
+ if [ "$3" != "local" ] && echo "$(cat ${PKGFILE} |grep -v -E '^ *#|^$' |cut -d: -f1)" |grep -wq glibc ; then
+ # Remove unneeded languages from glibc:
+ KEEPLANG="$(cat ${LIVE_TOOLDIR}/languages|grep -Ev "(^ *#|^$)"|cut -d: -f5)"
+ for LOCALEDIR in /usr/lib${DIRSUFFIX}/locale /usr/share/i18n/locales /usr/share/locale ; do
+ if [ -d "${2}"/${LOCALEDIR} ]; then
+ cd "${2}"/${LOCALEDIR}
+ mkdir ${LIVE_WORK}/.keep
+ for KL in C ${KEEPLANG} ; do
+ # en_US.utf8 -> en_US*
+ mv ${KL%%.utf8}* ${LIVE_WORK}/.keep/ 2>/dev/null
+ # en_US.utf8 -> en
+ mv ${KL%%_*} ${LIVE_WORK}/.keep/ 2>/dev/null
+ done
+ rm -rf [A-Za-z]*
+ mv ${LIVE_WORK}/.keep/* . 2>/dev/null
+ rm -rf ${LIVE_WORK}/.keep
+ cd - 1>/dev/null
+ fi
+ done
+ fi
+ # Remove big old ICU libraries that are not needed for the XFCE image:
+ if [ -e "$2"/var/log/packages/aaa_elflibs-[0-9]* ]; then
+ for ICUFILE in $(grep /libicu "$2"/var/log/packages/aaa_elflibs-[0-9]*) ; do
+ rm -f "$2"/$ICUFILE ;
+ done
+ fi
fi
- # End install_pkgs
-}
+} # End install_pkgs()
#
@@ -597,12 +727,13 @@ function gen_bootmenu() {
rm -f ${MENUROOTDIR}/kbd.cfg
rm -f ${MENUROOTDIR}/lang*.cfg
- # Generate main (US) vesamenu.cfg:
+ # Generate main (EN) vesamenu.cfg:
cat ${LIVE_TOOLDIR}/menu.tpl | sed \
-e "s/@KBD@/${DEF_KBD}/g" \
-e "s/@LANG@/${DEF_LANG}/g" \
-e "s/@ULANG@/${DEF_LANG^^}/g" \
-e "s,@LOCALE@,${DEF_LOCALE},g" \
+ -e "s,@TZ@,${DEF_TZ},g" \
-e "s/@CONSFONT@/$CONSFONT/g" \
-e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \
-e "s/@DISTRO@/$DISTRO/g" \
@@ -615,6 +746,8 @@ 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" \
+ -e "s/@C2RSH@/$C2RMS/g" \
> ${MENUROOTDIR}/vesamenu.cfg
for LANCOD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d: -f1)
@@ -629,6 +762,11 @@ function gen_bootmenu() {
cat <<EOL >> ${MENUROOTDIR}/kbd.cfg
label ${LANCOD}
menu label ${LANDSC}
+EOL
+ if [ "${KBD}" == "${DEF_KBD}" ]; then
+ echo " menu default" >> ${MENUROOTDIR}/kbd.cfg
+ fi
+ cat <<EOL >> ${MENUROOTDIR}/kbd.cfg
kbdmap menu/${KBD}.ktl
kernel vesamenu.c32
append menu/menu_${LANCOD}.cfg
@@ -639,6 +777,9 @@ EOL
cat ${LIVE_TOOLDIR}/menu.tpl | sed \
-e "s/@KBD@/$KBD/g" \
-e "s/@LANG@/$LANCOD/g" \
+ -e "s/@ULANG@/${DEF_LANG^^}/g" \
+ -e "s,@LOCALE@,${DEF_LOCALE},g" \
+ -e "s,@TZ@,${DEF_TZ},g" \
-e "s/@CONSFONT@/$CONSFONT/g" \
-e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \
-e "s/@DISTRO@/$DISTRO/g" \
@@ -651,6 +792,8 @@ EOL
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
-e "s/@KAPPEND@/$KAPPEND/g" \
+ -e "s/@C2RMH@/$C2RMH/g" \
+ -e "s/@C2RMS@/$C2RMS/g" \
> ${MENUROOTDIR}/menu_${LANCOD}.cfg
# Generate custom language selection submenu for selected keyboard:
@@ -671,7 +814,8 @@ EOL
done
done
-}
+
+} # End of gen_bootmenu()
#
# Create the grub menu file for UEFI boot:
@@ -680,7 +824,7 @@ function gen_uefimenu() {
GRUBDIR="$1"
- # Generate the grub menu structure - many files because of the selection tree.
+ # Generate the grub menu structure.
# I expect the directory to exist... but you never know.
mkdir -p ${GRUBDIR}
@@ -709,12 +853,14 @@ 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" \
+ -e "s/@C2RMS@/$C2RMS/g" \
> ${GRUBDIR}/grub.cfg
# Set a default keyboard selection:
cat <<EOL > ${GRUBDIR}/kbd.cfg
# Keyboard selection:
-set default = $sl_lang
+set default = $sl_kbd
EOL
@@ -760,6 +906,9 @@ EOL
done
# Create the timezone selection menu:
+ # Code used from Slackware script:
+ # source/a/glibc-zoneinfo/timezone-scripts/output-updated-timeconfig.sh
+ # Author: Patrick Volkerding <volkerdi@slackware.com>
TZDIR="/usr/share/zoneinfo"
TZLIST=$(mktemp -t alientz.XXXXXX)
if [ ! -f $TZLIST ]; then
@@ -767,41 +916,177 @@ EOL
cleanup
exit 1
fi
- # First, create a list of timezones:
- # This code taken from Slackware script:
- # source/a/glibc-zoneinfo/timezone-scripts/output-updated-timeconfig.sh
- # Author: Patrick Volkerding <volkerdi@slackware.com>
- # US/ first:
- ( cd $TZDIR
- find . -type f | xargs file | grep "timezone data" | cut -f 1 -d : | cut -f 2- -d / | sort | grep "^US/" | while read zone ; do
- echo "${zone}" >> $TZLIST
- done
- )
- # Don't list right/ and posix/ zones:
- ( cd $TZDIR
- find . -type f | xargs file | grep "timezone data" | cut -f 1 -d : | cut -f 2- -d / | sort | grep -v "^US/" | grep -v "^posix/" | grep -v "^right/" | while read zone ; do
- echo "${zone}" >> $TZLIST
- done
- )
- for TZ in $(cat $TZLIST); do
- # Add this entry to the keyboard selection menu:
+
+ # Structured tz select instead of dumping them all in one menu:
+ for TZ in US Africa America Asia Atlantic Australia Etc Europe Pacific; do
+ # First the submenu for this zone:
cat <<EOL >> ${GRUBDIR}/tz.cfg
-menuentry "${TZ}" {
- set sl_tz="$TZ"
+submenu "${TZ} >" {
+ configfile \$prefix/${TZ}/tz.cfg
+}
+
+EOL
+ # Then the locations for this zone:
+ mkdir ${GRUBDIR}/${TZ}
+ ( cd $TZDIR/$TZ
+ find . -type f | xargs file | grep "timezone data" | cut -f 1 -d : | cut -f2- -d / | sort | while read LOCN ; do
+ # Add this entry to the keyboard selection menu:
+ cat <<EOL >> ${GRUBDIR}/${TZ}/tz.cfg
+menuentry "${TZ}/${LOCN}" {
+ set sl_tz="${TZ}/${LOCN}"
export sl_tz
configfile \$prefix/grub.cfg
}
EOL
- rm -f $TZLIST
-
+ done
+ )
done
+ # Timezone data in rootdirectory follows:
+ ( cd $TZDIR
+ find . -type f -mindepth 1 -maxdepth 1 | xargs file | grep "timezone data" | cut -f 1 -d : | cut -f 2- -d / | sort | while read ZONE ; do
+ # Add this entry to the keyboard selection menu:
+ cat <<EOL >> ${GRUBDIR}/tz.cfg
+menuentry "${ZONE}" {
+ set sl_tz="$ZONE"
+ export sl_tz
+ configfile \$prefix/grub.cfg
}
+EOL
+ done
+ )
+
+} # End of gen_uefimenu()
+
+
+#
+# Add UEFI SecureBoot support:
+#
+function secureboot() {
+ # Liveslak uses Fedora's shim (for now), which is signed by
+ # 'Microsoft UEFI CA' and contains Fedora's CA certificate.
+ # We sign liveslak's grub and kernel with our own key/certificate pair.
+ # This means that the user of liveslak will have to enroll liveslak's
+ # public certificate via MokManager. This needs to be done only once.
+
+ # Note that we use the generic fallback directory /EFI/BOOT/ for the Live ISO
+ # instead of a custom distro entry for UEFI such as /EFI/BOOT/Slackware/
+ # When shim is booted with path /EFI/BOOT/bootx64.efi, and there is a
+ # Fallback binary (fbx64.efi) , shim will load that one instead of grub,
+ # so Fallback can create a NVRAM boot entry for a custom distro directory
+ # (which we do not have) causing a reset boot loop.
+ # This is why liveslak does not install fbx64.efi. A regular distro should
+ # install that file in its distro subdirectory!
+
+ SHIM_VENDOR="$1"
+ [ -z "${SHIM_VENDOR}" ] && SHIM_VENDOR="fedora"
+
+ case $SHIM_VENDOR in
+ opensuse) GRUB_SIGNED="grub.efi"
+ ;;
+ *) GRUB_SIGNED="grubx64.efi"
+ ;;
+ esac
+ mkdir -p ${LIVE_WORK}/shim
+ cd ${LIVE_WORK}/shim
+
+ echo "-- Signing grub+kernel with '${LIVE_STAGING}/EFI/BOOT/liveslak.pem'."
+ # Sign grub:
+ # The Grub EFI image must be renamed appropriately for shim to find it,
+ # since some distros change the default 'grubx64.efi' filename:
+ mv -i ${LIVE_STAGING}/EFI/BOOT/bootx64.efi \
+ ${LIVE_WORK}/shim/grubx64.efi.unsigned
+ sbsign --key ${MOKPRIVKEY} --cert ${MOKCERT} \
+ --output ${LIVE_STAGING}/EFI/BOOT/${GRUB_SIGNED} \
+ ${LIVE_WORK}/shim/grubx64.efi.unsigned
+ # Sign the kernel:
+ mv ${LIVE_STAGING}/boot/generic ${LIVE_WORK}/shim/generic.unsigned
+ sbsign --key ${MOKPRIVKEY} --cert ${MOKCERT} \
+ --output ${LIVE_STAGING}/boot/generic \
+ ${LIVE_WORK}/shim/generic.unsigned
+
+ if [ "${SHIM_VENDOR}" = "fedora" ]; then
+ # The version of Fedora's shim package - always use the latest!
+ SHIM_MAJVER=15.6
+ SHIM_MINVER=2
+ SHIMSRC="https://kojipkgs.fedoraproject.org/packages/shim/${SHIM_MAJVER}/${SHIM_MINVER}/x86_64/shim-x64-${SHIM_MAJVER}-${SHIM_MINVER}.x86_64.rpm"
+ echo "-- Downloading/installing the SecureBoot signed shim from Fedora."
+ wget -q --progress=dot:mega --show-progress ${SHIMSRC} -O - \
+ | rpm2cpio - | cpio -dim
+ echo ""
+ # Install signed efi files into UEFI BOOT directory of the esp partition:
+ # The name of the shim in the ISO, *must* be 'bootx64.efi':
+ install -D -m0644 boot/efi/EFI/fedora/shimx64.efi \
+ ${LIVE_STAGING}/EFI/BOOT/bootx64.efi
+ install -D -m0644 boot/efi/EFI/fedora/mmx64.efi \
+ ${LIVE_STAGING}/EFI/BOOT/mmx64.efi
+ #install -D -m0644 boot/efi/EFI/BOOT/fbx64.efi \
+ # ${LIVE_STAGING}/EFI/BOOT/fbx64.efi
+ elif [ "${SHIM_VENDOR}" = "opensuse" ]; then
+ SHIM_MAJVER=15.4
+ SHIM_MINVER=6.1
+ SHIMSRC="https://download.opensuse.org/repositories/openSUSE:/Factory/standard/x86_64/shim-${SHIM_MAJVER}-${SHIM_MINVER}.x86_64.rpm"
+ echo "-- Downloading/installing the SecureBoot signed shim from openSUSE."
+ wget -q --progress=dot:mega --show-progress ${SHIMSRC} -O - \
+ | rpm2cpio - | cpio -dim
+ echo ""
+ # Install signed efi files into UEFI BOOT directory of the esp partition:
+ # The name of the shim in the ISO, *must* be 'bootx64.efi':
+ install -D -m0644 usr/share/efi/x86_64/shim-opensuse.efi \
+ ${LIVE_STAGING}/EFI/BOOT/bootx64.efi
+ install -D -m0644 usr/share/efi/x86_64/MokManager.efi \
+ ${LIVE_STAGING}/EFI/BOOT/MokManager.efi
+ #install -D -m0644 usr/share/efi/x86_64/fallback.efi \
+ # ${LIVE_STAGING}/EFI/BOOT/fallback.efi
+ elif [ "${SHIM_VENDOR}" = "debian" ]; then
+ DEBSHIM_VER=1.40
+ DEBMOKM_VER=1
+ SHIM_MAJVER=15.7
+ SHIM_MINVER=1
+ SHIMSRC="http://ftp.de.debian.org/debian/pool/main/s/shim-signed/shim-signed_${DEBSHIM_VER}+${SHIM_MAJVER}-${SHIM_MINVER}_amd64.deb"
+ MOKMSRC="http://ftp.de.debian.org/debian/pool/main/s/shim-helpers-amd64-signed/shim-helpers-amd64-signed_${DEBMOKM_VER}+${SHIM_MAJVER}+${SHIM_MINVER}_amd64.deb"
+ echo "-- Downloading the SecureBoot signed shim from Debian."
+ wget -q --progress=dot:mega --show-progress ${SHIMSRC}
+ echo ""
+ echo "-- Installing the SecureBoot signed shim to the ESP."
+ # Extract discarding any directory structure:
+ ar p $(basename ${SHIMSRC}) data.tar.xz | tar --xform='s#^.+/##x' -Jxf - \
+ ./usr/lib/shim/shimx64.efi.signed
+ echo "-- Downloading the SecureBoot signed mokmanager from Debian."
+ wget -q --progress=dot:mega --show-progress ${MOKMSRC}
+ echo ""
+ echo "-- Installing the SecureBoot signed mokmanager to the ESP."
+ # Extract discarding any directory structure:
+ ar p $(basename ${MOKMSRC}) data.tar.xz | tar --xform='s#^.+/##x' -Jxf - \
+ ./usr/lib/shim/fbx64.efi.signed ./usr/lib/shim/mmx64.efi.signed
+ # Install signed efi files into UEFI BOOT directory of the esp partition:
+ # The name of the shim in the ISO, *must* be 'bootx64.efi':
+ install -D -m0644 ./shimx64.efi.signed \
+ ${LIVE_STAGING}/EFI/BOOT/bootx64.efi
+ install -D -m0644 ./mmx64.efi.signed \
+ ${LIVE_STAGING}/EFI/BOOT/mmx64.efi
+ #install -D -m0644 ./fbx64.efi.signed \
+ # ${LIVE_STAGING}/EFI/BOOT/fbx64.efi
+ else
+ echo ">> A '${SHIM_VENDOR}' shim was requested, but only 'opensuse' 'fedora' or 'debian' shim/mokmanager are supported."
+ echo ">> Expect trouble ahead."
+ fi
+ cd - 1>/dev/null
+
+ ## Write CSV file for the Fallback EFI program so that it knows what to boot:
+ #echo -n "bootx64.efi,SHIM,,SecureBoot UEFI entry for liveslak" \
+ # | iconv -t UCS-2 > ${LIVE_STAGING}/EFI/BOOT/BOOT.CSV
+
+ # Cleanup:
+ rm -rf ${LIVE_WORK}/shim
+
+} # End of secureboot()
+
#
# Create an ISO file from a directory's content:
#
-create_iso() {
+function create_iso() {
TOPDIR=${1:-"${LIVE_STAGING}"}
cd "$TOPDIR"
@@ -887,17 +1172,130 @@ create_iso() {
} # End of create_iso()
+#
+# Configure a custom background image in Plasma5:
+#
+function plasma5_custom_bg() {
+ # The function expects a background image file of JPG or PNG format.
+ # The bitmap must be present in the liveslak source tree as:
+ # media/<variant>/bg/background.png or media/<variant>/bg/background.jpg ,
+ # where <variant> is the lowercase name of the liveslak variant (such as
+ # cinnamon, daw, slackware, etc).
+ # The file background.{jpg,png} can be a symlink to an actual JPG or PNG.
+ # Aspect ratio of the image *must* be 16:9 (1920x1080 px or higher res).
+
+ # Exit immediately if the image file is not found:
+ if ! readlink -f ${LIVE_TOOLDIR}/media/${LIVEDE,,}/bg/background.* 1>/dev/null 2>&1 ; then
+ echo "-- No ${LIVEDE} custom wallpaper image."
+ return
+ fi
+
+ echo "-- Configuring ${LIVEDE} custom background image."
+ # First convert our image into a JPG in the liveslak directory:
+ mkdir -p ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}
+ convert ${LIVE_TOOLDIR}/media/${LIVEDE,,}/bg/background.* ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg
+
+ # Create a Plasma5 desktop wallpaper set with a lowercase LIVEDE name:
+ mkdir -p ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images
+
+ # Create set of images for common aspect ratios like 16:9, 16:10 and 4:3:
+ # Aspect Ratio 16:9 :
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 1920x1080 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images/1920x1080.jpg
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 5120x2880 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images/5120x2880.jpg
+ # Aspect Ratio 16:10 :
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 5120x - | \
+ convert - -geometry 1920x1200^ -gravity center -crop 1920x1200+0+0 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images/1920x1200.jpg
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 5120x - | \
+ convert - -geometry 1280x800^ -gravity center -crop 1280x800+0+0 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images/1280x800.jpg
+ # Aspect Ratio 4:3 :
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 5120x - | \
+ convert - -geometry 1024x768^ -gravity center -crop 1024x768+0+0 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/images/1024x768.jpg
+
+ # Create the required wallpaper screenshot of 400x225 px (16:9 aspect ratio):
+ convert ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg \
+ -resize 400x225 \
+ ${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/contents/screenshot.png
+
+ # Add wallpaper description:
+ cat <<EOT >${LIVE_ROOTDIR}/usr/share/wallpapers/${LIVEDE,,}/metadata.desktop
+[Desktop Entry]
+Name=${DISTRO^} Live
+
+X-KDE-PluginInfo-Name=${LIVEDE,,}
+X-KDE-PluginInfo-Author=Eric Hameleers
+X-KDE-PluginInfo-Email=alien@slackware.com
+X-KDE-PluginInfo-License=CC-BY-SA-4.0
+EOT
+
+ # Now set our wallpaper to be the default. For this to work, we need to link
+ # the name of the default theme to ours, so find out what the default is:
+ if [ -f "${LIVE_ROOTDIR}/usr/share/plasma/desktoptheme/default/metadata.desktop" ]; then
+ # Frameworks before 5.94.0:
+ THEMEFIL=/usr/share/plasma/desktoptheme/default/metadata.desktop
+ else
+ # Frameworks 5.94.0 and newer:
+ THEMEFIL=/usr/share/plasma/desktoptheme/default/plasmarc
+ fi
+ DEF_THEME="$(grep ^defaultWallpaperTheme ${LIVE_ROOTDIR}/${THEMEFIL} |cut -d= -f2-)"
+ mv ${LIVE_ROOTDIR}/usr/share/wallpapers/${DEF_THEME}{,.orig}
+ ln -s ${LIVEDE,,} ${LIVE_ROOTDIR}/usr/share/wallpapers/${DEF_THEME}
+
+ # Custom background for the SDDM login greeter:
+ mkdir -p ${LIVE_ROOTDIR}/usr/share/sddm/themes/breeze
+ cp ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg ${LIVE_ROOTDIR}/usr/share/sddm/themes/breeze/${LIVEDE,,}_background.jpg
+ cat <<EOT > ${LIVE_ROOTDIR}/usr/share/sddm/themes/breeze/theme.conf.user
+[General]
+background=${LIVEDE,,}_background.jpg
+EOT
+
+ # Screenlocker:
+ mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/.config
+cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/kscreenlockerrc
+[$Version]
+update_info=kscreenlocker.upd:0.1-autolock
+
+[Greeter]
+WallpaperPlugin=org.kde.image
+[Greeter][Wallpaper][org.kde.image][General]
+FillMode=2
+Image=file:///usr/share/${LIVEMAIN}/${LIVEDE,,}/background.jpg
+EOT
+
+# Is a dark theme requested to match the background atmosphere?
+if [ -f ${LIVE_TOOLDIR}/media/${LIVEDE,,}/bg/theme ]; then
+ if [ "$(grep -v '^#' ${LIVE_TOOLDIR}/media/${LIVEDE,,}/bg/theme)" == "dark" ]
+ then
+ mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/.config
+ cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/plasmarc
+[Theme]
+name=breeze-dark
+EOT
+ fi
+fi
+
+} # End of plasma5_custom_bg()
+
# ---------------------------------------------------------------------------
# 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:S:X" Option
do
case $Option in
h )
- echo "----------------------------------------------------------------"
- echo "make_slackware_live.sh $VERSION"
- echo "----------------------------------------------------------------"
+ echo "----------------------------------------------------------------"
+ echo "make_slackware_live.sh $VERSION"
+ echo "----------------------------------------------------------------"
echo "Usage:"
echo " $0 [OPTION] ..."
echo "or:"
@@ -913,10 +1311,11 @@ do
echo " Use i586 for a 32bit ISO, x86_64 for 64bit."
echo " -c comp Squashfs compression (default: ${SQ_COMP})."
echo " Can be any of '${SQ_COMP_AVAIL}'."
- echo " -d desktoptype SLACKWARE (full Slack), KDE4 basic,"
- echo " XFCE basic, PLASMA5, MATE, CINNAMON, DLACK."
+ echo " -d desktoptype SLACKWARE (full Slack),XFCE basic, LEAN, DAW,"
+ echo " KTOWN, MATE, CINNAMON, DLACK, STUDIOWARE."
echo " -e Use ISO boot-load-size of 32 for computers."
echo " where the ISO won't boot otherwise."
+ echo " Default value is ${BOOTLOADSIZE}."
echo " -f Forced re-generation of all squashfs modules,"
echo " custom configurations and new initrd.img."
echo " -l <localization> Enable a different default localization"
@@ -924,14 +1323,19 @@ do
echo " -m pkglst[,pkglst] Add modules defined by pkglists/<pkglst>,..."
echo " -r series[,series] Refresh only one or a few package series."
echo " -s slackrepo_dir Directory containing ${DISTRO^} repository."
- echo " -t <doc|mandoc> Trim the ISO (remove man and/or doc)."
+ echo " -t <none|doc|mandoc|waste|bloat>"
+ 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 " -G Generate ISO file from existing directory tree"
+ 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)."
echo " -O outfile Custom filename for the ISO."
echo " -R runlevel Runlevel to boot into (default: $RUNLEVEL)."
+ echo " -S privkey:cert Enable SecureBoot support and sign binaries"
+ echo " using the full path to colon-separated"
+ echo " private key and certificate files"
echo " -X Use xorriso instead of mkisofs/isohybrid."
exit
;;
@@ -952,6 +1356,7 @@ do
r ) REFRESH="${OPTARG}"
;;
s ) SL_REPO="${OPTARG}"
+ DEF_SL_REPO="${SL_REPO}"
;;
t ) TRIM="${OPTARG}"
;;
@@ -959,6 +1364,8 @@ do
;;
z ) SL_VERSION="${OPTARG}"
;;
+ C ) CORE2RAM="YES"
+ ;;
G ) ONLY_ISO="YES"
;;
H ) LIVE_HOSTNAME="${OPTARG}"
@@ -970,6 +1377,12 @@ do
;;
R ) RUNLEVEL=${OPTARG}
;;
+ S ) MOKPRIVKEY=$(readlink -f $(echo ${OPTARG} |cut -d: -f1))
+ MOKCERT=$(readlink -f $(echo ${OPTARG} |cut -d: -f2))
+ TEMP_3RDP=$(echo ${OPTARG} |cut -d: -f3)
+ [ -n "${TEMP_3RDP}" ] && SHIM_3RDP=${TEMP_3RDP}
+ unset TEMP_3RDP
+ ;;
X ) USEXORR="YES"
;;
* ) echo "You passed an illegal switch to the program!"
@@ -1014,6 +1427,50 @@ if [ "$SL_ARCH" != "x86_64" -a "$MULTILIB" = "YES" ]; then
exit 1
fi
+if [ -n "${MOKPRIVKEY}" ] && [ -n "${MOKCERT}" ]; then
+ if [ -f ${MOKPRIVKEY} ] && [ -f ${MOKCERT} ]; then
+ echo "-- Enabling SecureBoot support (${SHIM_3RDP} shim)."
+ SECUREBOOT=1
+ else
+ echo ">> SecureBoot can not be enabled; MOK key and/or cert not found."
+ exit 1
+ fi
+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 [ "${MSEQ#pkglist:${CORE2RAMMODS/ /,}}" != "${MSEQ}" ]; then
+ # This live ISO contains core2ram modules out of the box:
+ echo "-- Native core2ram."
+ CORE2RAM="NATIVE"
+fi
+if [ "${CORE2RAM}" != "NO" ]; then
+ # Whether to show the Core OS menu in syslinux/grub on boot yes/no:
+ C2RMH="#" # syslinux
+ C2RMS="" # grub
+else
+ C2RMH="" # syslinux
+ C2RMS="#" # grub
+fi
+
if ! cat ${LIVE_TOOLDIR}/languages |grep -Ev '(^ *#|^$)' |grep -q ^${DEF_LANG}:
then
echo ">> Unsupported language '${DEF_LANG}', select a supported language:"
@@ -1028,7 +1485,7 @@ else
# Select sane defaults in case the language file lacks info:
DEF_LANDSC="${DEF_LANDSC:-'us american'}"
DEF_KBD="${DEF_KBD:-'us'}"
- DEF_TZ="${DEF_TZ:-'US/Pacific'}"
+ DEF_TZ="${DEF_TZ:-'UTC'}"
DEF_LOCALE="${DEF_LOCALE:-'en_US.utf8'}"
fi
@@ -1054,7 +1511,11 @@ DEF_SL_PATCHROOT=${SL_PATCHROOT}
# Are all the required add-on tools present?
[ "$USEXORR" = "NO" ] && ISOGEN="mkisofs isohybrid" || ISOGEN="xorriso"
PROG_MISSING=""
-for PROGN in mksquashfs unsquashfs grub-mkfont grub-mkimage syslinux $ISOGEN installpkg upgradepkg keytab-lilo rsync mkdosfs ; do
+REQTOOLS="mksquashfs unsquashfs grub-mkfont grub-mkimage syslinux $ISOGEN installpkg upgradepkg keytab-lilo rsync wget mkdosfs"
+if [ $SECUREBOOT -eq 1 ]; then
+ REQTOOLS="${REQTOOLS} openssl sbsign"
+fi
+for PROGN in ${REQTOOLS} ; do
if ! which $PROGN 1>/dev/null 2>/dev/null ; then
PROG_MISSING="${PROG_MISSING}-- $PROGN\n"
fi
@@ -1098,6 +1559,30 @@ else
RSYNCREP=" "
fi
+# What to trim from the ISO file (none, doc, mandoc, waste, bloat):
+if [ "${LIVEDE}" == "XFCE" ] ; then
+ TRIM=${TRIM:-"waste"}
+elif [ "${LIVEDE}" == "LEAN" ] ; then
+ TRIM=${TRIM:-"doc"}
+else
+ TRIM=${TRIM:-"none"}
+fi
+
+# Determine additional boot parameters to be added:
+if [ -z "${KAPPEND}" ]; then
+ eval KAPPEND=\$KAPPEND_${LIVEDE}
+fi
+
+# Determine possible blacklist to use:
+if [ -z "${BLACKLIST}" ]; then
+ eval BLACKLIST=\$BLACKLIST_${LIVEDE}
+fi
+
+# Determine possible package list from 'testing' to use:
+if [ -z "${TESTINGLIST}" ]; then
+ eval TESTINGLIST=\$TESTINGLIST_${LIVEDE}
+fi
+
# Create output directory for image file:
mkdir -p "${OUTPUT}"
if [ $? -ne 0 ]; then
@@ -1119,12 +1604,12 @@ fi
if [ "$FORCE" = "YES" ]; then
echo "-- Removing old files and directories!"
umount ${LIVE_ROOTDIR}/{proc,sys,dev} 2>${DBGOUT} || true
- umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+ umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
rm -rf ${LIVE_STAGING}/${LIVEMAIN} ${LIVE_WORK} ${LIVE_ROOTDIR}
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
@@ -1157,24 +1642,17 @@ 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}" ;;
- KDE4) MSEQ="${SEQ_KDE4BASE}" ;;
- PLASMA5) MSEQ="${SEQ_PLASMA5}" ;;
- 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 add core2ram modules:
+if [ "$CORE2RAM" == "YES" ]; then
+ echo "-- Adding core2ram."
+ MSEQ="pkglist:${CORE2RAMMODS/ /,} ${MSEQ}"
+fi
+
+# Do we need to include secureboot module?
+if [ $SECUREBOOT -eq 1 ]; then
+ echo "-- Adding secureboot module."
+ MSEQ="${MSEQ} pkglist:secureboot"
+fi
# Do we need to create/include additional module(s) defined by a pkglist:
if [ -n "$SEQ_ADDMOD" ]; then
@@ -1185,8 +1663,10 @@ fi
# Do we need to include multilib?
# Add these last so we can easily distribute the module separately.
if [ "$MULTILIB" = "YES" ]; then
- echo "-- Adding multilib."
- MSEQ="${MSEQ} pkglist:multilib"
+ if ! echo ${MSEQ} |grep -qw multilib ; then
+ echo "-- Adding multilib."
+ MSEQ="${MSEQ} pkglist:multilib"
+ fi
fi
echo "-- Creating liveslak ${VERSION} '${LIVEDE}' image (based on ${DISTRO^}-${SL_VERSION} ${SL_ARCH})."
@@ -1207,6 +1687,10 @@ for MSUBSEQ in ${MSEQ} ; do
local) MNUM="0030" ;;
*) echo "** Unknown package source '$MTYPE'"; exit 1 ;;
esac
+ # For an explicitly added core2ram module, re-assign a lower prefix:
+ if [ "$CORE2RAM" == "YES" ] && [ "${SL_SERIES}" == "${CORE2RAMMODS}" ]; then
+ MNUM="0005"
+ fi
for SPS in ${SL_SERIES} ; do
@@ -1224,14 +1708,14 @@ for SPS in ${SL_SERIES} ; do
echo "${THEDATE} (${BUILDER})" > ${INSTDIR}/${MARKER}
echo "-- Installing the '${SPS}' series."
- umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+ umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
mount -t overlay -o lowerdir=${RODIRS},upperdir=${INSTDIR},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR}
# Install the package series:
install_pkgs ${SPS} ${LIVE_ROOTDIR} ${MTYPE}
- umount ${LIVE_ROOTDIR} || true
+ umount -R ${LIVE_ROOTDIR} || true
- if [ "$SPS" = "a" -o "$SPS" = "${MINLIST}" ]; then
+ if [ "$SPS" = "a" -a "$CORE2RAM" = "NO" ] || [ "$SPS" = "${MINLIST}" ]; then
# We need to take care of a few things first:
if [ "$SL_ARCH" = "x86_64" -o "$SMP32" = "NO" ]; then
@@ -1298,7 +1782,7 @@ mkdir -p ${INSTDIR}
echo "-- Configuring the base system."
# -------------------------------------------------------------------------- #
-umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
mount -t overlay -o lowerdir=${RODIRS},upperdir=${INSTDIR},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR}
# Determine the kernel version in the Live OS:
@@ -1311,18 +1795,19 @@ else
fi
# Configure hostname and network:
-echo "${LIVE_HOSTNAME}.example.net" > ${LIVE_ROOTDIR}/etc/HOSTNAME
+echo "${LIVE_HOSTNAME}.home.arpa" > ${LIVE_ROOTDIR}/etc/HOSTNAME
if [ -f ${LIVE_ROOTDIR}/etc/NetworkManager/NetworkManager.conf ]; then
sed -i -e "s/^hostname=.*/hostname=${LIVE_HOSTNAME}/" \
${LIVE_ROOTDIR}/etc/NetworkManager/NetworkManager.conf
fi
-sed -e "s/^\(127.0.0.1\t*\)darkstar.*/\1${LIVE_HOSTNAME}.example.net ${LIVE_HOSTNAME}/" \
+sed -e "s/^\(127.0.0.1\t*\)darkstar.*/\1${LIVE_HOSTNAME}.home.arpa ${LIVE_HOSTNAME}/" \
-i ${LIVE_ROOTDIR}/etc/hosts
# Make sure we can access DNS straight away:
cat <<EOT >> ${LIVE_ROOTDIR}/etc/resolv.conf
nameserver 8.8.4.4
nameserver 8.8.8.8
+nameserver 1.1.1.1
EOT
@@ -1340,16 +1825,14 @@ echo "LANG=${DEF_LOCALE}" > ${LIVE_ROOTDIR}/etc/locale.conf
echo "KEYMAP=${DEF_KBD}" > ${LIVE_ROOTDIR}/etc/vconsole.conf
# Set timezone to UTC, mimicking the 'timeconfig' script in Slackware:
-cp -a ${LIVE_ROOTDIR}/usr/share/zoneinfo/UTC ${LIVE_ROOTDIR}/etc/localtime
+ln -sf /usr/share/zoneinfo/UTC ${LIVE_ROOTDIR}/etc/localtime
# Could be absent so 'rm -f' to avoid script aborts:
rm -f ${LIVE_ROOTDIR}/etc/localtime-copied-from
-ln -s /usr/share/zoneinfo/UTC ${LIVE_ROOTDIR}/etc/localtime-copied-from
-# Qt5 expects '/etc/localtime' to be a symlink, but in Slackware this is a
-# real file. This causes Qt5 timezone detection to fail so that "UTC"
-# will be returned always. However if a file '/etc/timezone' exists, Qt5
-# will use that. Until this is fixed (either in Slackware or in Qt5) we
-# add the file and update the 'timeconfig' script accordingly:
+# Qt5 expects '/etc/localtime' to be a symlink. If this is a real file,
+# it causes Qt5 timezone detection to fail so that "UTC" will be returned
+# always. However if a file '/etc/timezone' exists, Qt5 will use that.
+# We add the file and update the 'timeconfig' script accordingly:
echo "UTC" > ${LIVE_ROOTDIR}/etc/timezone
sed -i -n "p;s/^\( *\)rm -f localtime$/\1echo \$TZ > timezone/p" \
${LIVE_ROOTDIR}/usr/sbin/timeconfig
@@ -1383,19 +1866,20 @@ chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.font
cat <<"EOM" > ${LIVE_ROOTDIR}/etc/rc.d/rc.gpm
#!/bin/sh
# Start/stop/restart the GPM mouse server:
-[ ! -x /usr/sbin/gpm ] && return
-MTYPE="imps2"
-if [ "$1" = "stop" ]; then
- echo "Stopping gpm..."
- /usr/sbin/gpm -k
-elif [ "$1" = "restart" ]; then
- echo "Restarting gpm..."
- /usr/sbin/gpm -k
- sleep 1
- /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}
-else # assume $1 = start:
- echo "Starting gpm: /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}"
- /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}
+if [ -x /usr/sbin/gpm ]; then
+ MTYPE="imps2"
+ if [ "$1" = "stop" ]; then
+ echo "Stopping gpm..."
+ /usr/sbin/gpm -k
+ elif [ "$1" = "restart" ]; then
+ echo "Restarting gpm..."
+ /usr/sbin/gpm -k
+ sleep 1
+ /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}
+ else # assume $1 = start:
+ echo "Starting gpm: /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}"
+ /usr/sbin/gpm -m /dev/mouse -t ${MTYPE}
+ fi
fi
EOM
chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.gpm
@@ -1416,6 +1900,16 @@ none / tmpfs defaults 1 1
EOT
+# Pipewire 1.0.0 is capable of replacing pulseaudio and jack2:
+if chroot ${LIVE_ROOTDIR} /usr/bin/pkg-config libpipewire-0.3 --atleast-version=1
+then
+ # Make pipewire the default, kill pulseaudio:
+ if [ -x ${LIVE_ROOTDIR}/usr/sbin/pipewire-enable.sh ]; then
+ echo "-- Enabling pipewire"
+ chroot ${LIVE_ROOTDIR} /usr/sbin/pipewire-enable.sh
+ fi
+fi
+
# Prevent loop devices (sxz modules) from appearing in filemanagers:
mkdir -p ${LIVE_ROOTDIR}/etc/udev/rules.d
cat <<EOL > ${LIVE_ROOTDIR}/etc/udev/rules.d/11-local.rules
@@ -1429,25 +1923,179 @@ KERNEL=="loop*", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="loop*", ENV{UDISKS_IGNORE}="1"
EOL
-# Set a root password.
-echo "root:${ROOTPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+# Set a root password. Note 'chpasswd' sometimes segfaults in the first form.
+if ! echo "root:${ROOTPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} 2>/dev/null; then
+ echo "root:${ROOTPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+fi
+
+# Create group and user for the nvidia persistence daemon:
+if ! chroot ${LIVE_ROOTDIR} /usr/bin/getent passwd ${NVUID} > /dev/null 2>&1 ;
+then
+ chroot ${LIVE_ROOTDIR} /usr/sbin/groupadd -g ${NVGRPNR} ${NVGRP}
+ chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "Nvidia persistence" -u ${NVUIDNR} -g ${NVGRPNR} -d /dev/null -s /bin/false ${NVUID}
+ if ! echo "${NVUID}:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} 2>/dev/null ; then
+ echo "${NVUID}:$(openssl rand -base64 12)" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+ fi
+fi
+
+# Determine the full name of the live account in the image:
+if [ -z "${LIVEUIDFN}" ]; then
+ eval LIVEUIDFN=\$LIVEUIDFN_${LIVEDE}
+ if [ -z "${LIVEUIDFN}" ]; then
+ LIVEUIDFN="${DISTRO^} Live User"
+ fi
+fi
# Create a nonprivileged user account (called "live" by default):
-chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "Slackware Live User" -g users -G wheel,audio,cdrom,floppy,plugdev,video,power,netdev,lp,scanner,kmem,dialout,games,disk,input -u 1000 -d /home/${LIVEUID} -m -s /bin/bash ${LIVEUID}
-echo "${LIVEUID}:${LIVEPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "${LIVEUIDFN}" -g users -G wheel,audio,cdrom,floppy,plugdev,video,power,netdev,lp,scanner,kmem,dialout,games,disk,input -u ${LIVEUIDNR} -d /home/${LIVEUID} -m -s /bin/bash ${LIVEUID}
+if ! echo "${LIVEUID}:${LIVEPW}" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} 2>/dev/null ; then
+ echo "${LIVEUID}:${LIVEPW}" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+fi
-# Configure suauth:
-cat <<EOT >${LIVE_ROOTDIR}/etc/suauth
+# Configure suauth if we are not on a PAM system (where this does not work):
+if [ ! -L ${LIVE_ROOTDIR}/lib${DIRSUFFIX}/libpam.so.? ]; then
+ cat <<EOT >${LIVE_ROOTDIR}/etc/suauth
root:${LIVEUID}:OWNPASS
root:ALL EXCEPT GROUP wheel:DENY
EOT
-chmod 600 ${LIVE_ROOTDIR}/etc/suauth
+ chmod 600 ${LIVE_ROOTDIR}/etc/suauth
+fi
# Configure sudoers:
chmod 640 ${LIVE_ROOTDIR}/etc/sudoers
+# Slackware 14.2:
sed -i ${LIVE_ROOTDIR}/etc/sudoers -e 's/# *\(%wheel\sALL=(ALL)\sALL\)/\1/'
+# Slackware 15.0:
+sed -i ${LIVE_ROOTDIR}/etc/sudoers -e 's/# *\(%wheel\sALL=(ALL:ALL)\sALL\)/\1/'
chmod 440 ${LIVE_ROOTDIR}/etc/sudoers
+# Also treat members of the 'wheel' group as admins next to root:
+mkdir -p ${LIVE_ROOTDIR}/etc/polkit-1/rules.d
+cat <<EOT > ${LIVE_ROOTDIR}/etc/polkit-1/rules.d/10-wheel-admin.rules
+polkit.addAdminRule(function(action, subject) {
+ return ["unix-group:wheel"];
+});
+EOT
+
+# Add some convenience to the bash shell:
+mkdir -p ${LIVE_ROOTDIR}/etc/skel/
+cat << "EOT" > ${LIVE_ROOTDIR}/etc/skel/.bashrc
+# If not running interactively, don't do anything
+[ -z "$PS1" ] && return
+# Check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+EOT
+cat << "EOT" > ${LIVE_ROOTDIR}/etc/skel/.profile
+# Source a .bashrc if it exists:
+[[ -r ~/.bashrc ]] && . ~/.bashrc
+
+# Define some useful aliases:
+alias ll="ls -la $LS_OPTIONS"
+lsp() { basename $(ls -1 "/var/log/packages/$@"*) ; }
+alias md="mkdir"
+alias tarview="tar -tvf"
+# GREP_OPTIONS="--color=auto" is deprecated, use alias to enable colored output:
+alias grep="grep --color=auto"
+alias fgrep="fgrep --color=auto"
+alias egrep="egrep --color=auto"
+
+# Ctrl-D should not log us off immediately; now it needs 10 times:
+set -o ignoreeof
+EOT
+
+# Do the root account the same favor:
+cat ${LIVE_ROOTDIR}/etc/skel/.profile > ${LIVE_ROOTDIR}/root/.profile
+chown root:root ${LIVE_ROOTDIR}/root/.profile
+
+# If the 'vi' symlink doees not exist, add it:
+if [ ! -e ${LIVE_ROOTDIR}/usr/bin/vi ]; then
+ if [ -x ${LIVE_ROOTDIR}/usr/bin/elvis ]; then
+ ln -s elvis ${LIVE_ROOTDIR}/usr/bin/vi
+ else
+ ln -s vim ${LIVE_ROOTDIR}/usr/bin/vi
+ fi
+fi
+
+# Add a screen configuration:
+cat <<"EOT" > ${LIVE_ROOTDIR}/etc/skel/.screenrc
+vbell on
+autodetach on
+startup_message off
+pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
+defscrollback 3000
+attrcolor b ".I"
+defbce "on"
+term xterm-256color
+shell -$SHELL
+
+# xterm:
+termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
+terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
+termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
+termcapinfo xterm* OL=10000
+termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
+termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
+termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
+termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
+termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
+termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
+termcapinfo xterm* be
+termcapinfo xterm* ti@:te@
+termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
+
+# vt100:
+termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
+terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
+termcapinfo linux C8
+
+# Tabbed colored hardstatus line
+hardstatus alwayslastline
+hardstatus string '%{= Kd} %{= Kd}%-w%{= Kr}[%{= KW}%n %t%{= Kr}]%{= Kd}%+w %-= %{KG} %H%{KW}|%{KY}%101`%{KW}|%D %M %d %Y%{= Kc} %C%A%{-}'
+# Hide hardstatus: ctrl-a f
+bind f eval "hardstatus ignore"
+# Show hardstatus: ctrl-a F
+bind F eval "hardstatus alwayslastline"
+EOT
+# Give root a copy:
+cat ${LIVE_ROOTDIR}/etc/skel/.screenrc > ${LIVE_ROOTDIR}/root/.screenrc
+
+if [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.networkmanager ]; then
+ # Enable NetworkManager if present:
+ chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.networkmanager
+ # And disable Slackware's own way of configuring eth0:
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/rc.d/rc.inet1.conf
+IFNAME[0]="eth0"
+IPADDR[0]=""
+NETMASK[0]=""
+USE_DHCP[0]=""
+DHCP_HOSTNAME[0]=""
+
+GATEWAY=""
+DEBUG_ETH_UP="no"
+EOT
+
+ # Ensure that NetworkManager uses its internal DHCP client - seems to give
+ # better compliancy:
+ sed -e "s/^dhcp=dhcpcd/#&/" -e "s/^#\(dhcp=internal\)/\1/" \
+ -i ${LIVE_ROOTDIR}/etc/NetworkManager/conf.d/00-dhcp-client.conf
+
+else
+ # Use Slackware's own network configuration routing for eth0 in base image:
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/rc.d/rc.inet1.conf
+IFNAME[0]="eth0"
+IPADDR[0]=""
+NETMASK[0]=""
+USE_DHCP[0]="yes"
+DHCP_HOSTNAME[0]="${LIVE_HOSTNAME}"
+
+GATEWAY=""
+DEBUG_ETH_UP="no"
+EOT
+fi
+
+# First disable any potentially incorrect mirror for slackpkg:
+sed -e "s/^ *\([^#]\)/#\1/" -i ${LIVE_ROOTDIR}/etc/slackpkg/mirrors
# Enable a Slackware mirror for slackpkg:
cat <<EOT >> ${LIVE_ROOTDIR}/etc/slackpkg/mirrors
#http://mirrors.slackware.com/slackware/slackware${DIRSUFFIX}-${SL_VERSION}/
@@ -1468,6 +2116,10 @@ EOT
echo "-- Creating slackpkg cache, takes a few seconds..."
chroot "${LIVE_ROOTDIR}" /bin/bash <<EOSL 2>${DBGOUT}
+# Rebuild SSL certificate database to prevent GPG verification errors
+# which are in fact triggered by SSL certificate errors:
+/usr/sbin/update-ca-certificates --fresh 1>/dev/null
+
if [ -f var/log/packages/slackpkg+-* ] ; then
cat <<EOPL > etc/slackpkg/slackpkgplus.conf
SLACKPKGPLUS=on
@@ -1478,23 +2130,23 @@ WGETOPTS="--timeout=20 --tries=2"
GREYLIST=on
PKGS_PRIORITY=( restricted alienbob ktown mate )
REPOPLUS=( slackpkgplus restricted alienbob ktown mate )
-MIRRORPLUS['slackpkgplus']=http://slakfinder.org/slackpkg+/
+MIRRORPLUS['slackpkgplus']=https://slackware.nl/slackpkgplus/
MIRRORPLUS['restricted']=http://slackware.nl/people/alien/restricted_sbrepos/${SL_VERSION}/${SL_ARCH}/
MIRRORPLUS['alienbob']=http://slackware.nl/people/alien/sbrepos/${SL_VERSION}/${SL_ARCH}/
MIRRORPLUS['mate']=http://slackware.uk/msb/${SL_VERSION}/latest/${SL_ARCH}/
#MIRRORPLUS['studioware']=http://slackware.uk/studioware/${SL_VERSION}/
EOPL
# Use the appropriate ktown variant:
- eval $( grep "^ *VARIANT=" ${LIVE_TOOLDIR}/pkglists/plasma5.conf)
- if [ "$VARIANT" = "latest" ]; then
+ eval $( grep "^ *VARIANT=" ${LIVE_TOOLDIR}/pkglists/ktown.conf)
+ if [ "$VARIANT" = "testing" ]; then
cat <<EOPL >> etc/slackpkg/slackpkgplus.conf
-#MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/
-MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/latest/${SL_ARCH}/
+#MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/latest/${SL_ARCH}/
+MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/
EOPL
else
cat <<EOPL >> etc/slackpkg/slackpkgplus.conf
-#MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/latest/${SL_ARCH}/
-MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/
+#MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/
+MIRRORPLUS['ktown']=http://slackware.nl/alien-kde/${SL_VERSION}/latest/${SL_ARCH}/
EOPL
fi
fi
@@ -1505,50 +2157,16 @@ if [ "${SL_VERSION}" = "current" ]; then
touch /var/lib/slackpkg/current
fi
-ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on update gpg
-ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on update
+ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on -default_answer=y update gpg
+ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on -default_answer=y update
# Let any lingering .new files replace their originals:
yes o | ARCH=${SL_ARCH} /usr/sbin/slackpkg new-config
EOSL
-if [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.networkmanager ]; then
- # Enable NetworkManager if present:
- chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.networkmanager
- # And disable Slackware's own way of configuring eth0:
- cat <<EOT > ${LIVE_ROOTDIR}/etc/rc.d/rc.inet1.conf
-IFNAME[0]="eth0"
-IPADDR[0]=""
-NETMASK[0]=""
-USE_DHCP[0]=""
-DHCP_HOSTNAME[0]=""
-
-GATEWAY=""
-DEBUG_ETH_UP="no"
-EOT
-
- # Ensure that NetworkManager uses its internal DHCP client - seems to give
- # better compliancy:
- sed -e "s/^dhcp=dhcpcd/#&/" -e "s/^#\(dhcp=internal\)/\1/" \
- -i ${LIVE_ROOTDIR}/etc/NetworkManager/NetworkManager.conf
-
-else
- # Use Slackware's own network configurion routing for eth0 in the base image:
- cat <<EOT > ${LIVE_ROOTDIR}/etc/rc.d/rc.inet1.conf
-IFNAME[0]="eth0"
-IPADDR[0]=""
-NETMASK[0]=""
-USE_DHCP[0]="yes"
-DHCP_HOSTNAME[0]="${LIVE_HOSTNAME}"
-
-GATEWAY=""
-DEBUG_ETH_UP="no"
-EOT
-fi
-
# Add our scripts to the Live OS:
mkdir -p ${LIVE_ROOTDIR}/usr/local/sbin
-install -m0755 ${LIVE_TOOLDIR}/makemod ${LIVE_TOOLDIR}/iso2usb.sh ${LIVE_TOOLDIR}/upslak.sh ${LIVE_ROOTDIR}/usr/local/sbin/
+install -m0755 ${LIVE_TOOLDIR}/makemod ${LIVE_TOOLDIR}/iso2usb.sh ${LIVE_TOOLDIR}/isocomp.sh ${LIVE_TOOLDIR}/upslak.sh ${LIVE_ROOTDIR}/usr/local/sbin/
# Add PXE Server infrastructure:
mkdir -p ${LIVE_ROOTDIR}/var/lib/tftpboot/pxelinux.cfg
@@ -1567,21 +2185,23 @@ cat ${LIVE_TOOLDIR}/pxeserver.tpl | sed \
-e "s/@LIVEDE@/$LIVEDE/g" \
-e "s/@LIVEMAIN@/$LIVEMAIN/g" \
-e "s/@MARKER@/$MARKER/g" \
+ -e "s/@KAPPEND@/$KAPPEND/g" \
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
> ${LIVE_ROOTDIR}/usr/local/sbin/pxeserver
chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/pxeserver
-# Only when we find a huge kernel, we will add a harddisk installer
-# to the ISO. The huge kernel does not require an initrd and installation
-# to the hard drive will not be complicated.
-if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then
- if [ -f ${DEF_SL_PKGROOT}/../isolinux/initrd.img ]; then
+# Add a harddisk installer to the ISO.
+# The huge kernel does not require an initrd and installation to the
+# hard drive will not be complicated, so a liveslak install is recommended
+# for newbies only if the ISO contains huge kernel...
+if [ -f ${DEF_SL_PKGROOT}/../isolinux/initrd.img ]; then
+ echo "-- Adding 'setup2hd' hard disk installer to /usr/share/${LIVEMAIN}/."
# Extract the 'setup' files we need from the Slackware installer
# and move them to a single directory in the ISO:
- mkdir -p ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}
+ mkdir -p ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}
cd ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}
- uncompressfs ${DEF_SL_PKGROOT}/../isolinux/initrd.img | cpio -i -d -H newc --no-absolute-filenames usr/lib/setup/* sbin/probe sbin/fixdate
+ uncompressfs ${DEF_SL_PKGROOT}/../isolinux/initrd.img | cpio -i -d -m -H newc usr/lib/setup/* sbin/probe sbin/fixdate
mv -i usr/lib/setup/* sbin/probe sbin/fixdate .
rm -r usr sbin
rm -f setup
@@ -1593,6 +2213,10 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then
-e 's, /mnt, ${T_PX},g' \
-e 's,=/mnt$,=${T_PX},g' \
-e 's,=/mnt/,=${T_PX}/,g'
+ # Allow a choice of dialog:
+ sed -i ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* \
+ -e '1a \\nDIALOG=${DIALOG:-dialog}\n' \
+ -e 's/dialog -/${DIALOG} -/'
# If T_PX is used in a script, it should be defined first:
for FILE in ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/* ; do
if grep -q T_PX $FILE ; then
@@ -1632,7 +2256,28 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then
fi
# Fix some occurrences of '/usr/lib/setup/' that are covered by $PATH:
sed -i -e 's,/usr/lib/setup/,,g' -e 's,:/usr/lib/setup,:/usr/share/${LIVEMAIN},g' ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/*
- # Add the Slackware Live HD installer:
+ # Prevent SeTconfig from asking redundant questions after a Live OS install:
+ sed -i ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/SeTconfig \
+ -e '/.\/var\/log\/setup\/$SCRIPT $T_PX $ROOT_DEVICE/i # Skip stuff that was taken care of by liveslak\nif [ -f $TMP/SeTlive ] && echo $SCRIPT |grep -qE "(make-bootdisk|mouse|setconsolefont|xwmconfig)"; then true; else' \
+ -e '/.\/var\/log\/setup\/$SCRIPT $T_PX $ROOT_DEVICE/a fi'
+ # Add the Slackware Live HD installer scripts:
+ for USCRIPT in SeTuacct SeTudiskpart SeTumedia SeTupass SeTpasswd SeTfirewall rc.firewall setup.liveslak setup.slackware ; do
+ cat ${LIVE_TOOLDIR}/setup2hd/${USCRIPT}.tpl | sed \
+ -e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \
+ -e "s/@DISTRO@/$DISTRO/g" \
+ -e "s/@CDISTRO@/${DISTRO^}/g" \
+ -e "s/@UDISTRO@/${DISTRO^^}/g" \
+ -e "s/@KVER@/$KVER/g" \
+ -e "s/@LIVEDE@/$LIVEDE/g" \
+ -e "s/@LIVEMAIN@/$LIVEMAIN/g" \
+ -e "s/@LIVEUID@/$LIVEUID/g" \
+ -e "s/@LIVEUIDNR@/$LIVEUIDNR/g" \
+ -e "s/@MARKER@/$MARKER/g" \
+ -e "s/@SL_VERSION@/$SL_VERSION/g" \
+ -e "s/@VERSION@/$VERSION/g" \
+ > ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${USCRIPT}
+ chmod 755 ${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/${USCRIPT}
+ done
mkdir -p ${LIVE_ROOTDIR}/usr/local/sbin
cat ${LIVE_TOOLDIR}/setup2hd.tpl | sed \
-e "s/@DIRSUFFIX@/$DIRSUFFIX/g" \
@@ -1642,15 +2287,17 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then
-e "s/@KVER@/$KVER/g" \
-e "s/@LIVEDE@/$LIVEDE/g" \
-e "s/@LIVEMAIN@/$LIVEMAIN/g" \
+ -e "s/@LIVEUID@/$LIVEUID/g" \
+ -e "s/@LIVEUIDNR@/$LIVEUIDNR/g" \
-e "s/@MARKER@/$MARKER/g" \
-e "s/@SL_VERSION@/$SL_VERSION/g" \
-e "s/@VERSION@/$VERSION/g" \
> ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd
chmod 755 ${LIVE_ROOTDIR}/usr/local/sbin/setup2hd
# Slackware Live HD post-install customization hook:
- if [ -f ${LIVE_TOOLDIR}/setup2hd.local ]; then
+ if [ -f ${LIVE_TOOLDIR}/setup2hd.local.tpl ]; then
# The '.local' suffix means: install it as a sample file only:
- HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.local"
+ HOOK_SRC="${LIVE_TOOLDIR}/setup2hd.local.tpl"
HOOK_DST="${LIVE_ROOTDIR}/usr/share/${LIVEMAIN}/setup2hd.$DISTRO.sample"
elif [ -f ${LIVE_TOOLDIR}/setup2hd.$DISTRO ]; then
# Install the hook; the file will be sourced by "setup2hd".
@@ -1672,7 +2319,6 @@ if ls ${LIVE_ROOTDIR}/boot/vmlinuz-huge-* 1>/dev/null 2>/dev/null; then
chmod 644 ${HOOK_DST}
else
echo "-- Could not find ${DEF_SL_PKGROOT}/../isolinux/initrd.img - not adding 'setup2hd'!"
- fi
fi
# Add the documentation:
@@ -1680,7 +2326,7 @@ mkdir -p ${LIVE_ROOTDIR}/usr/doc/liveslak-${VERSION}
install -m0644 ${LIVE_TOOLDIR}/README* ${LIVE_ROOTDIR}/usr/doc/liveslak-${VERSION}/
mkdir -p ${LIVE_ROOTDIR}/usr/doc/${DISTRO}${DIRSUFFIX}-${SL_VERSION}
install -m0644 \
- ${DEF_SL_PKGROOT}/../{CHANGES_AND_HINTS,COPY,README,RELEASE_NOTES,*HOWTO}* \
+ ${DEF_SL_PKGROOT}/../{ANNOUNCE,CHANGES_AND_HINTS,COPY,CRYPTO,README,RELEASE_NOTES,SPEAK,*HOWTO,UPGRADE}* \
${DEF_SL_PKGROOT}/../usb-and-pxe-installers/README* \
${LIVE_ROOTDIR}/usr/doc/${DISTRO}${DIRSUFFIX}-${SL_VERSION}/
@@ -1692,35 +2338,18 @@ echo "-- Configuring the X base system."
sed -i -e '/^c3\|^c4\|^c5\|^c6/s/^/# /' ${LIVE_ROOTDIR}/etc/inittab
# Give the 'live' user a face:
-cp ${LIVE_TOOLDIR}/blueSW-64px.png ${LIVE_ROOTDIR}/home/${LIVEUID}/.face.icon
+if [ -f "${LIVE_TOOLDIR}/media/${LIVEDE,,}/icons/default.png" ]; then
+ # Use custom face icon if available for the Live variant:
+ FACE_ICON="${LIVE_TOOLDIR}/media/${LIVEDE,,}/icons/default.png"
+else
+ # Use the default Slackware blue 'S':
+ FACE_ICON="${LIVE_TOOLDIR}/blueSW-64px.png"
+fi
+convert ${FACE_ICON} -resize 64x64 - >${LIVE_ROOTDIR}/home/${LIVEUID}/.face.icon
chown --reference=${LIVE_ROOTDIR}/home/${LIVEUID} ${LIVE_ROOTDIR}/home/${LIVEUID}/.face.icon
( cd ${LIVE_ROOTDIR}/home/${LIVEUID}/ ; ln .face.icon .face )
mkdir -p ${LIVE_ROOTDIR}/usr/share/apps/kdm/pics/users
-cp ${LIVE_TOOLDIR}/blueSW-64px.png ${LIVE_ROOTDIR}/usr/share/apps/kdm/pics/users/blues.icon
-
-# Add some convenience to the bash shell:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/
-cat << "EOT" > ${LIVE_ROOTDIR}/etc/skel/.profile
-# Source a .bashrc if it exists:
-[[ -r ~/.bashrc ]] && . ~/.bashrc
-
-# Define some useful aliases:
-alias ll="ls -la $LS_OPTIONS"
-lsp() { basename $(ls -1 "/var/log/packages/$@"*) ; }
-alias md="mkdir"
-alias tarview="tar -tvf"
-# GREP_OPTIONS="--color=auto" is deprecated, use alias to enable colored output:
-alias grep="grep --color=auto"
-alias fgrep="fgrep --color=auto"
-alias egrep="egrep --color=auto"
-
-# Ctrl-D should not log us off immediately; now it needs 10 times:
-set -o ignoreeof
-EOT
-
-# Do the root account the same favor:
-cat ${LIVE_ROOTDIR}/etc/skel/.profile > ${LIVE_ROOTDIR}/root/.profile
-chown root:root ${LIVE_ROOTDIR}/root/.profile
+convert ${FACE_ICON} -resize 64x64 - >${LIVE_ROOTDIR}/usr/share/apps/kdm/pics/users/blues.icon
# Give XDM a nicer look:
mkdir -p ${LIVE_ROOTDIR}/etc/X11/xdm/liveslak-xdm
@@ -1730,13 +2359,22 @@ sed -i ${LIVE_ROOTDIR}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/
# Adapt xdm configuration to target architecture:
sed -i "s/@LIBDIR@/lib${DIRSUFFIX}/g" ${LIVE_ROOTDIR}/etc/X11/xdm/liveslak-xdm/xdm-config
+# XDM needs a C preprocessor to calculate the login box position, and if
+# the ISO contains mcpp instead of the cpp contained in full gcc, we will
+# create a symlink (don't forget to install mcpp of course!):
+if [ ! -e ${LIVE_ROOTDIR}/usr/bin/cpp ] && [ -x ${LIVE_ROOTDIR}/usr/bin/mcpp ];
+then
+ ln -s mcpp ${LIVE_ROOTDIR}/usr/bin/cpp
+fi
+
# The Xscreensaver should show a blank screen only, to prevent errors about
# missing modules:
echo "mode: blank" > ${LIVE_ROOTDIR}/home/${LIVEUID}/.xscreensaver
-# Make the EmojiOne TTF font universally available:
-mkdir -p ${LIVE_ROOTDIR}/etc/fonts
-cat << EOT > ${LIVE_ROOTDIR}/etc/fonts/local.conf
+if [ -x ${LIVE_ROOTDIR}/usr/bin/fc-cache ]; then
+ # Make the EmojiOne TTF font universally available:
+ mkdir -p ${LIVE_ROOTDIR}/etc/fonts
+ cat << EOT > ${LIVE_ROOTDIR}/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to customize system font access -->
@@ -1745,7 +2383,62 @@ cat << EOT > ${LIVE_ROOTDIR}/etc/fonts/local.conf
<dir>/usr/lib${DIRSUFFIX}/firefox/fonts</dir>
</fontconfig>
EOT
-chroot ${LIVE_ROOTDIR} fc-cache -f
+ chroot ${LIVE_ROOTDIR} fc-cache -f
+fi
+
+# Allow direct scanning via xsane (no temporary intermediate files) in Gimp:
+if [ ! -L ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/gimp/2.0/plug-ins/xsane ]; then
+ mkdir -p ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/gimp/2.0/plug-ins
+ ln -s /usr/bin/xsane \
+ ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/gimp/2.0/plug-ins/xsane
+fi
+
+## Enable this only after we checked all dialog calls for compatibility ##
+## If Xdialog is installed, set DIALOG environment variable: ##
+mkdir -p ${LIVE_ROOTDIR}/etc/profile.d
+cat <<EOT > ${LIVE_ROOTDIR}/etc/profile.d/dialog.sh
+#!/bin/sh
+if [ -x /usr/bin/Xdialog ]; then
+ DIALOG=Xdialog
+ XDIALOG_HIGH_DIALOG_COMPAT=1
+ XDIALOG_FORCE_AUTOSIZE=1
+ export DIALOG XDIALOG_HIGH_DIALOG_COMPAT XDIALOG_FORCE_AUTOSIZE
+fi
+EOT
+cat <<EOT > ${LIVE_ROOTDIR}/etc/profile.d/dialog.csh
+#!/bin/csh
+if (-x /usr/bin/Xdialog) then
+ setenv DIALOG Xdialog
+ setenv XDIALOG_HIGH_DIALOG_COMPAT 1
+ setenv XDIALOG_FORCE_AUTOSIZE 1
+endif
+EOT
+# Once we are certain this works, make the scripts executable:
+chmod 0644 ${LIVE_ROOTDIR}/etc/profile.d/dialog.{c,}sh
+
+# Add a shortcut to 'setup2hd' on the user's desktop:
+mkdir -p ${LIVE_ROOTDIR}/usr/share/pixmaps
+install -m 0644 ${LIVE_TOOLDIR}/media/slackware/icons/graySW_512px.png \
+ ${LIVE_ROOTDIR}/usr/share/pixmaps/liveslak.png
+mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop
+cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/.directory
+[Desktop Entry]
+Encoding=UTF-8
+Icon=user-desktop
+Type=Directory
+EOT
+cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/setup2hd.desktop
+#!/usr/bin/env xdg-open
+[Desktop Entry]
+Type=Application
+Terminal=true
+Name=Install ${DISTRO^}
+Comment=Install ${DISTRO^} (live or regular) to Harddisk
+Icon=/usr/share/pixmaps/liveslak.png
+Exec=sudo -i /usr/local/sbin/setup2hd
+EOT
+# Let Plasma5 trust the desktop shortcut:
+chmod 0544 ${LIVE_ROOTDIR}/home/${LIVEUID}/Desktop/setup2hd.desktop
# -------------------------------------------------------------------------- #
@@ -1760,53 +2453,90 @@ for SKEL in ${LIVE_TOOLDIR}/skel/skel*.txz ; do
tar -xf ${SKEL} -C ${LIVE_ROOTDIR}/etc/skel/
done
-# -------------------------------------------------------------------------- #
-echo "-- Configuring KDE4."
-# -------------------------------------------------------------------------- #
-
-# Adjust some usability issues with the default desktop layout:
-if [ -f ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js ]; then
- # Only apply to an unmodified file (Slackware 14.2 already implements it):
- if grep -q 'tasks.writeConfig' ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js ; then
- sed -i \
- -e '/showActivityManager/a konsole = panel.addWidget("quicklaunch")' \
- -e '/showActivityManager/a dolphin = panel.addWidget("quicklaunch")' \
- -e '/showActivityManager/a firefox = panel.addWidget("quicklaunch")' \
- -e '$a firefox.writeConfig("iconUrls","file:///usr/share/applications/mozilla-firefox.desktop")' \
- -e '$a dolphin.writeConfig("iconUrls","file:////usr/share/applications/kde4/dolphin.desktop")' \
- -e '$a konsole.writeConfig("iconUrls","file:///usr/share/applications/kde4/konsole.desktop")' \
- -e '/tasks.writeConfig/d' \
- ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js
+if [ "$LIVEDE" = "XFCE" ]; then
+ # Since the XFCE ISO no longer has xpdf, use Firefox as the PDF viewer
+ # if that is present:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
+ if [ -f ${LIVE_ROOTDIR}/usr/bin/firefox ]; then
+ cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.config/mimeapps.list
+[Default Applications]
+application/pdf=mozilla-firefox.desktop
+EOF
+ else
+ # If firefox is not present, we hope that seamonkey is there;
+ # you won't have a PDF viewer in that case unfortunately, but you could
+ # download https://github.com/IsaacSchemm/pdf.js-seamonkey :
+ cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.config/mimeapps.list
+[Default Applications]
+x-scheme-handler/http=seamonkey.desktop
+x-scheme-handler/https=seamonkey.desktop
+x-scheme-handler/ftp=seamonkey.desktop
+x-scheme-handler/chrome=seamonkey.desktop
+x-scheme-handler/mailto=seamonkey-mail.desktop
+text/html=seamonkey.desktop
+
+[Added Associations]
+x-scheme-handler/http=xfce4-web-browser.desktop;seamonkey.desktop;
+x-scheme-handler/https=xfce4-web-browser.desktop;seamonkey.desktop;
+x-scheme-handler/ftp=seamonkey.desktop;
+x-scheme-handler/chrome=seamonkey.desktop;
+x-scheme-handler/mailto=seamonkey.desktop;
+text/html=seamonkey.desktop;
+EOF
fi
fi
-# Prepare some KDE4 defaults for the 'live' user and any new users.
-# Preselect the user 'live' in KDM:
-mkdir -p ${LIVE_ROOTDIR}/var/lib/kdm
-cat <<EOT > ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts
+# Only configure for KDE4 if it is actually installed:
+if [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/kde4/libexec ]; then
+
+ # -------------------------------------------------------------------------- #
+ echo "-- Configuring KDE4."
+ # -------------------------------------------------------------------------- #
+
+ # Adjust some usability issues with the default desktop layout:
+ if [ -f ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js ]; then
+ # Only apply to an unmodified file (Slackware 14.2 already implements it):
+ if grep -q 'tasks.writeConfig' ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js ; then
+ sed -i \
+ -e '/showActivityManager/a konsole = panel.addWidget("quicklaunch")' \
+ -e '/showActivityManager/a dolphin = panel.addWidget("quicklaunch")' \
+ -e '/showActivityManager/a firefox = panel.addWidget("quicklaunch")' \
+ -e '$a firefox.writeConfig("iconUrls","file:///usr/share/applications/mozilla-firefox.desktop")' \
+ -e '$a dolphin.writeConfig("iconUrls","file:////usr/share/applications/kde4/dolphin.desktop")' \
+ -e '$a konsole.writeConfig("iconUrls","file:///usr/share/applications/kde4/konsole.desktop")' \
+ -e '/tasks.writeConfig/d' \
+ ${LIVE_ROOTDIR}/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js
+ fi
+ fi
+
+ # Prepare some KDE4 defaults for the 'live' user and any new users.
+
+ # Preselect the user 'live' in KDM:
+ mkdir -p ${LIVE_ROOTDIR}/var/lib/kdm
+ cat <<EOT > ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts
[PrevUser]
:0=${LIVEUID}
EOT
-chmod 600 ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts
+ chmod 600 ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts
-# Set default GTK+ theme for Qt applications:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/
-cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.gtkrc-2.0
+ # Set default GTK+ theme for Qt applications:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/
+ cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.gtkrc-2.0
include "/usr/share/themes/Adwaita/gtk-2.0/gtkrc"
include "/usr/share/gtk-2.0/gtkrc"
include "/etc/gtk-2.0/gtkrc"
gtk-theme-name="Adwaita"
EOF
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config/gtk-3.0
-cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.config/gtk-3.0/settings.ini
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config/gtk-3.0
+ cat << EOF > ${LIVE_ROOTDIR}/etc/skel/.config/gtk-3.0/settings.ini
[Settings]
gtk-theme-name = Adwaita
EOF
-# Be gentle to low-performance USB media and limit disk I/O:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/config
-cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/config/nepomukserverrc
+ # Be gentle to low-performance USB media and limit disk I/O:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/config
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/config/nepomukserverrc
[Basic Settings]
Configured repositories=main
Start Nepomuk=false
@@ -1820,15 +2550,15 @@ Used Soprano Backend=redlandbackend
rebuilt index for type indexing=true
EOT
-# Disable baloo:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde4/share/apps/config
-cat <<EOT >${LIVE_ROOTDIR}/etc/skel/.kde4/share/apps/config/baloofilerc
+ # Disable baloo:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde4/share/apps/config
+ cat <<EOT >${LIVE_ROOTDIR}/etc/skel/.kde4/share/apps/config/baloofilerc
[Basic Settings]
Indexing-Enabled=false
EOT
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
-cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.config/kwalletrc
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.config/kwalletrc
[Auto Allow]
kdewallet=Network Management,KDE Daemon,KDE Control Module
@@ -1839,24 +2569,24 @@ First Use=true
Use One Wallet=true
EOT
-# Start Konsole with a login shell:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/apps/konsole
-cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/apps/konsole/Shell.profile
+ # Start Konsole with a login shell:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/apps/konsole
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/apps/konsole/Shell.profile
[General]
Command=/bin/bash -l
Name=Shell
Parent=FALLBACK/
EOT
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
-cat <<EOT >> ${LIVE_ROOTDIR}/etc/skel/.config/konsolerc
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
+ cat <<EOT >> ${LIVE_ROOTDIR}/etc/skel/.config/konsolerc
[Desktop Entry]
DefaultProfile=Shell.profile
EOT
-# Configure (default) UTC timezone so we can change it during boot:
-mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/config
-cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/config/ktimezonedrc
+ # Configure (default) UTC timezone so we can change it during boot:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.kde/share/config
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.kde/share/config/ktimezonedrc
[TimeZones]
LocalZone=UTC
ZoneinfoDir=/usr/share/zoneinfo
@@ -1864,21 +2594,45 @@ Zonetab=/usr/share/zoneinfo/zone.tab
ZonetabCache=
EOT
-if [ "$LIVEDE" = "PLASMA5" ]; then
+fi # End KDE4
+
+
+# Only configure for KDE Plasma if it is actually installed:
+if [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/libexec/kf5 ] || [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/libexec/kf6 ] ; then
# -------------------------------------------------------------------------- #
- echo "-- Configuring PLASMA5."
+ echo "-- Configuring Plasma Desktop."
# -------------------------------------------------------------------------- #
+ # This section is for any Plasma based variant.
+
+ # Install a custom login/desktop/lock background if an image is present:
+ plasma5_custom_bg
+
# Remove the confusing openbox session if present:
rm -f ${LIVE_ROOTDIR}/usr/share/xsessions/openbox-session.desktop || true
# Remove the buggy mediacenter session:
rm -f ${LIVE_ROOTDIR}/usr/share/xsessions/plasma-mediacenter.desktop || true
- # Remove non-functional wayland session:
+ # Remove non-functional Qt5 wayland session:
if [ ! -f ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/qt5/bin/qtwaylandscanner ];
then
rm -f ${LIVE_ROOTDIR}/usr/share/wayland-sessions/plasmawayland.desktop || true
fi
+
+ # Remove broken/unwanted shortcuts (discover and konqueror) from taskbar:
+ sed -i ${LIVE_ROOTDIR}/usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/config/main.xml \
+ -e 's#,applications:org.kde.discover.desktop##' \
+ -e s'#,preferred://browser##'
+
+ # Set the OS name to "Slackware Live" in "System Information":
+ echo "Name=${DISTRO^} Live" >> ${LIVE_ROOTDIR}/etc/kde/xdg/kcm-about-distrorc
+ # Use os-release's VERSION (default=false means: use VERSION_ID)
+ echo "UseOSReleaseVersion=true" >> ${LIVE_ROOTDIR}/etc/kde/xdg/kcm-about-distrorc
+ if [ "${SL_VERSION}" = "current" ]; then
+ # Some more detail on development release:
+ echo "Variant=Post-stable development (-current)" >> ${LIVE_ROOTDIR}/etc/kde/xdg/kcm-about-distrorc
+ fi
+
# Set sane SDDM defaults on first boot (root-owned file):
mkdir -p ${LIVE_ROOTDIR}/var/lib/sddm
cat <<EOT > ${LIVE_ROOTDIR}/var/lib/sddm/state.conf
@@ -1905,13 +2659,25 @@ EOT
super-user-command=sudo
KDESU_EOF
+ # For the above to work in Plasma with newer versions of sudo (since 2022),
+ # we need the following also. KDE fixed this in git on 04-aug-2023, see
+ # https://bugs.kde.org/show_bug.cgi?id=452532 but it does not hurt to have
+ # it here, and it helps to support older KDE releases:
+ if [ -x ${LIVE_ROOTDIR}/usr/lib*/libexec/kf5/kdesu_stub ]; then
+ mkdir -p ${LIVE_ROOTDIR}/etc/sudoers.d
+ chmod 750 ${LIVE_ROOTDIR}/etc/sudoers.d
+ cat <<KDESU_EOF2 >${LIVE_ROOTDIR}/etc/sudoers.d/kdesu
+Defaults!/usr/lib*/libexec/kf5/kdesu_stub !use_pty
+KDESU_EOF2
+ fi
+
# Set akonadi backend:
cat <<AKONADI_EOF >${LIVE_ROOTDIR}/etc/skel/.config/akonadi/akonadiserverrc
[%General]
Driver=QSQLITE
[QSQLITE]
-Name=/home/live/.local/share/akonadi/akonadi.db
+Name=/home/${LIVEUID}/.local/share/akonadi/akonadi.db
AKONADI_EOF
# Disable baloo:
@@ -1933,6 +2699,30 @@ alreadyMigrated=true
KWALLET_EOL
+ # Start Konsole with a login shell:
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.local/share/konsole
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/skel/.local/share/konsole/Shell.profile
+[Appearance]
+ColorScheme=BlackOnWhite
+
+[General]
+Command=/bin/bash -l
+Name=Shell
+Parent=FALLBACK/
+TerminalColumns=80
+TerminalRows=25
+
+[Interaction Options]
+AutoCopySelectedText=true
+TrimTrailingSpacesInSelectedText=true
+EOT
+ mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
+ cat <<EOT >> ${LIVE_ROOTDIR}/etc/skel/.config/konsolerc
+[Desktop Entry]
+DefaultProfile=Shell.profile
+
+EOT
+
# Configure (default) UTC timezone so we can change it during boot:
mkdir -p ${LIVE_ROOTDIR}/etc/skel/.config
cat <<EOTZ > ${LIVE_ROOTDIR}/etc/skel/.config/ktimezonedrc
@@ -1943,8 +2733,9 @@ Zonetab=/usr/share/zoneinfo/zone.tab
EOTZ
# Make sure that Plasma and SDDM work on older GPUs,
- # by forcing Qt5 to use software GL rendering:
- cat <<"EOGL" >> ${LIVE_ROOTDIR}/usr/share/sddm/scripts/Xsetup
+ # by forcing Qt to use software GL rendering:
+ if ! grep -q QT_XCB_FORCE_SOFTWARE_OPENGL ${LIVE_ROOTDIR}/usr/share/sddm/scripts/Xsetup ; then
+ cat <<"EOGL" >> ${LIVE_ROOTDIR}/usr/share/sddm/scripts/Xsetup
OPENGL_VERSION=$(LANG=C glxinfo |grep '^OpenGL version string: ' |head -n 1 |sed -e 's/^OpenGL version string: \([0-9]\).*$/\1/g')
if [ "$OPENGL_VERSION" -lt 2 ]; then
@@ -1953,11 +2744,24 @@ if [ "$OPENGL_VERSION" -lt 2 ]; then
fi
EOGL
+ fi
+
+ # Make Wayland instead of X11 the default for SDDM;
+ # leave commented-out for now:
+ mkdir -p ${LIVE_ROOTDIR}/etc/sddm.conf.d
+ cat << EOW > ${LIVE_ROOTDIR}/etc/sddm.conf.d/plasma-wayland.conf
+#[General]
+#DisplayServer=wayland
+#GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
+#
+#[Wayland]
+#CompositorCommand=kwin_wayland --drm --inputmethod qtvirtualkeyboard --no-global-shortcuts --no-lockscreen --locale1
+EOW
# Workaround a bug where SDDM does not always use the configured keymap:
echo "setxkbmap" >> ${LIVE_ROOTDIR}/usr/share/sddm/scripts/Xsetup
- # Do not show the blueman applet, Plasma5 has its own BlueTooth widget:
+ # Do not show the blueman applet, Plasma has its own BlueTooth widget:
echo "NotShowIn=KDE;" >> ${LIVE_ROOTDIR}/etc/xdg/autostart/blueman.desktop
# Set QtWebkit as the Konqueror rendering engine if available:
@@ -1971,7 +2775,57 @@ text/html=kwebkitpart.desktop;
EOT
fi
-fi # End LIVEDE = PLASMA5
+ # Requirement for Plasma Wayland sessions:
+ mkdir -p ${LIVE_ROOTDIR}/etc/profile.d
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/profile.d/kwayland.sh
+#!/bin/sh
+# Force the usage of XCB platform on Qt applications:
+export QT_QPA_PLATFORM=xcb
+# Force the usage of X11 platform for GDK applications:
+export GDK_BACKEND=x11
+EOT
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/profile.d/kwayland.csh
+#!/bin/csh
+# Force the usage of XCB platform on Qt applications:
+setenv QT_QPA_PLATFORM xcb
+# Force the usage of X11 platform for GDK applications:
+setenv GDK_BACKEND x11
+EOT
+ chmod 755 ${LIVE_ROOTDIR}/etc/profile.d/kwayland.*
+
+# Ensure that color Emojis work in Qt applications:
+mkdir -p ${LIVE_ROOTDIR}/usr/share/fontconfig/conf.avail
+cat <<EOT >${LIVE_ROOTDIR}/usr/share/fontconfig/conf.avail/99-noto-mono-color-emoji.conf:
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <alias>
+ <family>serif</family>
+ <prefer>
+ <family>Noto Color Emoji</family>
+ </prefer>
+ </alias>
+ <alias>
+ <family>sans-serif</family>
+ <prefer>
+ <family>Noto Color Emoji</family>
+ </prefer>
+ </alias>
+ <alias>
+ <family>monospace</family>
+ <prefer>
+ <family>Noto Color Emoji</family>
+ </prefer>
+ </alias>
+</fontconfig>
+EOT
+
+ if [ "$LIVEDE" = "DAW" ] || [ "$LIVEDE" = "LEAN" ]; then
+ # These lean installations do not support Wayland graphical sessions:
+ rm -rf ${LIVE_ROOTDIR}/usr/share/wayland-sessions
+ fi
+
+fi # End Plasma
if [ "$LIVEDE" = "DLACK" ]; then
@@ -1996,6 +2850,133 @@ if [ "$LIVEDE" = "DLACK" ]; then
fi # End LIVEDE = DLACK
+if [ "$LIVEDE" = "DAW" ]; then
+
+ # -------------------------------------------------------------------------- #
+ echo "-- Configuring DAW."
+ # -------------------------------------------------------------------------- #
+
+ # Stream ALSA through Pulse and all through Jack. This is achieved by
+ # having pulseaudio-jack module installed and starting jack-dbus:
+
+ # We default to using a 48000 Hz sample rate throughout, assuming that
+ # modern sound hardware will support this, and it lowers the latency:
+ if [ -f ${LIVE_ROOTDIR}/etc/pulse/daemon.conf ]; then
+ cat <<EOT >> ${LIVE_ROOTDIR}/etc/pulse/daemon.conf
+; Run 'pulseaudio --dump-resample-methods' for all possible options.
+; We want higher-quality resampling than the default:
+resample-method = speex-float-9
+; Jack is configured for 48KHz so let's make pulseaudio use it too:
+default-sample-rate = 48000
+alternate-sample-rate = 44100
+EOT
+ fi
+
+ mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/rncbc.org
+ cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/rncbc.org/QjackCtl.conf
+[Options]
+DBusEnabled=true
+GraphButton=true
+JackDBusEnabled=true
+KeepOnTop=false
+PostShutdownScript=true
+PostShutdownScriptShell=killall a2jmidid &
+PostStartupScript=true
+PostStartupScriptShell=/usr/bin/a2jmidid -e &
+ServerConfig=true
+ServerConfigName=.jackdrc
+ShutdownScript=false
+ShutdownScriptShell=
+Singleton=true
+StartJack=true
+StartMinimized=true
+StartupScript=false
+StartupScriptShell=
+StopJack=true
+SystemTray=true
+SystemTrayQueryClose=false
+XrunRegex=xrun of at least ([0-9|\\.]+) msecs
+
+[Presets]
+DefPreset=(default)
+
+[Settings]
+Driver=alsa
+Frames=256
+MidiDriver=seq
+Periods=2
+PortMax=256
+Priority=5
+Realtime=true
+SampleRate=48000
+Server=jackd
+StartDelay=2
+Sync=true
+EOT
+
+ # Add a default jackd configuration:
+ cat <<EOT > ${LIVE_ROOTDIR}/home/${LIVEUID}/.jackdrc
+/usr/bin/jackd -dalsa -dhw:0 -r48000 -p1024 -n2
+EOT
+
+ # Autostart qjackctl:
+ mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/autostart
+ if [ -f ${LIVE_ROOTDIR}/usr/share/applications/org.rncbc.qjackctl.desktop ]; then
+ QJCDF=/usr/share/applications/org.rncbc.qjackctl.desktop
+ else
+ QJCDF=/usr/share/applications/qjackctl.desktop
+ fi
+ cp -a ${LIVE_ROOTDIR}/${QJCDF} \
+ ${LIVE_ROOTDIR}/home/${LIVEUID}/.config/autostart/
+
+ # Add all our programs into their own submenu Applications>Multimedia>DAW
+ # to avoid clutter in the Multimedia menu. We will use a custom category
+ # "X-DAW" to decide what goes into the new submenu.
+ # Also move the X42 and LSP Plugin submenus below the new DAW submenu.
+ # see https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html
+ # We overwrite the menu entries from the 'daw_base' package,
+ # since we want the slightly different liveslak contents instead:
+ install -Dm 644 ${LIVE_TOOLDIR}/media/${LIVEDE,,}/menu/liveslak-daw.menu \
+ $LIVE_ROOTDIR/etc/xdg/menus/applications-merged/${DISTRO}-daw.menu
+ install -Dm 644 \
+ ${LIVE_TOOLDIR}/media/${LIVEDE,,}/menu/liveslak-daw.directory \
+ $LIVE_ROOTDIR/usr/share/desktop-directories/liveslak-daw.directory
+ install -Dm 644 ${LIVE_TOOLDIR}/media/${LIVEDE,,}/menu/liveslak-daw.png \
+ -t $LIVE_ROOTDIR/usr/share/icons/hicolor/512x512/apps/
+
+ # Any menu entry that does not yet have a Category "X-DAW" will now have to
+ # get that added so that our mew submenu will be populated:
+ for DAWPKG in $(cat ${LIVE_TOOLDIR}/pkglists/z03_daw.lst |grep -v x42 |grep -Ev '(^ *#)' ) ; do
+ # Find the installed full package name belonging to the DAW package:
+ PKGINST=$( ls -1 ${LIVE_ROOTDIR}/var/log/packages/${DAWPKG}* 2>/dev/null |grep -E "/var/log/packages/${DAWPKG}-[^-]+-[^-]+-[^-]+$" || true)
+ if [ -n "${PKGINST}" ]; then
+ for DESKTOPF in $(grep 'usr/share/applications/.*.desktop' ${PKGINST})
+ do
+ if ! grep -q X-DAW ${LIVE_ROOTDIR}/${DESKTOPF} ; then
+ sed -i ${LIVE_ROOTDIR}/${DESKTOPF} \
+ -e "s/^Categories=\(.*\)/Categories=X-DAW;\1/"
+ fi
+ ## Hide the application in Multimedia (which is based on the AudioVideo
+ ## category) to prevent them from getting listed twice:
+ #sed -i ${LIVE_ROOTDIR}/${DESKTOPF} -e "/^Categories=/s/AudioVideo;//"
+ done
+ fi
+ done
+
+ # VCV Rack plugins need to be linked into the user-directory to be seen:
+ mkdir -p ${LIVE_ROOTDIR}/home/${LIVEUID}/.Rack/plugins-v1
+ for PLUGIN in $(find ${LIVE_ROOTDIR}/usr/share/vcvrack/ -type f -name "*.zip" -mindepth 1 -maxdepth 1); do
+ ln -s /usr/share/vcvrack/$(basename ${PLUGIN}) ${LIVE_ROOTDIR}/home/${LIVEUID}/.Rack/plugins-v1/
+ done
+
+ # The new Kickoff application launcher that replaced the old Kickoff,
+ # does not adhere to the XDG Desktop standards.
+ # Therefore we will switch the DAW desktop to Kicker instead, to preserve
+ # our 'Slackware DAW' menu structure in the 'Multimedia' menu:
+ sed -e 's/kickoff/kicker/g' -i ${LIVE_ROOTDIR}/usr/share/plasma/layout-templates/org.kde.plasma.desktop.defaultPanel/contents/layout.js
+
+fi # End LIVEDE = DAW
+
if [ "$LIVEDE" = "STUDIOWARE" ]; then
# -------------------------------------------------------------------------- #
@@ -2005,18 +2986,42 @@ if [ "$LIVEDE" = "STUDIOWARE" ]; then
# Create group and user for the Avahi service:
chroot ${LIVE_ROOTDIR} /usr/sbin/groupadd -g 214 avahi
chroot ${LIVE_ROOTDIR} /usr/sbin/useradd -c "Avahi Service Account" -u 214 -g 214 -d /dev/null -s /bin/false avahi
- echo "avahi:$(openssl rand -base64 12)" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+ if ! echo "avahi:$(openssl rand -base64 12)" | /usr/sbin/chpasswd -R ${LIVE_ROOTDIR} 2>/dev/null ; then
+ echo "avahi:$(openssl rand -base64 12)" | chroot ${LIVE_ROOTDIR} /usr/sbin/chpasswd
+ fi
-fi # End LIVEDE = STUDIOWARE
+fi # End LIVEDE = STUDIOWARE
-if [ "$LIVEDE" = "PLASMA5" -o "$LIVEDE" = "STUDIOWARE" ]; then
+if [ "$LIVEDE" = "DAW" -o "$LIVEDE" = "STUDIOWARE" ];
+then
# -------------------------------------------------------------------------- #
- echo "-- Configuring $LIVEDE (RT beaviour)."
+ echo "-- Configuring $LIVEDE (RT behaviour)."
# -------------------------------------------------------------------------- #
+ # Install real-time configuration in case the OS-installed packages
+ # have not yet done this for us ('daw_base' for instance).
+ # The script looks for specific filenames as used in 'daw_base':
+ # /etc/security/limits.d/rt_audio.conf
+ # /etc/sysctl.d/daw.conf
+ # /etc/udev/rules.d/40-timer-permissions.rules
+
# RT Scheduling and Locked Memory:
- cat << "EOT" > ${LIVE_ROOTDIR}/etc/initscript
+ # Implementation depends on whether PAM is installed:
+ if [ -L ${LIVE_ROOTDIR}/lib${DIRSUFFIX}/libpam.so.? ]; then
+ if [ ! -f ${LIVE_ROOTDIR}/etc/security/limits.d/rt_audio.conf ]; then
+ # On PAM based OS, allow user in 'audio' group to invoke rt capability:
+ mkdir -p ${LIVE_ROOTDIR}/etc/security/limits.d
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/security/limits.d/rt_audio.conf
+# Realtime capability allowed for user in the 'audio' group:
+# Use 'unlimited' with care, you can lock up your system when app misbehaves:
+#@audio - memlock 2097152
+@audio - memlock unlimited
+@audio - rtprio 95
+EOT
+ fi
+ else
+ cat << "EOT" > ${LIVE_ROOTDIR}/etc/initscript
# Set umask to safe level:
umask 022
# Disable core dumps:
@@ -2024,13 +3029,46 @@ ulimit -c 0
# Allow unlimited size to be locked into memory:
ulimit -l unlimited
# Address issue of jackd failing to start with realtime scheduling:
-ulimit -r 65
+ulimit -r 95
# Execute the program.
eval exec "$4"
EOT
+ chmod +x ${LIVE_ROOTDIR}/etc/initscript
+ fi
+
+ if [ ! -f ${LIVE_ROOTDIR}/etc/udev/rules.d/40-timer-permissions.rules ]; then
+ # Allow access for 'audio' group to the high precision event timer,
+ # which may benefit a DAW which relies on ALSA MIDI;
+ # Also grant write access to /dev/cpu_dma_latency to prevent CPU's
+ # from going into idle state:
+ mkdir -p ${LIVE_ROOTDIR}/etc/udev/rules.d
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/udev/rules.d/40-timer-permissions.rules
+KERNEL=="rtc0", GROUP="audio"
+KERNEL=="hpet", GROUP="audio"
+KERNEL=="cpu_dma_latency", GROUP="audio"
+EOT
+ fi
+
+ if [ ! -f ${LIVE_ROOTDIR}/etc/sysctl.d/daw.conf ]; then
+ # Audio related sysctl settings for better realtime performance:
+ mkdir -p ${LIVE_ROOTDIR}/etc/sysctl.d
+ cat <<EOT > ${LIVE_ROOTDIR}/etc/sysctl.d/daw.conf
+# https://wiki.linuxaudio.org/wiki/system_configuration
+dev.hpet.max-user-freq = 3072
+fs.inotify.max_user_watches = 524288
+vm.swappiness = 10
+EOT
+ fi
+
+ # # This would benefit a DAW, but if the user runs the Live OS on a laptop,
+ # # she might want to decide about this herself:
+ # mkdir -p ${LIVE_ROOTDIR}/etc/default
+ #cat <<EOT > ${LIVE_ROOTDIR}/etc/default/cpufreq
+ #SCALING_GOVERNOR=performance
+ #EOT
-fi # End LIVEDE = PLASMA5/STUDIOWARE
+fi # End LIVEDE = DAW/STUDIOWARE
# You can define the function 'custom_config()' by uncommenting it in
# the configuration file 'make_slackware_live.conf'.
@@ -2143,18 +3181,14 @@ echo "-- Tweaking system startup."
# -------------------------------------------------------------------------- #
# Configure the default DE when running startx:
-if [ "$LIVEDE" = "SLACKWARE" ]; then
- ln -sf xinitrc.kde ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
-elif [ "$LIVEDE" = "KDE4" ]; then
- ln -sf xinitrc.kde ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
-elif [ "$LIVEDE" = "PLASMA5" ]; then
- ln -sf xinitrc.plasma ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
-elif [ "$LIVEDE" = "MATE" ]; then
+if [ "$LIVEDE" = "MATE" ]; then
ln -sf xinitrc.mate-session ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
elif [ "$LIVEDE" = "CINNAMON" ]; then
ln -sf xinitrc.cinnamon-session ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
elif [ "$LIVEDE" = "DLACK" ]; then
ln -sf xinitrc.gnome ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
+elif [ -f ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc.kde ]; then
+ ln -sf xinitrc.kde ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
elif [ -f ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc.xfce ]; then
ln -sf xinitrc.xfce ${LIVE_ROOTDIR}/etc/X11/xinit/xinitrc
fi
@@ -2171,8 +3205,12 @@ sed -i ${LIVE_ROOTDIR}/etc/inittab -e "s/\(id:\).\(:initdefault:\)/\1${RUNLEVEL}
# But enable NFS client support and CUPS:
[ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.rpc ] && chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.rpc
-[ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.cups ] && chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.cups
-[ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.cups-browsed ] && chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.cups-browsed
+if [ -x ${LIVE_ROOTDIR}/usr/sbin/cupsd ] && [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.cups ]; then
+ chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.cups
+fi
+if [ -x ${LIVE_ROOTDIR}/usr/sbin/cupsd ] && [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.cups-browsed ]; then
+ chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.cups-browsed
+fi
# Add a softvol pre-amp to ALSA - some computers have too low volumes.
# If etc/asound.conf exists it's configuring ALSA to use Pulse,
@@ -2207,12 +3245,14 @@ touch ${LIVE_ROOTDIR}/etc/fastboot
# We will not write to the hardware clock:
sed -i -e '/systohc/s/^/# /' ${LIVE_ROOTDIR}/etc/rc.d/rc.6
+# Don't try to re-mount our squashfs and overlay filesystems:
+sed -e 's/^ *SKIPFS="no/&squashfs,nooverlay,no/' \
+ -i ${LIVE_ROOTDIR}/etc/rc.d/rc.S
+
# Run some package setup scripts (usually run by the slackware installer),
# as well as some of the delaying commands in rc.M and rc.modules:
-chroot ${LIVE_ROOTDIR} /bin/bash <<EOCR
-# Rebuild SSL certificate database:
-/usr/sbin/update-ca-certificates --fresh 1>/dev/null 2>${DBGOUT}
+chroot ${LIVE_ROOTDIR} /bin/bash <<EOCR
# Run bits from rc.M so we won't need to run them again in the live system:
/sbin/depmod $KVER
/sbin/ldconfig
@@ -2276,37 +3316,32 @@ sed -e "s% /usr/bin/update.*verbose%#&%" -i ${LIVE_ROOTDIR}/etc/rc.d/rc.M
sed -e '/^ *\/usr\/bin\/glib-c/ s, /usr/bin/glib-c,#&,' -i ${LIVE_ROOTDIR}/etc/rc.d/rc.M
sed -e "s% /sbin/depmod -%#&%" -i ${LIVE_ROOTDIR}/etc/rc.d/rc.modules
-# If we detect a NVIDIA driver, then run the nvidia install routine:
+# Start/stop the NVIDIA persistence daemon if a NVIDIA driver is loaded;
+# Note that this assumes the nvidia-driver and nvidia-kernel packages
+# from slackbuilds.org are being used:
cat <<EOT >> ${LIVE_ROOTDIR}/etc/rc.d/rc.local
-# Deal with the presence of NVIDIA drivers:
-if [ -x /usr/sbin/nvidia-switch ]; then
- if [ -f /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so.*-nvidia -a -f /usr/lib${DIRSUFFIX}/xorg/modules/drivers/nvidia_drv.so ]; then
- echo "-- Installing binary Nvidia drivers: /usr/sbin/nvidia-switch --install"
- /usr/sbin/nvidia-switch --install
- fi
- # For CUDA/OpenCL to work after reboot, create missing nvidia device nodes:
+# For CUDA/OpenCL to work after reboot, create missing nvidia device nodes:
+if [ -x /usr/bin/nvidia-modprobe ]; then
+ echo "Creating missing nvidia device nodes..."
/usr/bin/nvidia-modprobe -c 0 -u
-else
- # Take care of a reboot where nvidia drivers disappeared
- # afer being used earlier, by restoring the original libraries:
- if ls /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so-xorg 1>/dev/null 2>/dev/null ; then
- mv /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so{-xorg,} 2>/dev/null
- mv /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.la{-xorg,} 2>/dev/null
- fi
- if ls /usr/lib${DIRSUFFIX}/libGL.so.*-xorg 1>/dev/null 2>/dev/null ; then
- LIBGL=\$(ls -1 /usr/lib${DIRSUFFIX}/libGL.so.*-xorg |rev |cut -d/ -f1 |cut -d- -f2- |rev)
- mv /usr/lib${DIRSUFFIX}/\${LIBGL}-xorg /usr/lib${DIRSUFFIX}/\${LIBGL} 2>/dev/null
- ln -sf \${LIBGL} /usr/lib${DIRSUFFIX}/libGL.so.1 2>/dev/null
- ln -sf \${LIBGL} /usr/lib${DIRSUFFIX}/libGL.so 2>/dev/null
- mv /usr/lib${DIRSUFFIX}/libGL.la-xorg /usr/lib${DIRSUFFIX}/libGL.la 2>/dev/null
- fi
- if ls /usr/lib${DIRSUFFIX}/libEGL.so.*-xorg 1>/dev/null 2>/dev/null ; then
- LIBEGL=\$(ls -1 /usr/lib${DIRSUFFIX}/libEGL.so.*-xorg |rev |cut -d/ -f1 |cut -d- -f2- |rev)
- mv /usr/lib${DIRSUFFIX}/\${LIBEGL}-xorg /usr/lib${DIRSUFFIX}/\${LIBEGL} 2>/dev/null
- ln -sf \${LIBEGL} /usr/lib${DIRSUFFIX}/libEGL.so.1 2>/dev/null
- ln -sf \${LIBEGL} /usr/lib${DIRSUFFIX}/libEGL.so 2>/dev/null
- fi
+fi
+
+# Start the nvidia-persistenced daemon:
+if [ -x /etc/rc.d/rc.nvidia-persistenced ] && [ -d /var/run/nvidia-persistenced ]; then
+ echo "Starting nvidia persistence daemon..."
+ sed -e "s/NVPD_USER=.*/NVPD_USER=${NVUID}/" -i /etc/rc.d/rc.nvidia-persistenced
+ chown ${NVUID}:${NVGRP} /var/run/nvidia-persistenced 2>/dev/null
+ /etc/rc.d/rc.nvidia-persistenced start
+fi
+EOT
+
+cat <<EOT >> ${LIVE_ROOTDIR}/etc/rc.d/rc.local_shutdown
+
+# Stop the nvidia-persistenced daemon:
+if [ -x /etc/rc.d/rc.nvidia-persistenced ]; then
+ echo "Stopping nvidia persistence daemon..."
+ /etc/rc.d/rc.nvidia-persistenced stop
fi
EOT
@@ -2324,6 +3359,10 @@ if [ -x ${LIVE_ROOTDIR}/etc/cron.daily/mlocate ]; then
else
LOCATE_BIN=slocate
fi
+# Mlocate needs a mounted /proc in the chroot:
+if ! mount | grep -q 'on ${LIVE_ROOTDIR}/proc' ; then
+ mount --bind /proc ${LIVE_ROOTDIR}/proc
+fi
chroot ${LIVE_ROOTDIR} /etc/cron.daily/${LOCATE_BIN} 2>${DBGOUT}
# -----------------------------------------------------------------------------
@@ -2331,7 +3370,7 @@ chroot ${LIVE_ROOTDIR} /etc/cron.daily/${LOCATE_BIN} 2>${DBGOUT}
# -----------------------------------------------------------------------------
# Squash the configuration into its own module:
-umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
mksquashfs ${INSTDIR} ${LIVE_MOD_SYS}/0099-${DISTRO}_zzzconf-${SL_VERSION}-${SL_ARCH}.sxz -noappend -comp ${SQ_COMP} ${SQ_COMP_PARAMS}
rm -rf ${INSTDIR}/*
@@ -2351,7 +3390,7 @@ unset INSTDIR
# -----------------------------------------------------------------------------
echo "-- Preparing the system for live booting."
-umount ${LIVE_ROOTDIR} 2>${DBGOUT} || true
+umount -R ${LIVE_ROOTDIR} 2>${DBGOUT} || true
mount -t overlay -o lowerdir=${RODIRS%:*},upperdir=${LIVE_BOOT},workdir=${LIVE_OVLDIR} overlay ${LIVE_ROOTDIR}
mount --bind /proc ${LIVE_ROOTDIR}/proc
@@ -2367,6 +3406,10 @@ else
KVER=$(ls --indicator-style=none ${LIVE_ROOTDIR}/lib/modules/ |grep smp |head -1)
fi
+# Determine Slackware's GRUB version and build (we will use this later):
+GRUBVER=$(find ${DEF_SL_PKGROOT}/../ -name "grub-*.t?z" |rev |cut -d- -f3 |rev)
+GRUBBLD=$(find ${DEF_SL_PKGROOT}/../ -name "grub-*.t?z" |rev |cut -d- -f1 |cut -d. -f2 |rev)
+
# Create an initrd for the generic kernel, using a modified init script:
echo "-- Creating initrd for kernel-generic $KVER ..."
chroot ${LIVE_ROOTDIR} /sbin/mkinitrd -c -w ${WAIT} -l us -o /boot/initrd_${KVER}.img -k ${KVER} -m ${KMODS} -L -C dummy 1>${DBGOUT} 2>${DBGOUT}
@@ -2382,7 +3425,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" \
@@ -2397,49 +3441,49 @@ tar -C ${LIVE_ROOTDIR}/boot/initrd-tree/ -xf ${DHCPD_PKG} \
var/lib/dhcpcd lib/dhcpcd sbin/dhcpcd usr/lib${DIRSUFFIX}/dhcpcd \
etc/dhcpcd.conf.new
mv ${LIVE_ROOTDIR}/boot/initrd-tree/etc/dhcpcd.conf{.new,}
+# Create the dhcpcd account because we added the package to the initrd:
+if ! grep -q dhcpcd ${LIVE_ROOTDIR}/boot/initrd-tree/etc/passwd; then
+ echo "dhcpcd:x:68:68:User for dhcpcd:/var/lib/dhcpcd:/bin/false" >> ${LIVE_ROOTDIR}/boot/initrd-tree/etc/passwd
+ echo "dhcpcd:x:68:" >> ${LIVE_ROOTDIR}/boot/initrd-tree/etc/group
+fi
+
+# Add getfattr to read extended attributes (even if we won't need it):
+ATTR_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "attr-*.t?z" |head -1)
+tar --wildcards -C ${LIVE_ROOTDIR}/boot/initrd-tree/ -xf ${ATTR_PKG} \
+ lib${DIRSUFFIX}/libattr.so.* usr/bin/getfattr
+# Generate library symlinks for libattr (getfattr depends on them):
+( cd ${LIVE_ROOTDIR}/boot/initrd-tree/lib${DIRSUFFIX} ; ldconfig -n . )
# Stamp the Slackware version into the initrd (at least dhcpcd needs this):
mkdir -p ${LIVE_ROOTDIR}/boot/initrd-tree/etc/rc.d
cp -a ${LIVE_ROOTDIR}/etc/slackware-version ${LIVE_ROOTDIR}/etc/os-release \
${LIVE_ROOTDIR}/boot/initrd-tree/etc/
if [ "$NFSROOTSUP" = "YES" ]; then
# Add just the right kernel network modules by pruning unneeded stuff:
- if [ "$SL_ARCH" = "x86_64" -o "$SMP32" = "NO" ]; then
- KMODS_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "kernel-modules-*$(echo $KGEN |tr - _)*.t?z" |grep -v smp |head -1)
- else
- KMODS_PKG=$(find ${DEF_SL_PKGROOT}/../ -name "kernel-modules-*$(echo $KGEN |tr - _)*.t?z" |grep smp |head -1)
- fi
- KMODS_TEMP=$(mktemp -d -p /mnt -t liveslak.XXXXXX)
- if [ ! -d $KMODS_TEMP ]; then
- echo "*** Failed to create a temporary extraction directory for the initrd!"
- cleanup
- exit 1
- fi
- # We need to extract the full kernel-modules package for deps resolving:
- tar -C ${KMODS_TEMP} -xf ${KMODS_PKG}
+ # We need the full kernel-modules package for deps resolving:
# Get the kernel modules:
- cd ${KMODS_TEMP}
- cp -a --parents lib/modules/${KVER}/${NETMODS} \
- ${LIVE_ROOTDIR}/boot/initrd-tree/
- cd - 1>/dev/null
- # Prune the ones we do not need:
- for KNETRM in ${NETEXCL} ; do
- find ${LIVE_ROOTDIR}/boot/initrd-tree/lib/modules/${KVER}/${NETMODS} \
- -name $KNETRM -depth -exec rm -rf {} \;
- done
- # Add any dependency modules:
- for MODULE in $(find ${LIVE_ROOTDIR}/boot/initrd-tree/lib/modules/${KVER}/${NETMODS} -type f -exec basename {} .ko \;) ; do
- /sbin/modprobe --dirname ${KMODS_TEMP} --set-version $KVER --show-depends --ignore-install $MODULE 2>/dev/null |grep "^insmod " |cut -f 2 -d ' ' |while read SRCMOD; do
- if [ "$(basename $SRCMOD .ko)" != "$MODULE" ]; then
- cd ${KMODS_TEMP}
- # Need to strip ${KMODS_TEMP} from the start of ${SRCMOD}:
- cp -a --parents $(echo $SRCMOD |sed 's|'${KMODS_TEMP}'/|./|' ) \
- ${LIVE_ROOTDIR}/boot/initrd-tree/
- cd - 1>/dev/null
- fi
+ for NETMODPATH in ${NETMODS} ; do
+ cd ${LIVE_ROOTDIR}
+ cp -a --parents lib/modules/${KVER}/${NETMODPATH} \
+ ${LIVE_ROOTDIR}/boot/initrd-tree/
+ cd - 1>/dev/null
+ # Prune the ones we do not need:
+ for KNETRM in ${NETEXCL} ; do
+ find ${LIVE_ROOTDIR}/boot/initrd-tree/lib/modules/${KVER}/${NETMODPATH} \
+ -name $KNETRM -depth -exec rm -rf {} \;
+ done
+ # Add any dependency modules:
+ for MODULE in $(find ${LIVE_ROOTDIR}/boot/initrd-tree/lib/modules/${KVER}/${NETMODPATH} -type f -exec basename {} .ko \;) ; do
+ /sbin/modprobe --dirname ${LIVE_ROOTDIR} --set-version $KVER --show-depends --ignore-install $MODULE 2>/dev/null |grep "^insmod " |cut -f 2 -d ' ' |while read SRCMOD; do
+ if [ "$(basename $SRCMOD .ko)" != "$MODULE" ]; then
+ cd ${LIVE_ROOTDIR}
+ # Need to strip ${LIVE_ROOTDIR} from the start of ${SRCMOD}:
+ cp -a --parents $(echo $SRCMOD |sed 's|'${LIVE_ROOTDIR}'/|./|' ) \
+ ${LIVE_ROOTDIR}/boot/initrd-tree/
+ cd - 1>/dev/null
+ fi
+ done
done
done
- # Remove the temporary tree:
- rm -rf ${KMODS_TEMP}
# We added extra modules to the initrd, so we run depmod again:
chroot ${LIVE_ROOTDIR}/boot/initrd-tree /sbin/depmod $KVER
# Add the firmware for network cards that need them:
@@ -2456,7 +3500,7 @@ rm -rf ${LIVE_ROOTDIR}/boot/initrd-tree
# ... and cleanup these mounts again:
umount ${LIVE_ROOTDIR}/{proc,sys,dev} || true
-umount ${LIVE_ROOTDIR} || true
+umount -R ${LIVE_ROOTDIR} || true
# Paranoia:
[ ! -z "${LIVE_BOOT}" ] && rm -rf ${LIVE_BOOT}/{etc,tmp,usr,var} 1>${DBGOUT} 2>${DBGOUT}
@@ -2470,11 +3514,6 @@ mv ${LIVE_BOOT}/boot/initrd_${KVER}.img ${LIVE_STAGING}/boot/initrd.img
# Squash the boot directory into its own module:
mksquashfs ${LIVE_BOOT} ${LIVE_MOD_SYS}/0000-${DISTRO}_boot-${SL_VERSION}-${SL_ARCH}.sxz -noappend -comp ${SQ_COMP} ${SQ_COMP_PARAMS}
-# Determine additional boot parameters to be added:
-if [ -z ${KAPPEND} ]; then
- eval KAPPEND=\$KAPPEND_${LIVEDE}
-fi
-
# Copy the syslinux configuration.
# The next block checks here for a possible UEFI grub boot image:
cp -a ${LIVE_TOOLDIR}/syslinux ${LIVE_STAGING}/boot/
@@ -2482,8 +3521,13 @@ cp -a ${LIVE_TOOLDIR}/syslinux ${LIVE_STAGING}/boot/
# EFI support always for 64bit architecture, but conditional for 32bit.
if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then
# Copy the UEFI boot directory structure:
+ rm -rf ${LIVE_STAGING}/EFI/BOOT
mkdir -p ${LIVE_STAGING}/EFI/BOOT
cp -a ${LIVE_TOOLDIR}/EFI/BOOT/{grub-embedded.cfg,make-grub.sh,*.txt,theme} ${LIVE_STAGING}/EFI/BOOT/
+ if [ ${SECUREBOOT} -eq 1 ]; then
+ # User needs a DER-encoded copy of the signing cert for MOK enrollment:
+ openssl x509 -outform der -in ${MOKCERT} -out ${LIVE_STAGING}/EFI/BOOT/liveslak.der
+ fi
if [ "$LIVEDE" = "XFCE" ]; then
# We do not use the unicode font, so it can be removed to save space:
rm -f ${LIVE_STAGING}/EFI/BOOT/theme/unicode.pf2
@@ -2491,7 +3535,7 @@ if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then
# Create the grub fonts used in the theme.
# Command outputs string like this: "Font name: DejaVu Sans Mono Regular 5".
- for FSIZE in 5 10 12 20 ; do
+ for FSIZE in 5 10 12 20 24 ; do
grub-mkfont -s ${FSIZE} -av \
-o ${LIVE_STAGING}/EFI/BOOT/theme/dejavusansmono${FSIZE}.pf2 \
/usr/share/fonts/TTF/DejaVuSansMono.ttf \
@@ -2504,6 +3548,12 @@ if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then
# Generate the UEFI grub boot image if needed:
if [ ! -f ${LIVE_STAGING}/EFI/BOOT/boot${EFISUFF}.efi -o ! -f ${LIVE_STAGING}/boot/syslinux/efiboot.img ]; then
( cd ${LIVE_STAGING}/EFI/BOOT
+ # Create a SBAT file 'grub_sbat.csv' to be used by make-grub.sh :
+ cat <<HSBAT > ${LIVE_STAGING}/EFI/BOOT/grub_sbat.csv
+sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
+grub,1,Free Software Foundation,grub,2.06,https://www.gnu.org/software/grub/
+grub.liveslak,1,The liveslak project,grub,${GRUBVER}-${GRUBBLD},https://download.liveslak.org/
+HSBAT
sed -i -e "s/SLACKWARELIVE/${MARKER}/g" grub-embedded.cfg
sh make-grub.sh EFIFORM=${EFIFORM} EFISUFF=${EFISUFF}
)
@@ -2511,6 +3561,12 @@ if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then
# Generate the grub configuration for UEFI boot:
gen_uefimenu ${LIVE_STAGING}/EFI/BOOT
+
+ # Add SecureBoot support if requested:
+ if [ ${SECUREBOOT} -eq 1 ]; then
+ secureboot ${SHIM_3RDP}
+ fi
+
fi # End EFI support menu.
if [ "$SYSMENU" = "NO" ]; then
@@ -2569,7 +3625,8 @@ if [ "$LIVEDE" != "XFCE" ]; then
fi
fi
-if [ "$LIVEDE" != "XFCE" -a "$LIVEDE" != "SLACKWARE" ]; then
+if [ "$LIVEDE" != "XFCE" -a "$LIVEDE" != "LEAN" -a "$LIVEDE" != "SLACKWARE" ]
+then
# KDE/PLASMA etc will profit from accelerated graphics support;
# however the SLACKWARE ISO should not have any non-Slackware content.
# You can 'cheat' when building the SLACKWARE ISO by copying the graphics
@@ -2578,6 +3635,9 @@ if [ "$LIVEDE" != "XFCE" -a "$LIVEDE" != "SLACKWARE" ]; then
# Add custom (proprietary) graphics drivers:
echo "-- Adding binary GPU drivers supporting kernel ${KVER}."
cp ${LIVE_TOOLDIR}/graphics/*${KVER}-${SL_VERSION}-${SL_ARCH}.sxz ${LIVE_MOD_OPT}/
+ if ls ${LIVE_TOOLDIR}/graphics/nvidia-*xx.ids 1>/dev/null 2>&1 ; then
+ cp ${LIVE_TOOLDIR}/graphics/nvidia-*xx.ids ${LIVE_MOD_OPT}/
+ fi
fi
fi
@@ -2585,6 +3645,9 @@ fi
# verbatim into the overlay root):
mkdir -p ${LIVE_STAGING}/${LIVEMAIN}/rootcopy
+# Mark our ISO as 'ventoy-compatible':
+echo "This ISO is compatible with Ventoy. See https://www.ventoy.net/en/compatible.html" >${LIVE_STAGING}/ventoy.dat
+
# Create an ISO file from the directories found below ${LIVE_STAGING}:
create_iso ${LIVE_STAGING}