diff options
Diffstat (limited to 'make_slackware_live.sh')
-rwxr-xr-x | make_slackware_live.sh | 364 |
1 files changed, 224 insertions, 140 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 4ce65b5..388714f 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -35,7 +35,7 @@ # ----------------------------------------------------------------------------- # Version of the Live OS generator: -VERSION="1.1.0" +VERSION="1.1.3" # Directory where our live tools are stored: LIVE_TOOLDIR=${LIVE_TOOLDIR:-"$(cd $(dirname $0); pwd)"} @@ -80,6 +80,9 @@ THEDATE=$(date +%Y%m%d) # --------------------------------------------------------------------------- # +# The live username of the image: +LIVEUID=${LIVEUID:-"live"} + # The root and live user passwords of the image: ROOTPW=${ROOTPW:-"root"} LIVEPW=${LIVEPW:-"live"} @@ -129,6 +132,13 @@ MARKER=${MARKER:-"SLACKWARELIVE"} # The filesystem label we will be giving our ISO: MEDIALABEL=${MEDIALABEL:-"LIVESLAK"} +# For x86_64 you can add multilib: +MULTILIB=${MULTILIB:-"NO"} + +# Use the '-G' parameter to generate the ISO from a pre-populated directory +# containing the live OS files: +ONLY_ISO="NO" + # The name of the directory used for storing persistence data: PERSISTENCE=${PERSISTENCE:-"persistence"} @@ -169,7 +179,7 @@ SEQ_CIN="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra,cinnamon # 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:usb-storage:hid:usbhid:hid-generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:jbd:mbcache:ext3:ext4:isofs:fat:nls_cp437:nls_iso8859-1:msdos:vfat"} +KMODS=${KMODS:-"squashfs:overlay:loop:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:usb-storage:hid:usbhid:i2c-hid:hid-generic: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"} # Firmware for wired network cards required for NFS root support: NETFIRMWARE="3com acenic adaptec bnx tigon e100 sun kaweth tr_smctr cxgb3" @@ -377,10 +387,25 @@ function install_pkgs() { if [ "$TRIM" = "doc" -o "$TRIM" = "mandoc" -o "$LIVEDE" = "XFCE" ]; then # Remove undesired (too big for a live OS) document subdirectories: (cd "${2}/usr/doc" && find . -type d -mindepth 2 -maxdepth 2 -exec rm -rf {} \;) + rm -rf "$2"/usr/share/gtk-doc + rm -rf "$2"/usr/share/help + # Remove residual bloat: + rm -f "${2}"/usr/doc/*/*.{html,css,xml,pdf,db,bz2,xz} fi if [ "$TRIM" = "mandoc" ]; then - # Also remove man pages: - rm -rf "$2"/usr/man + # Also remove man and info pages: + rm -rf "$2"/usr/man "$2"/usr/info + fi + if [ "$LIVEDE" = "XFCE" ]; then + # By pruning stuff that no one likely needs anyway, + # we make room for packages we would otherwise not be able to add. + # 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 some of the big unused/esoteric static libraries: + rm -rf "$2"/usr/lib${DIRSUFFIX}/{libaudiofile,libgdk,libglib,libgtk}.a + rm -rf "$2"/usr/lib${DIRSUFFIX}/{liblftp*,libnl}.a fi # End install_pkgs @@ -592,11 +617,98 @@ EOL done } +# +# Create an ISO file from a directory's content: +# +create_iso() { + TOPDIR=${1:-"${LIVE_STAGING}"} + + cd "$TOPDIR" + + # Tag the type of live environment to the ISO filename: + if [ "$LIVEDE" = "SLACKWARE" ]; then + ISOTAG="" + else + ISOTAG="-$(echo $LIVEDE |tr A-Z a-z)" + fi + + # Determine whether we add UEFI boot capabilities to the ISO: + if [ -f boot/syslinux/efiboot.img -a "$USEXORR" = "NO" ]; then + UEFI_OPTS="-eltorito-alt-boot -no-emul-boot -eltorito-platform 0xEF -eltorito-boot boot/syslinux/efiboot.img" + elif [ -f boot/syslinux/efiboot.img -a "$USEXORR" = "YES" ]; then + UEFI_OPTS="-eltorito-alt-boot -e boot/syslinux/efiboot.img -no-emul-boot" + else + UEFI_OPTS="" + fi + + # Time to determine the output filename, now that we know all the variables + # and ensured that the OUTPUT directory exists: + OUTFILE=${OUTFILE:-"${OUTPUT}/${DISTRO}${DIRSUFFIX}-live${ISOTAG}-${SL_VERSION}.iso"} + if [ "$USEXORR" = "NO" ]; then + mkisofs -o "${OUTFILE}" \ + -V "${MEDIALABEL}" \ + -R -J \ + -hide-rr-moved \ + -v -d -N \ + -no-emul-boot -boot-load-size ${BOOTLOADSIZE} -boot-info-table \ + -sort boot/syslinux/iso.sort \ + -b boot/syslinux/isolinux.bin \ + -c boot/syslinux/isolinux.boot \ + ${UEFI_OPTS} \ + -preparer "$(echo $LIVEDE |sed 's/BASE//') Live built by ${BUILDER}" \ + -publisher "The Slackware Linux Project - http://www.slackware.com/" \ + -A "${DISTRO^}-${SL_VERSION} for ${SL_ARCH} ($(echo $LIVEDE |sed 's/BASE//') Live $VERSION)" \ + -x ./$(basename ${LIVE_WORK}) \ + -x ./${LIVEMAIN}/bootinst \ + -x boot/syslinux/testing \ + . + + if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then + # Make this a hybrid ISO with UEFI boot support on x86_64. + # On 32bit, the variable EFI32 must be explicitly enabled. + isohybrid -u "${OUTFILE}" + else + isohybrid "${OUTFILE}" + fi # End UEFI hybrid ISO. + else + echo "-- Using xorriso to generate the ISO and make it hybrid." + xorriso -as mkisofs -o "${OUTFILE}" \ + -V "${MEDIALABEL}" \ + -J -joliet-long -r \ + -hide-rr-moved \ + -v -d -N \ + -b boot/syslinux/isolinux.bin \ + -c boot/syslinux/isolinux.boot \ + -boot-load-size ${BOOTLOADSIZE} -boot-info-table -no-emul-boot \ + ${UEFI_OPTS} \ + -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ + -isohybrid-gpt-basdat \ + -preparer "$(echo $LIVEDE |sed 's/BASE//') Live built by ${BUILDER}" \ + -publisher "The Slackware Linux Project - http://www.slackware.com/" \ + -A "${DISTRO^}-${SL_VERSION} for ${SL_ARCH} ($(echo $LIVEDE |sed 's/BASE//') Live $VERSION)" \ + -x ./$(basename ${LIVE_WORK}) \ + -x ./${LIVEMAIN}/bootinst \ + -x boot/syslinux/testing \ + . + fi + + # Return to original directory: + cd - 1>/dev/null + + cd "${OUTPUT}" + md5sum "$(basename "${OUTFILE}")" \ + > "$(basename "${OUTFILE}")".md5 + cd - 1>/dev/null + echo "-- Live ISO image created:" + ls -l "${OUTFILE}"* + +} # End of create_iso() + # --------------------------------------------------------------------------- # Action! # --------------------------------------------------------------------------- -while getopts "a:d:efhm:r:s:t:vz:HO:R:X" Option +while getopts "a:d:efhm:r:s:t:vz:GH:MO:R:X" Option do case $Option in h ) @@ -628,7 +740,9 @@ do echo " -t <doc|mandoc> Trim the ISO (remove man and/or doc)." 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 " -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 " -X Use xorriso instead of mkisofs/isohybrid." @@ -654,8 +768,12 @@ do ;; z ) SL_VERSION="${OPTARG}" ;; + G ) ONLY_ISO="YES" + ;; H ) LIVE_HOSTNAME="${OPTARG}" ;; + M ) MULTILIB="YES" + ;; O ) OUTFILE="${OPTARG}" OUTPUT="$(cd $(dirname "${OUTFILE}"); pwd)" ;; @@ -677,6 +795,8 @@ shift $(($OPTIND - 1)) # if one exists. # --------------------------------------------------------------------------- +[ "$DEBUG" = "NO" ] && DBGOUT="/dev/null" || DBGOUT="/dev/stderr" + # ----------------------------------------------------------------------------- # Some sanity checks first. # ----------------------------------------------------------------------------- @@ -687,11 +807,22 @@ if [ -n "$REFRESH" -a "$FORCE" = "YES" ]; then exit 1 fi +if [ "$ONLY_ISO" = "YES" -a "$FORCE" = "YES" ]; then + echo ">> Please use only _one_ of the switches '-f' or '-G'!" + echo ">> Run '$0 -h' for more help." + exit 1 +fi + if [ $RUNLEVEL -ne 3 -a $RUNLEVEL -ne 4 ]; then echo ">> Default runlevel other than 3 or 4 is not supported." exit 1 fi +if [ "$SL_ARCH" != "x86_64" -a "$MULTILIB" = "YES" ]; then + echo ">> Multilib is only supported on x86_64 architecture." + exit 1 +fi + # Directory suffix, arch dependent: if [ "$SL_ARCH" = "x86_64" ]; then DIRSUFFIX="64" @@ -711,12 +842,6 @@ DEF_SL_PKGROOT=${SL_PKGROOT} SL_PATCHROOT=${SL_REPO}/${DISTRO}${DIRSUFFIX}-${SL_VERSION}/patches/packages DEF_SL_PATCHROOT=${SL_PATCHROOT} -# Do we have a local Slackware repository? -if [ ! -d ${SL_REPO} ]; then - echo "-- Slackware repository root '${SL_REPO}' does not exist! Exiting." - exit 1 -fi - # Are all the required add-on tools present? [ "$USEXORR" = "NO" ] && ISOGEN="mkisofs isohybrid" || ISOGEN="xorriso" PROG_MISSING="" @@ -732,7 +857,28 @@ if [ ! -z "$PROG_MISSING" ] ; then exit 1 fi -[ "$DEBUG" = "NO" ] && DBGOUT="/dev/null" || DBGOUT="/dev/stderr" +# Create output directory for image file: +mkdir -p "${OUTPUT}" +if [ $? -ne 0 ]; then + echo "-- Creation of output directory '${OUTPUT}' failed! Exiting." + exit 1 +fi + +# If so requested, we generate the ISO image and immediately exit. +if [ "$ONLY_ISO" = "YES" -a -n "${LIVE_STAGING}" ]; then + create_iso ${LIVE_STAGING} + cleanup + exit 0 +else + # Remove ./boot - it will be created from scratch later: + rm -rf ${LIVE_STAGING}/boot +fi + +# Do we have a local Slackware repository? +if [ ! -d ${SL_REPO} ]; then + echo "-- Slackware repository root '${SL_REPO}' does not exist! Exiting." + exit 1 +fi # Cleanup if we are FORCEd to rebuild from scratch: if [ "$FORCE" = "YES" ]; then @@ -742,16 +888,9 @@ if [ "$FORCE" = "YES" ]; then rm -rf ${LIVE_STAGING}/${LIVEMAIN} ${LIVE_WORK} ${LIVE_ROOTDIR} fi -# Create output directory for image file: -mkdir -p "${OUTPUT}" -if [ $? -ne 0 ]; then - echo "-- Creation of output directory '${OUTPUT}' failed! Exiting." - exit 1 -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 - umount ${LTEMP} 2>${DBGOUT} || true + umount ${LTEMP} 2>${DBGOUT} || true mkdir -p ${LTEMP} if [ $? -ne 0 ]; then echo "-- Creation of temporary directory '${LTEMP}' failed! Exiting." @@ -802,9 +941,17 @@ esac # Do we need to create/include additional module(s) defined by a pkglist: if [ -n "$SEQ_ADDMOD" ]; then + echo "-- Adding ${SEQ_ADDMOD}." MSEQ="${MSEQ} pkglist:${SEQ_ADDMOD}" 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" +fi + echo "-- Creating '${LIVEDE}' image." # Module sequence can be composed of multiple sub-sequences: @@ -851,10 +998,10 @@ for SPS in ${SL_SERIES} ; do # We need to take care of a few things first: if [ "$SL_ARCH" = "x86_64" -o "$SMP32" = "NO" ]; then - KGEN=$(echo ${INSTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${INSTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${INSTDIR}/lib/modules/ |grep -v smp |head -1) else - KGEN=$(echo ${INSTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${INSTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${INSTDIR}/lib/modules/ |grep smp |head -1) fi if [ -z "$KVER" ]; then @@ -918,10 +1065,10 @@ mount -t overlay -o lowerdir=${RODIRS},upperdir=${INSTDIR},workdir=${LIVE_OVLDIR # Determine the kernel version in the Live OS: if [ "$SL_ARCH" = "x86_64" -o "$SMP32" = "NO" ]; then - KGEN=$(echo ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${LIVE_ROOTDIR}/lib/modules/ |grep -v smp |head -1) else - KGEN=$(echo ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${LIVE_ROOTDIR}/lib/modules/ |grep smp |head -1) fi @@ -1040,13 +1187,13 @@ EOL # Set a root password. echo "root:${ROOTPW}" | chpasswd --root ${LIVE_ROOTDIR} -# Create a nonprivileged user account "live": -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 -u 1000 -d /home/live -m -s /bin/bash live -echo "live:${LIVEPW}" | chpasswd --root ${LIVE_ROOTDIR} +# 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 -u 1000 -d /home/${LIVEUID} -m -s /bin/bash ${LIVEUID} +echo "${LIVEUID}:${LIVEPW}" | chpasswd --root ${LIVE_ROOTDIR} # Configure suauth: cat <<EOT >${LIVE_ROOTDIR}/etc/suauth -root:live:OWNPASS +root:${LIVEUID}:OWNPASS root:ALL EXCEPT GROUP wheel:DENY EOT chmod 600 ${LIVE_ROOTDIR}/etc/suauth @@ -1084,19 +1231,19 @@ ALLOW32BIT=off USEBL=1 WGETOPTS="--timeout=20 --tries=2" GREYLIST=on -PKGS_PRIORITY=( restricted alienbob ktown_testing ) -REPOPLUS=( slackpkgplus restricted alienbob ktown_testing ) +PKGS_PRIORITY=( restricted alienbob ktown mate ) +REPOPLUS=( slackpkgplus restricted alienbob ktown mate ) MIRRORPLUS['slackpkgplus']=http://slakfinder.org/slackpkg+/ MIRRORPLUS['restricted']=http://bear.alienbase.nl/mirrors/people/alien/restricted_sbrepos/${SL_VERSION}/${SL_ARCH}/ MIRRORPLUS['alienbob']=http://bear.alienbase.nl/mirrors/people/alien/sbrepos/${SL_VERSION}/${SL_ARCH}/ -MIRRORPLUS['ktown_testing']=http://bear.alienbase.nl/mirrors/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/ -MIRRORPLUS['mate_testing']=http://slackware.uk/msb/testing/1.12/${SL_ARCH}/ - +#MIRRORPLUS['ktown_testing']=http://bear.alienbase.nl/mirrors/alien-kde/${SL_VERSION}/testing/${SL_ARCH}/ +MIRRORPLUS['ktown']=http://bear.alienbase.nl/mirrors/alien-kde/${SL_VERSION}/latest/${SL_ARCH}/ +MIRRORPLUS['mate']=http://slackware.uk/msb/${SL_VERSION}/latest/${SL_ARCH}/ EOPL fi -/usr/sbin/slackpkg -batch=on update gpg -/usr/sbin/slackpkg -batch=on update +ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on update gpg +ARCH=${SL_ARCH} /usr/sbin/slackpkg -batch=on update EOSL @@ -1230,9 +1377,9 @@ 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/live/.face.icon -chown --reference=${LIVE_ROOTDIR}/home/live ${LIVE_ROOTDIR}/home/live/.face.icon -( cd ${LIVE_ROOTDIR}/home/live/ ; ln .face.icon .face ) +cp ${LIVE_TOOLDIR}/blueSW-64px.png ${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 @@ -1246,7 +1393,7 @@ sed -i "s/@LIBDIR@/lib${DIRSUFFIX}/g" ${LIVE_ROOTDIR}/etc/X11/xdm/liveslak-xdm/x # The Xscreensaver should show a blank screen only, to prevent errors about # missing modules: -echo "mode: blank" > ${LIVE_ROOTDIR}/home/live/.xscreensaver +echo "mode: blank" > ${LIVE_ROOTDIR}/home/${LIVEUID}/.xscreensaver # -------------------------------------------------------------------------- # echo "-- Configuring XFCE." @@ -1266,15 +1413,18 @@ 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 - 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 + # 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. @@ -1283,7 +1433,7 @@ fi mkdir -p ${LIVE_ROOTDIR}/var/lib/kdm cat <<EOT > ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts [PrevUser] -:0=live +:0=${LIVEUID} EOT chmod 600 ${LIVE_ROOTDIR}/var/lib/kdm/kdmsts @@ -1346,14 +1496,16 @@ if [ "$LIVEDE" = "PLASMA5" ]; then echo "-- Configuring PLASMA5." # -------------------------------------------------------------------------- # + # Remove the confusing openbox session if present: + rm -f ${LIVE_ROOTDIR}/usr/share/xsessions/openbox-session.desktop || true # Remove the buggy mediacenter session: - rm ${LIVE_ROOTDIR}/usr/share/xsessions/plasma-mediacenter.desktop || true + rm -f ${LIVE_ROOTDIR}/usr/share/xsessions/plasma-mediacenter.desktop || true # 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 [Last] # Name of the last logged-in user. This username will be preselected/shown when the login screen shows up -User=live +User=${LIVEUID} # Name of the session file of the last session selected. This session will be preselected when the login screen shows up. Session=/usr/share/xsessions/plasma.desktop @@ -1434,15 +1586,16 @@ if type custom_config 1>/dev/null 2>/dev/null ; then fi # Workaround a bug where our Xkbconfig is not loaded sometimes: -echo "setxkbmap" > ${LIVE_ROOTDIR}/home/live/.xprofile +echo "setxkbmap" > ${LIVE_ROOTDIR}/home/${LIVEUID}/.xprofile # Give the live user a copy of our XFCE (and more) skeleton configuration: cd ${LIVE_ROOTDIR}/etc/skel/ - find . -exec cp -a --parents "{}" ${LIVE_ROOTDIR}/home/live/ \; + find . -exec cp -a --parents "{}" ${LIVE_ROOTDIR}/home/${LIVEUID}/ \; + find ${LIVE_ROOTDIR}/home/${LIVEUID}/ -type f -exec sed -i -e "s,/home/live,/home/${LIVEUID}," "{}" \; cd - 1>/dev/null # Make sure that user 'live' owns her own files: -chroot ${LIVE_ROOTDIR} chown -R live:users home/live +chroot ${LIVE_ROOTDIR} chown -R ${LIVEUID}:users home/${LIVEUID} # -------------------------------------------------------------------------- # echo "-- Tweaking system startup." @@ -1473,8 +1626,10 @@ sed -i ${LIVE_ROOTDIR}/etc/inittab -e "s/\(id:\).\(:initdefault:\)/\1${RUNLEVEL} [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.yp ] && chmod -x ${LIVE_ROOTDIR}/etc/rc.d/rc.yp [ -f ${LIVE_ROOTDIR}/etc/rc.d/rc.sshd ] && chmod -x ${LIVE_ROOTDIR}/etc/rc.d/rc.sshd -# But enable NFS client support: +# 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 # 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, @@ -1660,10 +1815,10 @@ mount --bind /dev ${LIVE_ROOTDIR}/dev # Determine the installed kernel version: if [ "$SL_ARCH" = "x86_64" -o "$SMP32" = "NO" ]; then - KGEN=$(echo ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep -v smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${LIVE_ROOTDIR}/lib/modules/ |grep -v smp |head -1) else - KGEN=$(echo ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) + KGEN=$(ls --indicator-style=none ${LIVE_ROOTDIR}/var/log/packages/kernel*modules* |grep smp |head -1 |rev | cut -d- -f3 |tr _ - |rev) KVER=$(ls --indicator-style=none ${LIVE_ROOTDIR}/lib/modules/ |grep smp |head -1) fi @@ -1677,6 +1832,11 @@ cat $LIVE_TOOLDIR/liveinit | sed \ -e "s/@MEDIALABEL@/$MEDIALABEL/g" \ -e "s/@PERSISTENCE@/$PERSISTENCE/g" \ -e "s/@DARKSTAR@/$LIVE_HOSTNAME/g" \ + -e "s/@LIVEUID@/$LIVEUID/g" \ + -e "s/@DISTRO@/$DISTRO/g" \ + -e "s/@CDISTRO@/${DISTRO^}/g" \ + -e "s/@UDISTRO@/${DISTRO^^}/g" \ + -e "s/@VERSION@/$VERSION/g" \ > ${LIVE_ROOTDIR}/boot/initrd-tree/init cat /dev/null > ${LIVE_ROOTDIR}/boot/initrd-tree/luksdev # We do not add openobex to the initrd and don't want to see irrelevant errors: @@ -1764,6 +1924,10 @@ if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then # Copy the UEFI boot directory structure: 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 [ "$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 + fi # Create the grub fonts used in the theme: for FSIZE in 5 10 12; do @@ -1828,13 +1992,6 @@ fi echo "-- Assemble the ISO image." -# Tag the type of live environment to the ISO filename: -if [ "$LIVEDE" = "SLACKWARE" ]; then - ISOTAG="" -else - ISOTAG="-$(echo $LIVEDE |tr A-Z a-z)" -fi - # We keep strict size requirements for the XFCE ISO: # addons/optional modules will not be added. if [ "$LIVEDE" != "XFCE" ]; then @@ -1853,10 +2010,10 @@ if [ "$LIVEDE" != "XFCE" -a "$LIVEDE" != "SLACKWARE" ]; then # however the SLACKWARE ISO should not have any non-Slackware content. # You can 'cheat' when building the SLACKWARE ISO by copying the graphics # drivers into the 'optional' directory yourself. - if ls ${LIVE_TOOLDIR}/graphics/*${KVER}-*.sxz 1>/dev/null 2>&1 ; then + if ls ${LIVE_TOOLDIR}/graphics/*${KVER}-${SL_VERSION}-${SL_ARCH}.sxz 1>/dev/null 2>&1 ; then # Add custom (proprietary) graphics drivers: echo "-- Adding binary GPU drivers supporting kernel ${KVER}." - cp ${LIVE_TOOLDIR}/graphics/*${KVER}-*.sxz ${LIVE_MOD_OPT}/ + cp ${LIVE_TOOLDIR}/graphics/*${KVER}-${SL_VERSION}-${SL_ARCH}.sxz ${LIVE_MOD_OPT}/ fi fi @@ -1865,80 +2022,7 @@ fi mkdir -p ${LIVE_STAGING}/${LIVEMAIN}/rootcopy # Create an ISO file from the directories found below ${LIVE_STAGING}: -cd ${LIVE_STAGING} - -# Determine whether we add UEFI boot capabilities to the ISO: -if [ -f boot/syslinux/efiboot.img -a "$USEXORR" = "NO" ]; then - UEFI_OPTS="-eltorito-alt-boot -no-emul-boot -eltorito-platform 0xEF -eltorito-boot boot/syslinux/efiboot.img" -elif [ -f boot/syslinux/efiboot.img -a "$USEXORR" = "YES" ]; then - UEFI_OPTS="-eltorito-alt-boot -e boot/syslinux/efiboot.img -no-emul-boot" -else - UEFI_OPTS="" -fi - -# Time to determine the output filename, now that we know all the variables -# and ensured that the OUTPUT directory exists: -OUTFILE=${OUTFILE:-"${OUTPUT}/${DISTRO}${DIRSUFFIX}-live${ISOTAG}-${SL_VERSION}.iso"} -if [ "$USEXORR" = "NO" ]; then - mkisofs -o "${OUTFILE}" \ - -V "${MEDIALABEL}" \ - -R -J \ - -hide-rr-moved \ - -v -d -N \ - -no-emul-boot -boot-load-size ${BOOTLOADSIZE} -boot-info-table \ - -sort boot/syslinux/iso.sort \ - -b boot/syslinux/isolinux.bin \ - -c boot/syslinux/isolinux.boot \ - ${UEFI_OPTS} \ - -preparer "$(echo $LIVEDE |sed 's/BASE//') Live built by ${BUILDER}" \ - -publisher "The Slackware Linux Project - http://www.slackware.com/" \ - -A "${DISTRO^}-${SL_VERSION} for ${SL_ARCH} ($(echo $LIVEDE |sed 's/BASE//') Live $VERSION)" \ - -x ./$(basename ${LIVE_WORK}) \ - -x ./${LIVEMAIN}/bootinst \ - -x boot/syslinux/testing \ - . - - if [ "$SL_ARCH" = "x86_64" -o "$EFI32" = "YES" ]; then - # Make this a hybrid ISO with UEFI boot support on x86_64. - # On 32bit, the variable EFI32 must be explicitly enabled. - isohybrid -u "${OUTFILE}" - else - isohybrid "${OUTFILE}" - fi # End UEFI hybrid ISO. -else - echo "-- Using xorriso to generate the ISO and make it hybrid." - xorriso -as mkisofs -o "${OUTFILE}" \ - -V "${MEDIALABEL}" \ - -J -joliet-long -r \ - -hide-rr-moved \ - -v -d -N \ - -b boot/syslinux/isolinux.bin \ - -c boot/syslinux/isolinux.boot \ - -boot-load-size ${BOOTLOADSIZE} -boot-info-table -no-emul-boot \ - ${UEFI_OPTS} \ - -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ - -isohybrid-gpt-basdat \ - -preparer "$(echo $LIVEDE |sed 's/BASE//') Live built by ${BUILDER}" \ - -publisher "The Slackware Linux Project - http://www.slackware.com/" \ - -A "${DISTRO^}-${SL_VERSION} for ${SL_ARCH} ($(echo $LIVEDE |sed 's/BASE//') Live $VERSION)" \ - -x ./$(basename ${LIVE_WORK}) \ - -x ./${LIVEMAIN}/bootinst \ - -x boot/syslinux/testing \ - . -fi - -# This copy is no longer needed: -rm -rf ./boot - -# Return to original directory: -cd - 1>/dev/null - -cd "${OUTPUT}" - md5sum "$(basename "${OUTFILE}")" \ - > "$(basename "${OUTFILE}")".md5 -cd - 1>/dev/null -echo "-- Live ISO image created:" -ls -l "${OUTFILE}"* +create_iso ${LIVE_STAGING} # Clean out the mounts etc: cleanup |