diff options
42 files changed, 1998 insertions, 738 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..446abd8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +prep.sh + diff --git a/EFI/BOOT/grub-embedded.cfg b/EFI/BOOT/grub-embedded.cfg index 917672f..cc2098e 100644 --- a/EFI/BOOT/grub-embedded.cfg +++ b/EFI/BOOT/grub-embedded.cfg @@ -1 +1,4 @@ search --file --no-floppy --set=root /EFI/BOOT/SLACKWARELIVE +if [ -e ($root)/EFI/BOOT/grub.cfg ]; then + set prefix=($root)/EFI/BOOT +fi diff --git a/EFI/BOOT/grub.cfg b/EFI/BOOT/grub.cfg deleted file mode 100644 index 63e7c80..0000000 --- a/EFI/BOOT/grub.cfg +++ /dev/null @@ -1 +0,0 @@ -source $prefix/menu/grub.cfg diff --git a/EFI/BOOT/help.txt b/EFI/BOOT/help.txt index 8d7310e..ea24562 100644 --- a/EFI/BOOT/help.txt +++ b/EFI/BOOT/help.txt @@ -125,6 +125,10 @@ toram => copy the OS from the media to to RAM before running it. toram=all => Prevent writes to disk since we are supposed to run from RAM; equivalent to parameter "toram". +toram=core => Load Console OS modules into RAM. Console-only Slackware + loads fast, contains 'setup2hd' and frees up your USB drive so you can + overwrite it with a Persistent Live OS. + toram=os => Load OS modules into RAM, but write persistent data to USB. === Troubleshooting === diff --git a/EFI/BOOT/make-grub.sh b/EFI/BOOT/make-grub.sh index a4f1f50..ddf9f68 100644 --- a/EFI/BOOT/make-grub.sh +++ b/EFI/BOOT/make-grub.sh @@ -37,6 +37,9 @@ EFIFORM=${EFIFORM:-"x86_64"} EFISUFF=${EFISUFF:-"x64"} EFIDIR=${EFIDIR:-"/EFI/BOOT"} +# Fix the path in grub-ebedded.cfg if needed: +sed -e "s,/EFI/BOOT,${EFIDIR}," -i grub-embedded.cfg + echo echo "Building ${EFIDIR}/boot${EFISUFF}.efi and /boot/syslinux/efiboot.img." @@ -45,7 +48,7 @@ echo "Building ${EFIDIR}/boot${EFISUFF}.efi and /boot/syslinux/efiboot.img." GMODDIR="$(dirname $(LANG=C grub-mkimage -O ${EFIFORM}-efi -p ${EFIDIR} alienbob 2>&1 | cut -d\` -f2 |cut -d\' -f1) )" GMODLIST="" # 'shim_lock' is built into grub, not a module anymore: -for GMOD in part_gpt part_msdos fat ext2 f2fs iso9660 ntfs chain linux boot configfile normal regexp extcmd minicmd reboot halt search search_fs_file search_fs_uuid search_label gfxterm gfxmenu gfxterm_menu gfxterm_background efi_gop efi_uga all_video loadbios gzio echo true probe loadenv bitmap_scale font cat help ls png jpeg tga test at_keyboard usb_keyboard disk memdisk nativedisk file loopback tar tftp net efinet efifwsetup zstd ; do +for GMOD in part_gpt part_msdos fat btrfs ext2 f2fs jfs xfs iso9660 ntfs chain linux boot configfile normal regexp extcmd minicmd reboot halt search search_fs_file search_fs_uuid search_label gfxterm gfxmenu gfxterm_menu gfxterm_background efi_gop efi_uga all_video loadbios gzio echo true probe loadenv bitmap_scale font cat help ls png jpeg tga test at_keyboard usb_keyboard disk memdisk nativedisk file loopback tar tftp net efinet efifwsetup zstd ; do [ -f ${GMODDIR}/${GMOD}.mod ] && GMODLIST="${GMODLIST} ${GMOD}" || echo ">> ${GMOD} not found" done @@ -33,12 +33,12 @@ The reasons I had for creating the Slackware Live Edition are as follows: The "liveslak" scripts can generate a variety of Slackware flavors: - - a complete 64bit Slackware-current Live Edition (in a 4.4 GB ISO); - - a slimmed-down XFCE ISO (1000 MB) with XDM as the graphical login manager. It fits on a 1 GB USB stick; - - a LEAN ISO (2.2 GB) of Slackware-current with reduced package set and based on Plasma5 Desktop; + - a complete 64bit Slackware-current Live Edition (in a 4.5 GB ISO); + - a slimmed-down XFCE ISO (1100 MB) with XDM as the graphical login manager. It fits on a 1 GB USB stick; + - a LEAN ISO (2.5 GB) of Slackware-current with reduced package set and based on Plasma5 Desktop; - A Digital Audio Workstation (DAW) based on a custom Slackware package set plus a basic Plasma5, containing a rich software collection for musicians, producers and live performance artists (3.6 GB). - - a Mate variant (3.8 GB) where KDE has been replaced by Mate (a Gnome 2 fork); - - a Cinnamon flavour (a fork of the Gnome 3 Shell replacing Slackware's KDE) in an ISO file of 3.7 GB; + - a Mate variant (4.2 GB) where KDE has been replaced by Mate (a Gnome 2 fork); + - a Cinnamon flavour (a fork of the Gnome 3 Shell replacing Slackware's KDE) in an ISO file of 4.2 GB; - a Dlackware variant, which is Gnome3 + PAM + systemd on top of Slackware and stripped of KDE (no longer developed after Slackware 14.2); - a StudioWare edition containing all the project's audio, video and photo editing software packages (no longer developed after Slackware 14.2); - a "Custom" variant which you can give your own name, its own package list and custom post-install configuration. @@ -73,13 +73,14 @@ Slackware Live Edition deviates as little as possible from a regular Slackware b === BIOS boot === -Slackware Live Edition uses syslinux to boot the Linux kernel on BIOS computers. To be precise, the "isolinux" variant is installed to the ISO image and the "extlinux" variant is installed into the Linux partition of the USB Live version. +Slackware Live Edition uses syslinux to boot the Linux kernel on BIOS computers. To be precise, the "isolinux" variant is installed to the ISO image and the "extlinux" variant is installed into the ext4-formatted Linux partition of the USB Live version. Syslinux shows a graphical boot menu with a nice Slackware-themed background and several options: * Start (SLACKWARE | XFCE | MATE | CINNAMON | DAW | LEAN) Live (depending on which of the ISOs you boot) * Non-US Keyboard selection * Non-US Language selection * Memory test with memtest86+ + * Console OS in RAM You can select a keyboard mapping that matches your computer's. Also you can boot Slackware in another language than US English. If you stick to US English interface language you will probably still want to change the timezone because it will default to UTC. You have to specify a custom timezone manually by adding "tz=YourGeography/YourLocation" because the syslinux bootmenu does not offer you a selection of timezones. Syslinux allows you to edit the boot commandline by pressing <TAB>. Press <ENTER> to boot after you made your changes or <ESC> to discard your edit and return to the menu. @@ -96,8 +97,9 @@ On UEFI computers, Grub2 handles the boot and it will show a menu similar (and s * Non-US Timezone selection * Memory test with memtest86+ * Help on boot parameters + * Console OS in RAM -Editing a Grub menu before booting it is possible by pressing the "e" key. After making your changes to the boot commandline, press <F10> to boot. To discard your changes, press <ESC>. +Editing a Grub menu before booting it is possible by pressing the "e" key. After making your changes to the boot commandline, press <F10> or <Ctrl>-<x> to boot. To discard your changes, press <ESC>. Another difference between Syslinux and Grub2 menus: in Grub2 you can select a non-US keyboard, language and/or timezone and you will return to the main menu every time. You still have to select "Start SLACKWARE Live" to boot the computer. In the Syslinux menu, only the keyboard selection menu will return you to the main menu. Any non-US *language* selection on the other hand will boot you into Slackware Live immediately; without returning to the main menu. This is a limitation of syslinux which would require exponentially more menu files to construct a menu with more choices. Grub2 supports variables which make it easy to modify a menu entry's characteristics. @@ -134,7 +136,7 @@ Note that you can create your own SSL certificate plus private key and use those === Boot from an ISO file on disk === -If you downloaded a liveslak ISO file and want to boot that ISO directly from its location on your computer's hard drive, you can use the following Grub configuration block and add it to your ''/boot/grub/grub.cfg'':<code> +If you downloaded a liveslak ISO file and want to boot that ISO directly from its location on your computer's hard drive, you can use the following Grub configuration block and add it to your ''/boot/grub/grub.cfg'' (the example code assumes you downloaded the XFCE ISO and stored it as ''/data/ISOS/slackware64-live-xfce-current.iso''):<code> menuentry " LIVESLAK ISO" --class gnu-linux --class os --class icon-linux { set iso='/data/ISOS/slackware64-live-xfce-current.iso' set bootparms='load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=Europe/Amsterdam lang=nl' @@ -144,7 +146,7 @@ menuentry " LIVESLAK ISO" --class gnu-linux --class os --class icon-linux { linux (loop)/boot/generic livemedia=scandev:$iso $bootparms initrd (loop)/boot/initrd.img }</code> -This example will add a 'LIVESLAK ISO' menu entry to your local computer's boot menu, through which you can start a XFCE Live ISO which you previously downloaded to directory ''/data/ISOS/'', pre-configured for a US keyboard, Dutch language and Amsterdam timezone. +This example will add a 'LIVESLAK ISO' menu entry to your local computer's boot menu, through which you can start a XFCE Live ISO which you previously downloaded to directory ''/data/ISOS/'', pre-configured for a US keyboard, Dutch language and Amsterdam timezone. You should of course change the ''bootparms'' string so that it matches your requirements. Alternatively you could look into Ventoy, which is a tool to create a bootable USB drive containing multiple ISO files. Ventoy allows you to boot from any of these ISOs by automatically generating on every boot a Grub menu containing all the images found on disk. Liveslak is fully Ventoy-compatible. Website: https://www.ventoy.net/ . @@ -166,23 +168,40 @@ This script, called 'iso2usb.sh', accepts the following parameters: <code> -f|--force Ignore most warnings (except the back-out). -h|--help This help. -i|--infile <filename> Full path to the ISO image file. + -l|--lukshome <name> Custom path to the containerfile for your LUKS + encrypted /home (slhome by default). -o|--outdev <filename> The device name of your USB drive. - -p|--persistence <name> Custom name of the 'persistence' directory/file. - If it does not exist yet, create it manually. + -p|--persistence <name> Custom path to the 'persistence' directory + or containerfile (persistence by default). -r|--refresh Refresh the USB stick with the ISO content. No formatting, do not touch user content. -s|--scan Scan for insertion of new USB device instead of providing a devicename (using option '-o'). -u|--unattended Do not ask any questions. -v|--verbose Show verbose messages. - -w|--wait<number> Add <number> seconds wait time to initialize USB. + -w|--wait <number> Add <number> seconds wait time to initialize USB. + -y|--layout <x,x,x,x> Specify partition layout and sizes (in MB). + Default values: '1,100,-1,' for 3 partitions, + the '-1' value for partition 3 meaning + 'use all remaining space', + and an empty 4th value means 'do not reserve + free space for a custom 4th partition'. -C|--cryptpersistfile size|perc Use a LUKS-encrypted 'persistence' file instead of a directory (for use on FAT filesystem). Format for size/percentage is the same as for the '-c' parameter. + -F|--filesystem <fs> Specify filesystem to create when formatting + devices/containers. Defaults to 'ext4', + Choices are btrfs,ext2,ext4,f2fs,jfs,xfs. + Note that the linux partition will always be + formatted as 'ext4' because extlinux is used + as the BIOS bootloader. -P|--persistfile Use an unencrypted 'persistence' file instead of a directory (for use on FAT filesystem). + Persistent data will not be migrated + when switching from directory to container file. + </code> Examples: @@ -192,8 +211,10 @@ Examples: # ./iso2usb.sh -i slackware64-live-current.iso -o /dev/sdX -c 750M -w 15 * Create a USB Live with an encrypted /home (allocating 30% of the stick's free space for /home) and where the persistent data will be stored in a container file instead of a directory: # ./iso2usb.sh -i slackware64-live-current.iso -o /dev/sdX -c 30% -P - * Create a USB Live with both the /home and the persistent data encrypted (the persistence filesystem will be 300 MB in size): - # ./iso2usb.sh -i slackware64-live-current.iso -o /dev/sdX -c 30% -C 300M + * Create a USB Live with both the /home and the persistent data encrypted (the persistence filesystem will be 300 MB in size) using a btrfs filesystem: + # ./iso2usb.sh -i slackware64-live-current.iso -o /dev/sdX -F btrfs -c 30% -C 300M + * Create a 32bit USB Live but use a custom partition layout: create a 1 MB BIOS boot partition and a 200 MB EFI partition, add a 4th un-used $ GB partition at the end, and allocate all remaining disk space to the main Linux partition: + # iso2usb.sh -i slackware-live-current.iso -o /dev/sdX -y 1,200,-1,4096 * Refresh the system modules on a USB Live using a Live ISO as the source. Let the script scan for insertion of a USB stick instead of specifying the device name on the commandline. Note that the addons and optional modules will not be touched by this action: # ./iso2usb.sh -i slackware64-live-current.iso -r -s @@ -205,7 +226,7 @@ You might have noticed that the "-P" parameter does not accept a size parameter. An ISO companion script is available which enables you to add functionality in cases where you want to boot directly from an ISO file. For instance, when having added the ISO file as a selection in your Grub menu, or when using a 3rd-party boot manager like Ventoy. Typically, a Live ISO is immutable (its ISO-9660 filesystem is read-only) and when you boot off it, the Live OS does not have persistence. The system starts in a virgin state, every boot. -The ISO companion script can add encrypted persistence and homedirectory container files to the disk partition which can be VFAT or EXFAT if you want. It also can create a directory structure on-disk from which liveslak can load additional live modules that are not present inside the ISO (both 'addons' and 'optional'). +The ISO companion script can create encrypted containers for persistence and your homedirectory on the disk partition; that partition can be formatted as VFAT or EXFAT if you want. It also can create a directory structure on-disk from which liveslak can load additional live modules that are not present inside the ISO (both 'addons' and 'optional'). The script is called 'isocomp.sh', and it accepts the following parameters: <code> -d|--directory <path> Create a liveslak directory structure to store @@ -227,11 +248,15 @@ The script is called 'isocomp.sh', and it accepts the following parameters: <cod file to be created in the filesystem (filename extension must be '.icc'!). -x|--extend <fullpath> Full path to existing (encrypted) container - file that you want to extend in size - (filename needs to end in '.icc'!). + file that you want to extend in size. Limitations: - - container needs to be LUKS encrypted, and - - internal filesystem needs to be ext{2,3,4}. + - container needs to be LUKS encrypted. + - filename needs to end in '.icc'. + Supported filesystems inside container: + - btrfs,ext2,ext4,f2fs,jfs,xfs. + -F|--filesystem <fs> Specify filesystem to create when formatting + devices/containers. Defaults to 'ext4', + Choices are btrfs,ext2,ext4,f2fs,jfs,xfs. -L|--lcsize <size|perc> Size of LUKS encrypted /home ; value is the requested size of the container in kB, MB, GB, or as a percentage of free space @@ -252,7 +277,7 @@ Some examples of what the script can do, are given when you run the script with * Create a 1GB encrypted persistence container: # ./isocomp.sh -p /run/media/<user>/Ventoy/myfiles/persistence.icc -P 1G - * Create a 4GB encrypted home: + * Create a 4GB encrypted home with btrfs filesystem: # ./isocomp.sh -l /run/media/<user>/Ventoy/somedir/lukscontainers.icc -L 4000M -i /run/media/<user>/Ventoy/slackware64-live-current.iso * Increase the size of that encrypted home container with another 2GB: # ./isocomp.sh -x /run/media/<user>/Ventoy/somedir/lukscontainers.icc -X 2G -i /run/media/<user>/Ventoy/slackware64-live-current.iso @@ -282,6 +307,7 @@ The "setup2hd" script supports regular Slackware network installations. In addit The 'setup2hd' program has some capabilities that the original Slackware 'setup' lacks: * It will launch fdisk/gdisk if you forgot to create Linux partitions in advance; + * It will optionally install a firewall for which the configuration is based on your answers to a few questions; * It will allow you to create a regular user account and set its password; * It will prompt you to set the root password in a graphical dialog. @@ -296,6 +322,7 @@ Specifically, the script is able to: * Restore the backed-up kernel and modules if the new kernel is not working. * Add network support modules for PXE boot (if missing). * Increase (or decrease) USB wait time during boot. + * Extend the size of any of the encrypted containers on the USB Live stick, in case such a container is running out of storage space and there's still room on the USB disk partition for the expansion. * Replace the Live init script inside the initrd image with a new script that you supply. * Move current persistence data to a new squashfs module in 'addons' afther which the persistence store will be re-initialized. The new module's name is time-stamped (/liveslak/addons/0099-slackware__customchanges-yymmddHHMMSS.sxz) so that this action can be repeated many times. @@ -306,6 +333,7 @@ Before making any modifications, the script will show you a prompt at which poin This script, called 'upslak.sh', accepts the following parameters: <code> -b|--nobackup Do not try to backup original kernel and modules. -d|--devices List removable devices on this computer. + -e|--examples Show some common usage examples. -h|--help This help. -i|--init <filename> Replacement init script. -k|--kernel <filename> The kernel file (or package). @@ -318,6 +346,26 @@ This script, called 'upslak.sh', accepts the following parameters: <code> providing a devicename (using option '-o'). -v|--verbose Show verbose messages. -w|--wait<number> Add <number> seconds wait time to initialize USB. + -x|--extend <fullpath> Full path (either in your filesystem or else + relative to the USB partition root) + to an existing (encrypted) container file, + whose size you want to extend. + Limitations: + - container needs to be LUKS encrypted. + - filename extension needs to be '.img'. + Supported filesystems inside container: + - btrfs,ext2,ext4,f2fs,jfs,xfs. + -N|--nolivemods Don't create an addon live module containing + the new kernelmodules. Normally you *will* need + this addon module, *unless* you have already + installed these kernel-modules in the Live OS. + FYI: the kernel and module upgrade applies only + to the USB boot kernel and its initrd. + -X|--extendsize <size|perc> Extend size of existing container; value + is the requested extension of the container + in kB, MB, GB, or as percentage of free space + (integer numbers only). + Examples: '-X 125M', '-X 2G', '-X 20%'. </code> Examples: @@ -328,7 +376,10 @@ Examples: * Restore the previous kernel and modules after a failed update, and let the script scan your computer for the insertion of your USB stick: # ./upslak.sh -s -r * Replace the Live init script with the latest template taken from the git repository: - # ./upslak.sh -o /dev/sdX -i liveslak/liveinit.tpl + # wget https://git.liveslak.org/liveslak/plain/liveinit.tpl + # ./upslak.sh -o /dev/sdX -i liveinit.tpl + * Extend the size of the pre-existing LUKS container for your homedirectory with 3 GB, and let the script scan for the insertion of your USB stick: + # ./upslak.sh -s -x /slhome.img -X 3G ==== PXE booting the Live OS ==== @@ -373,7 +424,7 @@ How to start the PXE server? When you boot the Live OS you can then start a script "pxeserver" from the console in runlevel 3 or from an X terminal in runlevel 4. The script will gather all required information and if it is unable to figure something out by itself it will ask you. If it is unable to figure out the wired network interface that it should use, you can add the name of your interface (for instance, eth1) as a single parameter to the script when you start it. -The PXE server uses dnsmasq to offer DNS to the PXE clients. The dnsmasq program will enable its internal DHCP server capabilities if your LAN does not have its own DHCP server. Dnsmasq will also start a TFTP server which the PXE clients will connect to in order to retrieve the boot files (kernel and initrd). The ''pxeserver'' script also starts a NFS server which will be used by the Live initrd to obtain the squashfs modules and boot the Live OS. If your PXE server has multiple network interfaces, for instance a wireless interface which is connected to the outside world and a wired interface connected to another computer which will become a PXE client (or indeed connected to a switch with a whole bunch of prospective PXE clients behind that) then the PXE server will setup packet forwarding so that the PXE clients will be able to access the outside world through the wired interface and out to that other interface. +The PXE server uses dnsmasq to offer DNS to the PXE clients. The dnsmasq program will enable its internal DHCP server capabilities if your LAN does not have its own DHCP server. Dnsmasq will also start a TFTP server which the PXE clients will connect to in order to retrieve the boot files (kernel and initrd). The ''pxeserver'' script also starts a NFS server which will be used by the Live initrd to obtain the squashfs modules and boot the Live OS. If your PXE server has multiple network interfaces, for instance a wireless interface which is connected to the outside world and a wired interface connected to another computer which will become a PXE client (or indeed connected to a switch with a whole bunch of prospective PXE clients behind that) then the PXE server will setup packet forwarding so that the PXE clients will be able to access the outside world through the wired interface and out to that other interface. If the PXE clients are unable to access the Internet using this default IP packet forwarding configuration, you may want to answer with 'YES' to the question during pxeserver's configuration when it asks you if you want to hide the PXE clients behind a NAT router. If you have multiple network interfaces, it is important to know that dnsmasq will only bind to the interface where you want PXE clients to connect to. In a multi-NIC situation where a second NIC is connected to the outside world (your local network), this means that the DHCP/DNS server started by dnsmasq will not interfere with an existing DHCP server in your local network. @@ -583,7 +634,7 @@ The USB variant with persistence may have an additional directory in the root: The first script: The script "make_slackware_live.sh" creates an ISO file as its output which contains the Live OS. -Thanks to Linux kernel 4.x and the squashfs-tools package in Slackware, the process of creating a Slackware Live ISO requires **no** (re)compilation of Slackware content or installing 3rd party packages. +Thanks to Linux kernel >= 4.x and the squashfs-tools package in Slackware, the process of creating a Slackware Live ISO requires **no** (re)compilation of Slackware content or installing 3rd party packages. The script's inner workings can be subdivided into several distinct stages. For the full Slackware ISO the process stages are as follows: @@ -613,7 +664,7 @@ Stage two: * 'root' and 'live' user accounts are created, * an initial environment for the accounts is configured, * the desktop environment is pre-configured for first use, - * the liveslak scripts "makemod", "iso2usb.sh", "isocomp.sh" and "upslak.sh" are copied to "/usr/local/sbin/" in the ISO for your convenience, + * the liveslak scripts "makemod", "iso2usb.sh", "isocomp.sh", "upslak.sh" and "pxeserver" are copied to "/usr/local/sbin/" in the ISO for your convenience, * The "setup2hd" script and the Slackware installer files are copied to "/usr/local/sbin" and "/usr/share/liveslak" respectively. * slackpkg is configured, * a locate database is created, @@ -635,7 +686,7 @@ Stage three: Stage four: - * a bootable ISO file is created using mkisofs. + * a bootable ISO file is created using mkisofs or xorriso. * the "isohybrid" command is run on the ISO so that you can "dd" or "cp" the ISO to a USB stick and thus create a bootable USB media. Done! You can find the ISO file and its MD5 checksum in the /tmp directory. @@ -656,9 +707,10 @@ The "iso2usb.sh" script wipes and re-partitions the USB stick unless the "-r" or * First partition: a small (1 MB in size) FAT partition which is not used for Slackware Live Edition. It can be used by an alternative bootloader if needed. You can also store your LUKS keyfile on it to unlock a LUKS-encrypted Slackware Linux computer (see the README_CRYPT.TXT file on your Slackware DVD for more information on LUKS keyfiles). * Second partition: a 100 MB VFAT partition containing the kernel, initrd and all the other stuff required by syslinux and grub2 to boot Slackware Live Edition. - * Third partition: a Linux partition taking up all of the remaining space. It contains the actual liveslak modules, the persistent live storage and optionally your encrypted homedirectory. You can use the remainder of this Linux ext4 filesystem's free space to store anything you like. + * Third partition: a Linux partition which by default takes up all of the remaining space. It contains the actual liveslak modules, the persistent live storage and optionally your encrypted homedirectory. You can use the remainder of this Linux ext4 filesystem's free space to store anything you like. + * Fourth partition is optional: using the ''-y|--layout'' commandline parameter you can create a un-used partition at the end of the USB disk which is all yours to format and use. This layout parameter allows you to specify partition sizes. -Note that this script is the only supported method of transfering the liveslak ISO content to a USB stick and make that USB stick into a persistent live OS. Several 3rd party tools (like multibootusb, rufus, unetbootin) that claim to be able to mix several Live OS'es on a single USB stick and make them all work in a multi-boot setup, are not currently supporting liveslak. +Note that this script extracts the ISO contents to transform a USB stick into into a persistent live OS. This is a destructive process, erasing all previously available content on that stick. Several 3rd party tools (like multibootusb, rufus, unetbootin) that claim to be able to mix several Live OS'es on a single USB stick and make them all work in a multi-boot setup, are not currently supporting liveslak. Ventoy on the other hand, is fully supported by liveslak and therefore your best bet if you don't want to wipe your data off your USB stick. As a bonus, the ''isocomp.sh'' script is able to add persistence to a liveslak ISO on a Ventoy boot disk. == Mounting a filesystem in an encrypted container == @@ -713,7 +765,7 @@ If the container is used for an encrypted /home, the script will copy the existi == Extending the size of an existing container file == -The 'isocomp.sh' script is able to extend your encrypted containers if you are running out of space on their enclosed filesystems. It does this by appending random bytes to the end of the file, unlocking and mounting the filesystem inside, and then resizing that filesystem so it grows to the new size of the container. Note that only containers with an internal ''ext4'' filesystem are supported. +The 'isocomp.sh' script is able to extend your encrypted containers if you are running out of space on their enclosed filesystems. It does this by appending random bytes to the end of the file, unlocking and mounting the filesystem inside, and then resizing that filesystem so it grows to the new size of the container. === makemod === @@ -728,7 +780,7 @@ Usage: * The first parameter is either the full path to a Slackware package, or else a directory. * If a packagename is supplied as first parameter, it will be installed into a temporary directory using Slackware's "installpkg". The content of the temporary directory will be squashed into a module by the "squashfs" program. - * If a directoryname is supplied, its content will be squashed into a module by the "squashfs" program.. + * If a directoryname is supplied, its content will be squashed into a module by the "squashfs" program. * The second parameter is the full pathname of the output module which will be created. You can copy the module you just created (minding the filename conventions for a Slackware Live module, see paragraph "Slackware Live module format") to either the optional/ or to the addon/ directory of your Live OS. If you copy it to the optional/ or addon/ directory of the liveslak sources then "make_slackware_live.sh" will use the module when creating the ISO image. @@ -760,6 +812,7 @@ The ''pxeserver'' script works as follows: * dnsmasq providing DNS, DHCP and BOOTP; * NFS and RPC daemons; * The script will detect if you have an outside network connection on another interface and will enable IP forwarding if needed, so that the PXE clients will also have network access. + * The script can optionally setup NAT routing - masquerading the PXE clients from the outside world - if regular IP packet forwarding is not making the outside network accessible to PXE clients. * The Live OS booted via pxelinux is configured with additional boot parameters: <code> nfsroot=<server_ip_address>:/mnt/livemedia luksvol= @@ -792,9 +845,13 @@ Depending on the parameters passed to the script, it will then perform one or mo You can provide a new kernel and its modules in two ways. The '-k' option accepts a kernel image file or else a Slackware package contaning a kernel. The '-m' option accepts a directory tree of modules below "/lib/modules/, or else a Slackware package containing kernel modules. If there is sufficient space on the Linux and EFI partitions, the script will make a backup of the current kernel and modules by renaming the kernel and the module directory with a ".prev" suffix. Sufficient space means that at least 10 MB of free space must remain on the partition(s) after making the backup and installing the new kernel plus modules. If space is an issue, you can skip making a backup by providing the '-b' parameter to the script (a possibly unsafe choice). +Note that these new kernel-modules will be added to the initrd image (they are needed when booting the new kernel). In order for the Live OS to keep working with the new kernel however, these new kernel-modules must also be made available to the Live OS. The script achieves this by creating a '''kernelmodules''' squashfs module and copying the module into the '''addons''' directory of the liveslak installation on your USB stick. When the Live OS boots, the kernelmodules will then automatically be merged into the live filesystem. +It is possible to skip the creation of this squashfs module via the '-N' switch to the script. + == Restore backed-up kernel and modules == If a backup was made of kernel and modules, the upslak.sh script is able to restore these using the '-r' option, thereby removing the replacements. This comes in handy when the replacement kernel turns out to be non-functional. +Note that restoring the old kernel and its modules will leave an orphaned squashfs kernelmodule in liveslak's '''addons''' directory. You can safely delete that file. == Add network support modules == @@ -808,6 +865,10 @@ Similar to the functionality of the "iso2usb.sh" script, the "upslak.sh" script The init script inside the initrd image is the core of liveslak. The init script prepares the Live filesystem and configures several run-time OS parameters. If you have made modifications to this init script you can easily replace the default init script with your own script using the '-i' option. The "upslak.sh" script is smart enough to recognize a iveslak template as input. The ".tpl" extension of some liveslak files means that these are templates. They are not usable as-is, because they contain placeholder strings like "@VERSION@" or "@DISTRO@" that first need to be replaced with real values. The "upslak.sh" script will take care of these substitutions. +== Extend the size of an existing LUKS container == + +Your Slackware Live USB stick will probably have two LUKS containers: one for your ''/home'' directory and the other to store persistent data. If space is running out inside such a container, you can use the '-x' and '-X' parameters to the script to indicate the relevant container and provide a size increase for it. Your data inside the container is safe; the filesystem inside it will be extended and this does not touch existing file data. + == Wrap persistence data into a new squashfs module == Persistence data will accumulate over time on the USB stick. That is perfectly OK, and you can wipe it on boot if that is needed. But sometimes you want to capture the packages you installed into the persistent storage, and create a new squashfs module out of them. The "upslak.sh" script is able to move your persistence data into a new squashfs module using the '-p' option. The new module will be created in the "/liveslak/addons/" directory so that it will be loaded into the Live OS everytime your USB Live boots up. After creating the new module, the persistence store will be re-initialized (i.e. its content will be erased on the next boot). The new module's name is time-stamped (/liveslak/addons/0099-slackware__customchanges-yyyymmddHHMMSS.sxz where yyyymmddHHMMSS is the timestamp) so that this action can be repeated as many times as you want. @@ -879,7 +940,8 @@ The script's parameters are: DAW (Digital Audio Workstation), XFCE (basic XFCE, stripped), KTOWN (ktown Plasma5 replacement), MATE (Gnome2 fork replaces KDE), CINNAMON (fork of Gnome3 Shell - replaces KDE), DLACK (Gnome3 replaces KDE). + replaces KDE), DLACK (Gnome3 replaces KDE), + STUDIOWARE (Multimedia Studio). -e Use ISO boot-load-size of 32 for computers where the ISO won't boot otherwise (default: 4). -f Forced re-generation of all squashfs modules, @@ -894,7 +956,7 @@ The script's parameters are: -v Show debug/error output. -z version Define your Slackware version (default: current). -C Add RAM-based Console OS to boot menu. - -G Generate ISO file from existing directory tree + -G Generate ISO file from existing directory tree. -H hostname Hostname of the Live OS (default: darkstar). -M Add multilib (x86_64 only). -O outfile Custom filename for the ISO. @@ -984,6 +1046,23 @@ This is the section in ''make_slackware_live.conf'' which deals with these custo #} </code> +=== Customizing the list of used packages === + +Any liveslak ISO variant contains a specific set of Slackware packages, as defined in the various ''SEQ_*'' variables used in the ''make_slackware_live.sh'' script. Your customized Live OS will be using variable "''SEQ_CUSTOM''". + +Let's breakdown the definition of such a variable to explain how to customize the package set for your own live ISO. + +The list of packages in the MATE ISO for instance, is defined by the ''SEQ_MSB'' variable (//MSB// stands for //Mate Slack Build//). Its value is as follows: <code> +# grep ^SEQ_MSB make_slackware_live.sh +SEQ_MSB="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra,mate local:slackpkg+"</code> + +Three keywords can be identified in the value of a ''SEQ_*'' variable, and these determine where the packages to be installed are going to be searched for: + * tagfile - this is an Slackware tagfile for a complete package series. For instance, using "tagfile:ap" means: install all packages in the **AP** series. + * pkglist - this is a list of packages to be installed from the Slackware distro itself or from a Slackware-compatible 3rd-party repository. The file containing that package list is searched in the ''./pkglists/'' subdirectory of the liveslak toplevel directory. For instance, using "pkglist:mate" means: install all packages mentioned in the file ''./pkglists/mate.lst''. If there is no matching ''./pkglists/mate.conf'' file then the packages are assumed to be present in the Slackware distro directory. Else the ".conf" file is parsed and the variables that are defined in the ".conf" file will be used while generating the ISO. Most importantly, "''SL_REPO_URL''" will contain the rsync URI pointing to the 3rd-party repository where the requested packages can be downloaded. + * local - some packages can not be found in Slackware-compatible repositories. The "local" keyword alows you to install packages from a subdirectory of the liveslak toplevel directory. For instance, using "local:slackpkg+" means: install all packages found in subdirectory ''./local/slackpkg+/'' or if you are generating a 64bit live ISO, install all packages found in directory ''./local64/slackpkg+/''. + +For the value of a ''SEQ_*'' variable, any combination of these keywords can be used. Every keyword is followed by a colon, and that is followed by a comma-separated list of relevant package definitions. They are all separated by spaces. + === Custom background images === The Plasma5 based Live variants allow customization of the background image used for the login greeter, the desktop wallpaper and the lock screen. The image you want to use for this purpose, must have a 16:9 aspect ratio and its dimensions should at least be 1920x1080 pixels. You must store the custom image inside the liveslak source tree: in the subdirectory ''./media/<variant>/bg/'' where "<variant>" is the lower-case name of the Live variant (variant 'KTOWN' equals directory 'ktown', 'DAW' becomes 'daw', etc). @@ -1072,6 +1151,7 @@ Slackware Live Edition expects its modules to adhere to a particularly loose fil * Anything may be part of the '*' but most commonly used is "${VERSION}-${ARCH}". The core modules in Slackware Live use the Slackware release as ${VERSION} and the Slackware architecture as ${ARCH}. For the modules in addons/ and optional/ subdirectories, ${VERSION} would commonly be the version of the program that is being made available in the module. * The four digits of a modulename have a meaning. Some ranges are claimed by the core OS, so please do not use them. Their prefixes are based on the package source: <code> 0000 = contains the Slackware /boot directory + 0005 = Console OS modules when explicitly enabled for a regular ISO installed otherwise from Slackware tagfiles 0010-0019 = packages installed from a Slackware tagfile (a,ap,d, ... , y series) 0020-0029 = packages installed from a package list as found in the ./pkglists subdirectory of the liveslak sources (min, noxbase, x_base, xapbase, xfcebase etc) 0030-0039 = a 'local' package, i.e. a package found in subdirectory ./local or ./local64 (depending on architecture) diff --git a/contrib/scripts/makemod_wine b/contrib/scripts/makemod_wine index 81c6e6c..a253cdd 100644 --- a/contrib/scripts/makemod_wine +++ b/contrib/scripts/makemod_wine @@ -12,27 +12,27 @@ CWD=$(pwd) # Package versions for wine and FAudio/vkd3d: WINEREL=$(ls ${SBROOT}/wine/pkg64/current/wine-*.t?z |rev |cut -f3 -d- |rev) FAUDIOREL=$(ls ${SBROOT}/FAudio/pkg/current/FAudio-*.t?z |rev |cut -f3 -d- |rev) -VKD3DREL=$(ls ${SBROOT}/vkd3d/pkg/current/vkd3d-*.t?z |rev |cut -f3 -d- |rev) +#VKD3DREL=$(ls ${SBROOT}/vkd3d/pkg/current/vkd3d-*.t?z |rev |cut -f3 -d- |rev) # Package locations for wine vkd3d and FAudio: WINEPKG=$(ls ${SBROOT}/wine/pkg64/current/wine-*.t?z) FAUDIOPKG=$(ls ${SBROOT}/FAudio/pkg64/current/FAudio-*.t?z) FAUDIOPKG32=$(ls ${SBROOT}/FAudio/pkg/current/FAudio-*.t?z) -VKD3DPKG=$(ls ${SBROOT}/vkd3d/pkg64/current/vkd3d-*.t?z) -VKD3DPKG32=$(ls ${SBROOT}/vkd3d/pkg/current/vkd3d-*.t?z) +#VKD3DPKG=$(ls ${SBROOT}/vkd3d/pkg64/current/vkd3d-*.t?z) +#VKD3DPKG32=$(ls ${SBROOT}/vkd3d/pkg/current/vkd3d-*.t?z) # Convert the 32bit FAudio into a 'compat32' package: convertpkg-compat32 -i ${FAUDIOPKG32} -d /tmp -# Convert the 32bit vkd3d into a 'compat32' package: -convertpkg-compat32 -i ${VKD3DPKG32} -d /tmp +## Convert the 32bit vkd3d into a 'compat32' package: +#convertpkg-compat32 -i ${VKD3DPKG32} -d /tmp # Create the SXZ module: SCRATCHDIR=$(mktemp -t -d makesxz.XXXXXX) installpkg --root $SCRATCHDIR ${WINEPKG} installpkg --root $SCRATCHDIR ${FAUDIOPKG} -installpkg --root $SCRATCHDIR ${VKD3DPKG} +#installpkg --root $SCRATCHDIR ${VKD3DPKG} installpkg --root $SCRATCHDIR /tmp/FAudio-compat32-${FAUDIOREL}-x86_64-*compat32.txz -installpkg --root $SCRATCHDIR /tmp/vkd3d-compat32-${VKD3DREL}-x86_64-*compat32.txz +#installpkg --root $SCRATCHDIR /tmp/vkd3d-compat32-${VKD3DREL}-x86_64-*compat32.txz $MAKEMOD $SCRATCHDIR $CWD/0060-wine-${WINEREL}-current-x86_64.sxz rm -r $SCRATCHDIR @@ -31,6 +31,8 @@ fi # Determine whether we can show a graphical themed menu: insmod font if loadfont $prefix/theme/dejavusansmono12.pf2 ; then + loadfont $prefix/theme/dejavusansmono24.pf2 + loadfont $prefix/theme/dejavusansmono20.pf2 loadfont $prefix/theme/dejavusansmono10.pf2 loadfont $prefix/theme/dejavusansmono5.pf2 set gfxmode=1024x768,800x600,640x480,auto @@ -73,8 +75,8 @@ menuentry "Help on boot parameters" --hotkey h { unset pager } -@C2RMH@menuentry "Console OS in RAM ($sl_lang)" --hotkey c { -@C2RMH@ linux ($root)/boot/generic @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=$sl_kbd tz=$sl_tz locale=$sl_locale xkb=$sl_xkb toram=core 3 -@C2RMH@ initrd ($root)/boot/initrd.img -@C2RMH@} +@C2RMS@menuentry "Console OS in RAM ($sl_lang)" --hotkey c { +@C2RMS@ linux ($root)/boot/generic @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=$sl_kbd tz=$sl_tz locale=$sl_locale xkb=$sl_xkb toram=core 3 +@C2RMS@ initrd ($root)/boot/initrd.img +@C2RMS@} @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2015, 2016, 2017, 2019, 2020, 2021, 2022 Eric Hameleers, Eindhoven, NL +# Copyright 2015, 2016, 2017, 2019, 2020, 2021, 2022, 2023 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -32,11 +32,20 @@ FORCE=0 # The default layout of the USB stick is: # partition 1 (1MB), # partition 2 (100 MB) -# partition 3 (claim all free space - specified as 0 MB). +# partition 3 (claim all free space - specified as -1 MB). # The script allows for an amount of free space to be left at the end -# (partition 4, unused by liveslak) in case you need this: +# (partition 4, un-used by liveslak) in case you need this: DEF_LAYOUT="1,100,-1," +# The extension for containerfiles accompanying an ISO is '.icc', +# whereas the persistent USB stick created with iso2usb.sh uses '.img'. +DEFEXT=".img" +CNTEXT="${DEFEXT}" + +# Default filesystem for devices/containers: +DEF_FS="ext4" +FSYS="${DEF_FS}" + # By default, we use 'slhome.img' as the name of the LUKS home containerfile. DEF_SLHOME="slhome" SLHOME="${DEF_SLHOME}" @@ -97,9 +106,7 @@ else fi # Initialize more variables: -CNTBASE="" CNTDEV="" -CNTFILE="" HLUKSSIZE="" LUKSHOME="" LODEV="" @@ -111,6 +118,11 @@ CNTMNT="" USBMNT="" US2MNT="" +# Minimim free space (in MB) we want to have left in any partition +# after we are done. +# The default value can be changed from the environment: +MINFREE=${MINFREE:-10} + # Compressor used on the initrd ("gzip" or "xz --check=crc32"); # Note that the kernel's XZ decompressor does not understand CRC64: COMPR="xz --check=crc32" @@ -120,7 +132,7 @@ COMPR="xz --check=crc32" # # Clean up in case of failure: -cleanup() { +function cleanup() { # Clean up by unmounting our loopmounts, deleting tempfiles: echo "--- Cleaning up the staging area..." # During cleanup, do not abort due to non-zero exit code: @@ -130,7 +142,7 @@ cleanup() { # In case of failure, only the most recent device should still be open: if mount |grep -q ${CNTDEV} ; then umount -f ${CNTDEV} - cryptsetup luksClose $(basename ${CNTBASE}) + cryptsetup luksClose $(basename ${CNTDEV}) losetup -d ${LODEV} fi fi @@ -140,10 +152,10 @@ cleanup() { [ -n "${US2MNT}" ] && ( umount -f ${US2MNT} 2>/dev/null; rmdir $US2MNT 2>/dev/null ) [ -n "${IMGDIR}" ] && ( rm -rf $IMGDIR ) set -e -} +} # End of cleanup() trap 'echo "*** $0 FAILED at line $LINENO ***"; cleanup; exit 1' ERR INT TERM -showhelp() { +function showhelp() { cat <<EOT # # Purpose: to transfer the content of Slackware's Live ISO image @@ -186,6 +198,12 @@ cat <<EOT # of a directory (for use on FAT filesystem) # Format for size/percentage is the same # as for the '-c' parameter. +# -F|--filesystem <fs> Specify filesystem to create when formatting +# devices/containers. Defaults to '${DEF_FS}', +# Choices are $(createfs). +# Note that the linux partition will always be +# formatted as 'ext4' because extlinux is used +# as the BIOS bootloader. # -P|--persistfile Use a 'persistence' container file instead of # a directory (for use on FAT filesystem). # Persistent data will not be migrated @@ -198,30 +216,76 @@ cat <<EOT # $(basename $0) -i slackware-live-current.iso -o /dev/sdX -y 1,200,-1,4096 # EOT -} +} # End of showhelp() + +# Create a filesystem on a partition with optional label: +function createfs () { + MYDEV="${1}" + MYFS="${2:-'ext4'}" + MYLABEL="${3}" + + if [ -z "${MYDEV}" ]; then + # Without arguments given, reply with list of supported fs'es: + echo "btrfs,ext2,ext4,f2fs,jfs,xfs" + return + fi + + if [ -n "${MYLABEL}" ]; then + case "${MYFS}" in + fs2s) MYLABEL="-l ${MYLABEL}" ;; + *) MYLABEL="-L ${MYLABEL}" ;; + esac + fi + + case "${MYFS}" in + btrfs) mkfs.btrfs -f -d single -m single ${MYLABEL} ${MYDEV} + ;; + ext2) mkfs.ext2 -F -F ${MYLABEL} ${MYDEV} + # Tune the ext2 filesystem: + tune2fs -m 0 -c 0 -i 0 ${MYDEV} + ;; + ext4) mkfs.ext4 -F -F ${MYLABEL} ${MYDEV} + # Tune the ext4 filesystem: + tune2fs -m 0 -c 0 -i 0 ${MYDEV} + ;; + f2fs) mkfs.f2fs ${MYLABEL} -f ${MYDEV} + ;; + jfs) mkfs.jfs -q ${MYDEV} + ;; + xfs) mkfs.xfs -f ${MYDEV} + ;; + *) echo "*** Unsupported filesystem '${MYFS}'!"; exit 1 + ;; + esac +} # End of createfs() # Uncompress the initrd based on the compression algorithm used: -uncompressfs () { - if $(file "${1}" | grep -qi ": gzip"); then - gzip -cd "${1}" - elif $(file "${1}" | grep -qi ": XZ"); then - xz -cd "${1}" - elif $(file "${1}" | grep -qi ": lzip"); then - lzip -cd "${1}" +function uncompressfs () { + local IMGFILE="$1" + # Content is streamed to STDOUT: + if $(file "${IMGFILE}" | grep -qi ": gzip"); then + gzip -cd "${IMGFILE}" + elif $(file "${IMGFILE}" | grep -qi ": XZ"); then + xz -cd "${IMGFILE}" + elif $(file "${IMGFILE}" | grep -qi ": LZMA"); then + lzma -cd "${IMGFILE}" + elif $(file "${IMGFILE}" | grep -qi ": lzip"); then + lzip -cd "${IMGFILE}" fi -} +} # End of uncompressfs() # Scan for insertion of a USB device: -scan_devices() { +function scan_devices() { + local MYSCANWAIT="${1}" local BD # Inotifywatch does not trigger on symlink creation, # so we can not watch /sys/block/ - BD=$(inotifywait -q -t ${SCANWAIT} -e create /dev 2>/dev/null |cut -d' ' -f3) + BD=$(inotifywait -q -t ${MYSCANWAIT} -e create /dev 2>/dev/null |cut -d' ' -f3) echo ${BD} } # End of scan_devices() # Show a list of removable devices detected on this computer: -show_devices() { +function show_devices() { local MYDATA="${*}" if [ -z "${MYDATA}" ]; then MYDATA="$(ls --indicator-style=none /sys/block/ |grep -Ev '(ram|loop|dm-)')" @@ -237,16 +301,16 @@ show_devices() { } # End of show_devices() # Read configuration data from old initrd: -read_initrd() { +function read_initrd() { IMGFILE="$1" OLDPERSISTENCE=$(uncompressfs ${IMGFILE} |cpio -i --to-stdout init |grep "^PERSISTENCE" |cut -d '"' -f2 2>/dev/null) OLDWAIT=$(uncompressfs ${IMGFILE} |cpio -i --to-stdout wait-for-root 2>/dev/null) OLDLUKS=$(uncompressfs ${IMGFILE} |cpio -i --to-stdout luksdev 2>/dev/null) -} +} # End of read_initrd() # Add longer USB WAIT to the initrd: -update_initrd() { +function update_initrd() { IMGFILE="$1" # USB boot medium needs a few seconds boot delay else the overlay will fail. @@ -314,93 +378,133 @@ update_initrd() { rm -rf $IMGDIR/* } # End of update_initrd() +# Determine size of a mounted partition (in MB): +function get_part_mb_size() { + local MYPART="${1}" + local MYSIZE + MYSIZE=$(df -P -BM ${MYPART} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f2) + echo "${MYSIZE%M}" +} # End of get_part_mb_size() + +# Determine free space of a mounted partition (in MB): +function get_part_mb_free() { + local MYPART="${1}" + local MYSIZE + MYSIZE=$(df -P -BM ${MYPART} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f4) + echo "${MYSIZE%M}" +} # End of get_part_mb_free() + +# Determine requested container size in MB (allow for '%|k|K|m|M|g|G' suffix): +function cont_mb() { + # Uses global variables: PARTFREE + local MYSIZE="$1" + case "${MYSIZE: -1}" in + "%") MYSIZE="$(( $PARTFREE * ${MYSIZE%\%} / 100 ))" ;; + "k") MYSIZE="$(( ${MYSIZE%k} / 1024 ))" ;; + "K") MYSIZE="$(( ${MYSIZE%K} / 1024 ))" ;; + "m") MYSIZE="${MYSIZE%m}" ;; + "M") MYSIZE="${MYSIZE%M}" ;; + "g") MYSIZE="$(( ${MYSIZE%g} * 1024 ))" ;; + "G") MYSIZE="$(( ${MYSIZE%G} * 1024 ))" ;; + *) MYSIZE=-1 ;; + esac + echo "$MYSIZE" +} # End of cont_mb() + # Create a container file in the empty space of the partition -create_container() { - CNTPART=$1 - CNTSIZE=$2 - CNTBASE=$3 - CNTENCR=$4 # 'none' or 'luks' - CNTUSED=$5 # '/home' or 'persistence' +function create_container() { + local CNTPART=$1 # partition containing the ISO + local CNTSIZE=$2 # size of the container file to create + local CNTFILE=$3 # ${CNTEXT} filename with full path + local CNTENCR=$4 # 'none' or 'luks' + local CNTUSED=$5 # '/home' or 'persistence' + local MYMAP + local MYMNT + + # If containerfile extension is missing, add it now: + if [ "${CNTFILE%${CNTEXT}}" == "${CNTFILE}" ]; then + CNTFILE="${CNTFILE}${CNTEXT}" + fi # Create a container file or re-use previously created one: - if [ -f $USBMNT/${CNTBASE}.img ]; then - CNTFILE="${CNTBASE}.img" - CNTSIZE=$(( $(du -sk $USBMNT/${CNTFILE} |tr '\t' ' ' |cut -f1 -d' ') / 1024 )) - echo "--- Keeping existing '${CNTFILE}' (size ${CNTSIZE} MB)." + if [ -f ${CNTFILE} ]; then + # Where are we mounted? + MYMNT=$(cd "$(dirname "${CNTFILE}")" ; df --output=target . |tail -1) + CNTSIZE=$(( $(du -sk ${CNTFILE} |tr '\t' ' ' |cut -f1 -d' ') / 1024 )) + echo "--- Keeping existing '${CNTFILE#${MYMNT}}' (size ${CNTSIZE} MB)." return fi # Determine size of the target partition (in MB), and the free space: - PARTSIZE=$(df -P -BM ${CNTPART} |tail -1 |tr -s '\t' ' ' |cut -d' ' -f2) - PARTSIZE=${PARTSIZE%M} - PARTFREE=$(df -P -BM ${CNTPART} |tail -1 |tr -s '\t' ' ' |cut -d' ' -f4) - PARTFREE=${PARTFREE%M} + PARTSIZE=$(get_part_mb_size ${CNTPART}) + PARTFREE=$(get_part_mb_free ${CNTPART}) - if [ $PARTFREE -lt 10 ]; then - echo "*** Free space on USB partition is less than 10 MB;" + if [ $PARTFREE -lt ${MINFREE} ]; then + echo "*** Free space on USB partition is less than ${MINFREE} MB;" echo "*** Not creating a container file!" + cleanup exit 1 fi - # Determine requested container size (allow for '%|k|K|m|M|g|G' suffix): - case "${CNTSIZE: -1}" in - "%") CNTSIZE="$(( $PARTFREE * ${CNTSIZE%\%} / 100 ))" ;; - "k") CNTSIZE="$(( ${CNTSIZE%k} / 1024 ))" ;; - "K") CNTSIZE="$(( ${CNTSIZE%K} / 1024 ))" ;; - "m") CNTSIZE="${CNTSIZE%m}" ;; - "M") CNTSIZE="${CNTSIZE%M}" ;; - "g") CNTSIZE="$(( ${CNTSIZE%g} * 1024 ))" ;; - "G") CNTSIZE="$(( ${CNTSIZE%G} * 1024 ))" ;; - *) ;; - esac + # Determine requested container size in MB (allow for '%|k|K|m|M|g|G' suffix): + CNTSIZE=$(cont_mb ${CNTSIZE}) if [ $CNTSIZE -le 0 ]; then echo "*** Container size must be larger than ZERO!" echo "*** Check your '-c' commandline parameter." + cleanup exit 1 elif [ $CNTSIZE -ge $PARTFREE ]; then echo "*** Not enough free space for container file!" echo "*** Check your '-c' commandline parameter." + cleanup exit 1 fi echo "--- Creating ${CNTSIZE} MB container file using 'dd if=/dev/urandom', patience please..." - mkdir -p $USBMNT/$(dirname "${CNTBASE}") - CNTFILE="${CNTBASE}.img" - # Create a sparse file (not allocating any space yet): - dd of=$USBMNT/${CNTFILE} bs=1M count=0 seek=$CNTSIZE + mkdir -p $(dirname "${CNTFILE}") + if [ $? ]; then + # Create a sparse file (not allocating any space yet): + dd of=${CNTFILE} bs=1M count=0 seek=$CNTSIZE 2>/dev/null + else + echo "*** Failed to create directory for the container file!" + cleanup + exit 1 + fi # Setup a loopback device that we can use with cryptsetup: LODEV=$(losetup -f) - losetup $LODEV $USBMNT/${CNTFILE} + losetup $LODEV ${CNTFILE} + MYMAP=$(basename ${CNTFILE} ${CNTEXT}) if [ "${CNTENCR}" = "luks" ]; then # Format the loop device with LUKS: - echo "--- Encrypting the container file with LUKS; enter 'YES' and a passphrase..." + echo "--- Encrypting the container file with LUKS via '${LODEV}'" + echo "--- This takes SOME time, please be patient..." + echo "--- enter 'YES' and a passphrase:" until cryptsetup -y luksFormat $LODEV ; do echo ">>> Did you type two different passphrases?" read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY done # Unlock the LUKS encrypted container: echo "--- Unlocking the LUKS container requires your passphrase again..." - until cryptsetup luksOpen $LODEV $(basename ${CNTBASE}) ; do + until cryptsetup luksOpen $LODEV ${MYMAP} ; do echo ">>> Did you type an incorrect passphrases?" read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY done - CNTDEV=/dev/mapper/$(basename ${CNTBASE}) + CNTDEV=/dev/mapper/${MYMAP} # Now we allocate blocks for the LUKS device. We write encrypted zeroes, # so that the file looks randomly filled from the outside. # Take care not to write more bytes than the internal size of the container: + echo "--- Writing ${CNTSIZE} MB of random data to encrypted container; takes LONG time..." CNTIS=$(( $(lsblk -b -n -o SIZE $(readlink -f ${CNTDEV})) / 512)) - dd if=/dev/zero of=${CNTDEV} bs=512 count=${CNTIS} || true + dd if=/dev/zero of=${CNTDEV} bs=512 count=${CNTIS} status=progress || true else - CNTDEV=$LODEV # Un-encrypted container files remain sparse. + CNTDEV=$LODEV fi # Format the now available block device with a linux fs: - mkfs.ext4 ${CNTDEV} - # Tune the ext4 filesystem: - tune2fs -m 0 -c 0 -i 0 ${CNTDEV} + createfs ${CNTDEV} ${FSYS} if [ "${CNTUSED}" != "persistence" ]; then # Create a mount point for the unlocked container: @@ -414,7 +518,7 @@ create_container() { fi # Copy the original /home (or whatever mount) content into the container: echo "--- Copying '${CNTUSED}' from LiveOS to container..." - HOMESRC=$(find ${USBMNT} -name "0099-slackware_zzzconf*" |tail -1) + HOMESRC=$(find ${ISOMNT} -name "0099-slackware_zzzconf*" |tail -1) mount ${CNTDEV} ${CNTMNT} unsquashfs -n -d ${CNTMNT}/temp ${HOMESRC} ${CNTUSED} mv ${CNTMNT}/temp/${CNTUSED}/* ${CNTMNT}/ @@ -424,10 +528,9 @@ create_container() { # Don't forget to clean up after ourselves: if [ "${CNTENCR}" = "luks" ]; then - cryptsetup luksClose $(basename ${CNTBASE}) + cryptsetup luksClose ${MYMAP} fi losetup -d ${LODEV} || true - } # End of create_container() { # @@ -506,6 +609,10 @@ while [ ! -z "$1" ]; do PERSISTTYPE="file" shift 2 ;; + -F|--filesystem) + FSYS="$2" + shift 2 + ;; -P|--persistfile) PERSISTTYPE="file" shift @@ -533,7 +640,7 @@ fi if [ -z "$TARGET" ]; then if [ $SCAN -eq 1 ]; then echo "-- Waiting ${SCANWAIT} seconds for a USB stick to be inserted..." - TARGET=$(scan_devices) + TARGET=$(scan_devices ${SCANWAIT}) if [ -z "$TARGET" ]; then echo "*** No new USB device detected during $SCANWAIT seconds scan." exit 1 @@ -554,6 +661,16 @@ if [ $FORCE -eq 0 -a ! -f "$SLISO" ]; then exit 1 fi +if [ "${HLUKSSIZE%.*}" != "${HLUKSSIZE}" ] ; then + echo "*** Integer value required in '-c $HLUKSSIZE' !" + exit 1 +fi + +if [ "${PLUKSSIZE%.*}" != "${PLUKSSIZE}" ] ; then + echo "*** Integer value required in '-C $PLUKSSIZE' !" + exit 1 +fi + if [ $FORCE -eq 0 ]; then if [ ! -e /sys/block/$(basename $TARGET) ]; then echo "*** Not a block device: '$TARGET' !" @@ -566,6 +683,9 @@ if [ $FORCE -eq 0 ]; then fi fi +# Add required filesystem tools: +REQTOOLS="${REQTOOLS} mkfs.${FSYS}" + # Are all the required not-so-common add-on tools present? PROG_MISSING="" for PROGN in ${REQTOOLS} ; do @@ -705,25 +825,34 @@ if [ $REFRESH -eq 0 ]; then # Create filesystems: # Not enough clusters for a 32 bit FAT: mkdosfs -s 2 -n "DOS" ${TARGETP1} - mkdosfs -F32 -s 2 -n "EFI" ${TARGETP2} + mkdosfs -F32 -s 2 -n "ESP" ${TARGETP2} # KDE tends to automount.. so try an umount: if mount |grep -qw ${TARGETP3} ; then umount ${TARGETP3} || true fi + # We use extlinux to boot the stick, so other filesystems are not accepted: + createfs ${TARGETP3} ext4 "${LIVELABEL}" # http://www.syslinux.org/wiki/index.php?title=Filesystem - # As of Syslinux 6.03, "pure 64-bits" compression/encryption is not supported. + # As of Syslinux 6.03, "pure 64-bits" compression/encryption is unsupported. # Modern mke2fs creates file systems with the metadata_csum and 64bit # features enabled by default. # Explicitly disable 64bit feature in the mke2fs command with '-O ^64bit'; # otherwise, the syslinux bootloader (>= 6.03) will fail. # Note: older 32bit OS-es will trip over the '^64bit' feature so be gentle. - mkfs.ext4 -F -F -L "${LIVELABEL}" ${TARGETP3} - if ! tune2fs -O ^64bit ${TARGETP3} 1>/dev/null 2>/dev/null ; then - FEAT_64BIT="" - else - FEAT_64BIT="-O ^64bit" + UNWANTED_FEAT="" + if tune2fs -O ^64bit ${TARGETP3} 1>/dev/null 2>/dev/null ; then + UNWANTED_FEAT="^64bit," + fi + # Grub 2.0.6 stumbles over metadata_csum_seed which is enabled by default + # since e2fsprogs 1.47.0, so let's disable that too: + if tune2fs -O ^metadata_csum_seed ${TARGETP3} 1>/dev/null 2>/dev/null ; then + UNWANTED_FEAT="${UNWANTED_FEAT}^metadata_csum_seed," fi - tune2fs -c 0 -i 0 -m 0 ${FEAT_64BIT} ${TARGETP3} + if [ -n "${UNWANTED_FEAT}" ]; then + # We found unwanted feature(s), get rid of trailing comma: + UNWANTED_FEAT="-O ${UNWANTED_FEAT::-1}" + fi + tune2fs -c 0 -i 0 -m 0 ${UNWANTED_FEAT} ${TARGETP3} else # Determine partition names independently of storage architecture: TARGETP1=$(fdisk -l $TARGET |grep ^$TARGET |cut -d' ' -f1 |grep -E '[^0-9]1$') @@ -821,9 +950,13 @@ if [ -n "$VERSION" ]; then fi if [ -n "${HLUKSSIZE}" ]; then - # Create LUKS container file for /home: - create_container ${TARGETP3} ${HLUKSSIZE} ${SLHOME} luks /home - LUKSHOME=${CNTFILE} + # If file extension is missing in the containername, add it now: + if [ "${SLHOME%${CNTEXT}}" == "${SLHOME}" ]; then + SLHOME="${SLHOME}${CNTEXT}" + fi + # Create LUKS container file for /home ; + LUKSHOME="${SLHOME}" + create_container ${TARGETP3} ${HLUKSSIZE} "${USBMNT}/${LUKSHOME}" luks /home fi # Update the initrd with regard to USB wait time, persistence and LUKS. @@ -839,15 +972,15 @@ if [ $REFRESH -eq 1 ]; then # The user specified a nonstandard persistence, so move the old one first; # hide any errors if it did not *yet* exist: mkdir -p ${USBMNT}/$(dirname ${PERSISTENCE}) - mv ${USBMNT}/${OLDPERSISTENCE}.img ${USBMNT}/${PERSISTENCE}.img 2>/dev/null + mv ${USBMNT}/${OLDPERSISTENCE}${CNTEXT} ${USBMNT}/${PERSISTENCE}${CNTEXT} 2>/dev/null mv ${USBMNT}/${OLDPERSISTENCE} ${USBMNT}/${PERSISTENCE} 2>/dev/null fi - if [ -f ${USBMNT}/${PERSISTENCE}.img ]; then + if [ -f ${USBMNT}/${PERSISTENCE}${CNTEXT} ]; then # If a persistence container exists, we re-use it: PERSISTTYPE="file" - if cryptsetup isLuks ${USBMNT}/${PERSISTENCE}.img ; then + if cryptsetup isLuks ${USBMNT}/${PERSISTENCE}${CNTEXT} ; then # If the persistence file is LUKS encrypted we need to record its size: - PLUKSSIZE=$(( $(du -sk $USBMNT/${PERSISTENCE}.img |tr '\t' ' ' |cut -f1 -d' ') / 1024 )) + PLUKSSIZE=$(( $(du -sk $USBMNT/${PERSISTENCE}${CNTEXT} |tr '\t' ' ' |cut -f1 -d' ') / 1024 )) fi elif [ -d ${USBMNT}/${PERSISTENCE} -a "${PERSISTTYPE}" = "file" ]; then # A persistence directory exists but the user wants a container now; @@ -868,10 +1001,10 @@ elif [ "${PERSISTTYPE}" = "file" ]; then # Note: the word "persistence" below is a keyword for create_container: if [ -z "${PLUKSSIZE}" ]; then # Un-encrypted container: - create_container ${TARGETP3} 90% ${PERSISTENCE} none persistence + create_container ${TARGETP3} 90% ${USBMNT}/${PERSISTENCE} none persistence else # LUKS-encrypted container: - create_container ${TARGETP3} ${PLUKSSIZE} ${PERSISTENCE} luks persistence + create_container ${TARGETP3} ${PLUKSSIZE} ${USBMNT}/${PERSISTENCE} luks persistence fi else echo "*** Unknown persistence type '${PERSISTTYPE}'!" @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2022 Eric Hameleers, Eindhoven, NL +# Copyright 2022, 2023 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -50,6 +50,10 @@ VERSION="" DEFEXT=".icc" CNTEXT="${DEFEXT}" +# Default filesystem for devices/containers: +DEF_FS="ext4" +FSYS="${DEF_FS}" + # Default mount point for a LUKS container if not specified: DEFMNT="/home" LUKSMNT="" @@ -71,8 +75,10 @@ LIVESLAKROOT="" # Define ahead of time, so that cleanup knows about them: IMGDIR="" ISOMNT="" +CNTDEV="" CNTMNT="" EXTENSION="" +LODEV="" PERSISTENCE="" # Minimim free space (in MB) we want to have left in any partition @@ -85,14 +91,14 @@ MINFREE=${MINFREE:-10} COMPR="xz --check=crc32" # These tools are required by the script, we will check for their existence: -REQTOOLS="cpio cryptsetup fsck gzip isoinfo lsblk resize2fs unsquashfs xz zstd" +REQTOOLS="cpio cryptsetup fsck gzip isoinfo lsblk unsquashfs xz zstd" # # -- function definitions -- # # Clean up in case of failure: -cleanup() { +function cleanup() { # Clean up by unmounting our loopmounts, deleting tempfiles: echo "--- Cleaning up the staging area..." # During cleanup, do not abort due to non-zero exit code: @@ -103,7 +109,7 @@ cleanup() { # In case of failure, only most recent LUKS mapped device is still open: if mount | grep -q ${CNTDEV} ; then umount -f ${CNTDEV} - cryptsetup luksClose $(basename ${CNTFILE} ${CNTEXT}) + cryptsetup luksClose $(basename ${CNTDEV}) losetup -d ${LODEV} fi fi @@ -116,7 +122,7 @@ cleanup() { trap 'echo "*** $0 FAILED at line $LINENO ***"; cleanup; exit 1' ERR INT TERM # Show the help text for this script: -showhelp() { +function showhelp() { cat <<EOT # # Purpose: enhance the functionality when booting a Slackware Live ISO file. @@ -146,10 +152,14 @@ cat <<EOT # (filename extension must be '${CNTEXT}'!). # -x|--extend <fullpath> Full path to existing (encrypted) container # file that you want to extend in size -# (filename needs to end in '${CNTEXT}'!). # Limitations: -# - container needs to be LUKS encrypted, and -# - internal filesystem needs to be ext{2,3,4}. +# - container needs to be LUKS encrypted. +# - filename extension needs to be '${CNTEXT}'. +# Supported filesystems inside container: +# - $(resizefs). +# -F|--filesystem <fs> Specify filesystem to create when formatting +# devices/containers. Defaults to '${DEF_FS}', +# Choices are $(createfs). # -L|--lcsize <size|perc> Size of LUKS encrypted /home ; value is the # requested size of the container in kB, MB, GB, # or as a percentage of free space @@ -170,7 +180,7 @@ EOT } # End of showhelp() # Show some common usage examples: -showexamples() { +function showexamples() { cat <<EOT # # Some common usage examples for $(basename $0) @@ -182,8 +192,8 @@ cat <<EOT # Create a 1GB encrypted persistence container: # ./$(basename $0) -p /run/media/<user>/Ventoy/myfiles/persistence.icc -P 1G # -# Create a 4GB encrypted home: -# ./$(basename $0) -l /run/media/<user>/Ventoy/somedir/lukscontainers.icc -L 4000M -i /run/media/<user>/Ventoy/slackware64-live-current.iso +# Create a 4GB encrypted home with btrfs filesystem: +# ./$(basename $0) -l /run/media/<user>/Ventoy/somedir/lukscontainers.icc -L 4000M -F btrfs -i /run/media/<user>/Ventoy/slackware64-live-current.iso # # Increase the size of that encrypted home container with another 2GB: # ./$(basename $0) -x /run/media/<user>/Ventoy/somedir/lukscontainers.icc -X 2G -i /run/media/<user>/Ventoy/slackware64-live-current.iso @@ -197,8 +207,110 @@ cat <<EOT EOT } # End of showexamples() +# Create a filesystem on a partition with optional label: +function createfs () { + MYDEV="${1}" + MYFS="${2:-'ext4'}" + MYLABEL="${3}" + + if [ -n "${MYLABEL}" ]; then + case "${MYFS}" in + fs2s) MYLABEL="-l ${MYLABEL}" ;; + *) MYLABEL="-L ${MYLABEL}" ;; + esac + fi + + if [ -z "${MYDEV}" ]; then + # Without arguments given, reply with list of supported fs'es: + echo "btrfs,ext2,ext4,f2fs,jfs,xfs" + return + fi + case "${MYFS}" in + btrfs) mkfs.btrfs -f -d single -m single ${MYLABEL} ${MYDEV} + ;; + ext2) mkfs.ext2 -F -F ${MYLABEL} ${MYDEV} + # Tune the ext2 filesystem: + tune2fs -m 0 -c 0 -i 0 ${MYDEV} + ;; + ext4) mkfs.ext4 -F -F ${MYLABEL} ${MYDEV} + # Tune the ext4 filesystem: + tune2fs -m 0 -c 0 -i 0 ${MYDEV} + ;; + f2fs) mkfs.f2fs ${MYLABEL} -f ${MYDEV} + ;; + jfs) mkfs.jfs -q ${MYDEV} + ;; + xfs) mkfs.xfs -f ${MYDEV} + ;; + *) echo "*** Unsupported filesystem '${MYFS}'!" + cleanup + exit 1 + ;; + esac +} # End of createfs() + +# Resize the filesystem on a block device: +function resizefs() { + local MYDEV="${1}" + + if [ -z "${MYDEV}" ]; then + # Without arguments given, reply with list of supported fs'es: + echo "btrfs,ext2,ext4,f2fs,jfs,xfs" + return + fi + + # Determine the current filesystem for the block device: + local MYFS=$(lsblk -n -o FSTYPE ${MYDEV}) + if [ -z "${MYFS}" ]; then + echo "*** Failed to resize filesystem on device '${MYDEV}'!" + echo "*** No filesystem found." + cleanup + exit 1 + fi + + local TMPMNT=$(mktemp -d -p /tmp -t alienres.XXXXXX) + if [ ! -d $TMPMNT ]; then + echo "*** Failed to create temporary mount for the filesystem resize!" + cleanup + exit 1 + else + chmod 711 ${TMPMNT} + fi + + # Mount the block device prior to the resize + # (btrfs, jfs and xfs do not support offline resize): + mount -o rw -t ${MYFS} ${MYDEV} ${TMPMNT} + + # Resize the filesystem to occupy the full new device capacity: + case "${MYFS}" in + btrfs) btrfs filesystem resize max ${TMPMNT} + ;; + ext*) resize2fs ${MYDEV} + ;; + f2fs) resize.f2fs ${MYDEV} + ;; + jfs) mount -o remount,resize,rw ${TMPMNT} + ;; + xfs) xfs_growfs -d ${TMPMNT} + ;; + *) echo "*** Unsupported filesystem '${MYFS}'!"; exit 1 + ;; + esac + + if [ ! $? ]; then + echo "*** Failed to resize '${MYFS}'filesystem on device '${MYDEV}'!" + cleanup + exit 1 + else + # Un-mount the device again: + sync + umount ${TMPMNT} + rmdir ${TMPMNT} + fi +} # End of checkfs() + # 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 @@ -206,19 +318,21 @@ uncompressfs () { fi } # End of uncompressfs() -# Read configuration data from the initrd inside the ISO: -read_initrd() { +# Read configuration data from the initrd inside the ISO, +# after it has been extracted into a directory: +function read_initrddir() { local IMGDIR="$1" + local INITVARS="$2" cd ${IMGDIR} # Read the values of liveslak template variables in the init script: - for TEMPLATEVAR in DISTRO LIVEMAIN MARKER MEDIALABEL ; do + for TEMPLATEVAR in ${INITVARS} ; do eval $(grep "^ *${TEMPLATEVAR}=" ./init |head -1) done -} # End read_initrd() +} # End of read_initrddir() # Extract the initrd: -extract_initrd() { +function extract_initrd() { local IMGFILE="$1" local IMGDIR=$(mktemp -d -p /tmp -t alienimg.XXXXXX) if [ ! -d $IMGDIR ]; then @@ -236,21 +350,21 @@ extract_initrd() { } # End of extract_initrd() # Determine size of a mounted partition (in MB): -get_part_mb_size() { +function get_part_mb_size() { local MYSIZE MYSIZE=$(df -P -BM ${1} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f2) echo "${MYSIZE%M}" } # End of get_part_mb_size() # Determine free space of a mounted partition (in MB): -get_part_mb_free() { +function get_part_mb_free() { local MYSIZE MYSIZE=$(df -P -BM ${1} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f4) echo "${MYSIZE%M}" } # End of get_part_mb_free() # Determine requested container size in MB (allow for '%|k|K|m|M|g|G' suffix): -cont_mb() { +function cont_mb() { local MYSIZE="$1" case "${MYSIZE: -1}" in "%") MYSIZE="$(( $PARTFREE * ${MYSIZE%\%} / 100 ))" ;; @@ -266,7 +380,7 @@ cont_mb() { } # End of cont_mb() # Expand existing encrypted container file: -expand_container() { +function expand_container() { local MYPART="$1" # disk partition local MYINC="$2" # requested increase ('%|k|K|m|M|g|G' suffix) local MYFILE="$3" # full path to ${CNTEXT} containerfile @@ -289,29 +403,47 @@ expand_container() { # Append random bytes to the end of the container file: dd if=/dev/urandom of=${MYFILE} bs=1M count=${MYINC} oflag=append conv=notrunc 2>/dev/null - # Unlock the LUKS encrypted container: - MYMAP=$(basename ${MYFILE} ${CNTEXT}) - echo "--- Unlocking the LUKS container requires your passphrase..." - until cryptsetup luksOpen ${MYFILE} ${MYMAP} ; do - echo ">>> Did you type an incorrect passphrases?" - read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY - done + # Setup a loopback device that we can use with or without cryptsetup: + LODEV=$(losetup -f) + losetup $LODEV ${MYFILE} + + if cryptsetup isLuks ${LODEV} ; then + # Unlock LUKS encrypted container first: + MYMAP=$(basename ${MYFILE} ${CNTEXT}) + CNTDEV=/dev/mapper/${MYMAP} + echo "--- Unlocking the LUKS container requires your passphrase..." + until cryptsetup luksOpen ${LODEV} ${MYMAP} ; do + echo ">>> Did you type an incorrect passphrases?" + read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY + done + else + # The loopmounted block device for the un-encrypted container: + CNTDEV=${LODEV} + fi # Run fsck so the filesystem is clean before we resize it: - fsck -fvy /dev/mapper/${MYMAP} + fsck -fvy ${CNTDEV} # Resize the filesystem to occupy the full new size: - resize2fs /dev/mapper/${MYMAP} + resizefs ${CNTDEV} # Just to be safe: - fsck -fvy /dev/mapper/${MYMAP} + fsck -fvy ${CNTDEV} + + # Don't forget to clean up after ourselves: + if cryptsetup isLuks ${LODEV} ; then + cryptsetup luksClose ${MYMAP} + fi + losetup -d ${LODEV} || true + } # End of expand_container() # Create container file in the empty space of the partition -create_container() { - CNTPART=$1 # partition containing the ISO - CNTSIZE=$2 # size of the container file to create - CNTFILE=$3 # ${CNTEXT} filename with full path - CNTENCR=$4 # 'none' or 'luks' - CNTUSED=$5 # 'persistence', '/home' or custom mountpoint +function create_container() { + local CNTPART=$1 # partition containing the ISO + local CNTSIZE=$2 # size of the container file to create + local CNTFILE=$3 # ${CNTEXT} filename with full path + local CNTENCR=$4 # 'none' or 'luks' + local CNTUSED=$5 # 'persistence', '/home' or custom mountpoint + local MYMAP # Create a container file or re-use previously created one: if [ -f ${CNTFILE} ]; then @@ -346,14 +478,21 @@ create_container() { exit 1 fi - echo "--- Creating ${CNTSIZE} MB container file using 'dd if=/dev/urandom', patience please..." + echo "--- Creating ${CNTSIZE} MB container file '$(basename =${CNTFILE})' using 'dd if=/dev/urandom', patience please..." mkdir -p $(dirname "${CNTFILE}") - # Create a sparse file (not allocating any space yet): - dd of=${CNTFILE} bs=1M count=0 seek=$CNTSIZE 2>/dev/null + if [ $? ]; then + # Create a sparse file (not allocating any space yet): + dd of=${CNTFILE} bs=1M count=0 seek=$CNTSIZE 2>/dev/null + else + echo "*** Failed to create directory for the container file!" + cleanup + exit 1 + fi # Setup a loopback device that we can use with cryptsetup: LODEV=$(losetup -f) losetup $LODEV ${CNTFILE} + MYMAP=$(basename ${CNTFILE} ${CNTEXT}) if [ "${CNTENCR}" = "luks" ]; then # Format the loop device with LUKS: echo "--- Encrypting the container file with LUKS; takes SOME time..." @@ -364,26 +503,24 @@ create_container() { done # Unlock the LUKS encrypted container: echo "--- Unlocking the LUKS container requires your passphrase again..." - until cryptsetup luksOpen $LODEV $(basename ${CNTFILE} ${CNTEXT}) ; do + until cryptsetup luksOpen $LODEV ${MYMAP} ; do echo ">>> Did you type an incorrect passphrases?" read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY done - CNTDEV=/dev/mapper/$(basename ${CNTFILE} ${CNTEXT}) + CNTDEV=/dev/mapper/${MYMAP} # Now we allocate blocks for the LUKS device. We write encrypted zeroes, # so that the file looks randomly filled from the outside. # Take care not to write more bytes than the internal size of the container: - echo "--- Writing random data to encrypted container; takes LONG time..." + echo "--- Writing ${CNTSIZE} MB of random data to encrypted container; takes LONG time..." CNTIS=$(( $(lsblk -b -n -o SIZE $(readlink -f ${CNTDEV})) / 512)) - dd if=/dev/zero of=${CNTDEV} bs=512 count=${CNTIS} 2>/dev/null || true + dd if=/dev/zero of=${CNTDEV} bs=512 count=${CNTIS} status=progress || true else - CNTDEV=$LODEV # Un-encrypted container files remain sparse. + CNTDEV=$LODEV fi # Format the now available block device with a linux fs: - mkfs.ext4 ${CNTDEV} - # Tune the ext4 filesystem: - tune2fs -m 0 -c 0 -i 0 ${CNTDEV} + createfs ${CNTDEV} ${FSYS} if [ "${CNTUSED}" == "${DEFMNT}" ]; then # Copy the original /home content into the container. @@ -415,7 +552,7 @@ create_container() { } # End of create_container() -read_config() { +function read_isoconfig() { local MYISO="${1}" # Read ISO customization from the .cfg file if it exists: if [ -f "${MYISO%.iso}.cfg" ]; then @@ -429,9 +566,9 @@ read_config() { fi done fi -} # End of read_config() +} # End of read_isoconfig() -write_config() { +function write_isoconfig() { local MYISO="${1}" # Write updated customization into the ISO .cfg: echo "# Liveslak ISO configuration file for ${VERSION}" > ${MYISO%.iso}.cfg 2>/dev/null @@ -448,7 +585,7 @@ write_config() { fi done fi -} # End of write_config() +} # End of write_isoconfig() # # -- end of function definitions -- @@ -500,6 +637,10 @@ while [ ! -z "$1" ]; do EXTENSION="$(cd "$(dirname "$2")"; pwd)/$(basename "$2")" shift 2 ;; + -F|--filesystem) + FSYS="$2" + shift 2 + ;; -L|--lcsize) LUKSSIZE="$2" shift 2 @@ -528,6 +669,9 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi +# Add required filesystem tools: +REQTOOLS="${REQTOOLS} mkfs.${FSYS}" + # Are all the required tools present? PROG_MISSING="" for PROGN in ${REQTOOLS} ; do @@ -670,10 +814,10 @@ fi # Collect data from the USB initrd: IMGDIR=$(extract_initrd ${ISOMNT}/boot/initrd.img) -read_initrd ${IMGDIR} +read_initrddir ${IMGDIR} "DISTRO LIVEMAIN MARKER MEDIALABEL" # Collect customization parameters for the ISO: -read_config ${SLISO} +read_isoconfig ${SLISO} # Determine where in LUKSVOL the /home is defined. # The LUKSVOL value looks like: @@ -763,7 +907,7 @@ if [ ${#CONTAINERS[@]} -gt 0 ]; then fi # Write customization parameters for the ISO to disk: -write_config ${SLISO} +write_isoconfig ${SLISO} # Write ISO version to the liveslak rootdir if that exists: if [ -d "${USBMNT}/${LIVESLAKROOT}" ]; then diff --git a/liveinit.tpl b/liveinit.tpl index 55fd893..c4fd29a 100644 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -2,7 +2,7 @@ # # Copyright 2004 Slackware Linux, Inc., Concord, CA, USA # Copyright 2007, 2008, 2009, 2010, 2012 Patrick J. Volkerding, Sebeka, MN, USA -# Copyright 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Eric Hameleers, Eindhoven, NL +# Copyright 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -168,6 +168,11 @@ if grep devtmpfs /proc/filesystems 1>/dev/null 2>/dev/null ; then mount -n devtmpfs /dev -t devtmpfs -o size=8M fi +# Mount if this directory exists (so the kernel supports efivarfs): +if [ -d /sys/firmware/efi/efivars ]; then + mount -o rw -t efivarfs none /sys/firmware/efi/efivars +fi + # Parse command line for ARG in $(cat /proc/cmdline); do case $ARG in @@ -195,7 +200,7 @@ for ARG in $(cat /proc/cmdline); do # generic syntax: hostname=newname[,qualifier] LIVE_HOSTNAME=$(echo $ARG | cut -f2 -d= | cut -f1 -d,) # Allow for the user to (mistakenly) add a domain component: - if [ $(echo $LIVE_HOSTNAME |cut -d. -f1- --output-delimiter ' '|wc -w) -gt 1 ]; then + if [ -n "$(echo "$LIVE_HOSTNAME". |cut -d. -f2-)" ]; then LIVE_DOMAIN=$(echo $LIVE_HOSTNAME |cut -d. -f2-) LIVE_HOSTNAME=$(echo $LIVE_HOSTNAME |cut -d. -f1) fi @@ -476,6 +481,8 @@ if [ "$RESCUE" = "" ]; then echo "/run/dhcpcd-${MYDEV}.pid" elif [ -s /run/dhcpcd-${MYDEV}-4.pid ]; then echo "/run/dhcpcd-${MYDEV}-4.pid" + elif [ -s /run/${MYDEV}.pid ]; then + echo "/run/${MYDEV}.pid" else echo UNKNOWNLOC fi @@ -593,13 +600,13 @@ if [ "$RESCUE" = "" ]; then mknod -m660 $lodev b 7 $(echo $lodev |sed 's%/dev/loop%%') fi echo "$lodev" - } + } # End find_loop() mod_base() { MY_MOD="$1" echo $(basename ${MY_MOD}) |rev |cut -d. -f2- |rev - } + } # End mod_base() find_mod() { MY_LOC="$1" @@ -621,7 +628,7 @@ if [ "$RESCUE" = "" ]; then done ) | sort fi - } + } # End find_mod() find_modloc() { MY_LOC="$1" @@ -639,14 +646,19 @@ if [ "$RESCUE" = "" ]; then fi echo "${MY_LOC}" - } + } # End find_modloc() load_modules() { # SUBSYS can be 'system', 'addons', 'optional', 'core2ram': SUBSYS="$1" # Find all supported modules: - for MODULE in $(find_mod /mnt/media/${LIVEMAIN}/${SUBSYS}/) $(find_mod ${SUPERMNT}/${LIVESLAKROOT}/${LIVEMAIN}/${SUBSYS}/) ; do + SUBSYSSET="$(find_mod /mnt/media/${LIVEMAIN}/${SUBSYS}/) $(find_mod ${SUPERMNT}/${LIVESLAKROOT}/${LIVEMAIN}/${SUBSYS}/)" + if [ "$SUBSYS" = "optional" ]; then + # We need to load any core2ram modules first: + SUBSYSSET="$(find_mod /mnt/media/${LIVEMAIN}/core2ram/) $(find_mod ${SUPERMNT}/${LIVESLAKROOT}/${LIVEMAIN}/core2ram/ ${SUBSYSSET})" + fi + for MODULE in ${SUBSYSSET} ; do # Strip path and extension from the modulename: MODBASE="$(mod_base ${MODULE})" if [ "$SUBSYS" = "optional" ]; then @@ -694,10 +706,10 @@ if [ "$RESCUE" = "" ]; then echo "${MARKER}: '$SUBSYS' modules were not found. Trouble ahead..." fi fi - } + } # End load_modules() # Function input is a series of device node names. Return all block devices: - ret_blockdev () { + ret_blockdev() { local OUTPUT="" for IDEV in $* ; do if [ -e /sys/block/$(basename $IDEV) ]; then @@ -707,10 +719,10 @@ if [ "$RESCUE" = "" ]; then done # Trim trailing space: echo $OUTPUT |cat - } + } # End ret_blockdev() # Function input is a series of device node names. Return all partitions: - ret_partition () { + ret_partition() { local OUTPUT="" for IDEV in $* ; do if [ -e /sys/class/block/$(basename $IDEV)/partition ]; then @@ -720,7 +732,7 @@ if [ "$RESCUE" = "" ]; then done # Trim trailing space: echo $OUTPUT |cat - } + } # End ret_partition() # Return device node of Ventoy partition if found: # Function input: @@ -731,7 +743,7 @@ if [ "$RESCUE" = "" ]; then # return the device node for the partition containing the ISO file; # 'diskuuid' request: return the UUID for the disk; # 'partnr' request: return the number of the partition containing the ISO; - ret_ventoy () { + ret_ventoy() { local VOSPARMS="$1" local VACTION="$2" local DISKSIZE="" @@ -783,7 +795,38 @@ if [ "$RESCUE" = "" ]; then echo scandev fi fi - } + } # End ret_ventoy() + + # Find partition on which a file resides: + # Function input: + # (param 1) Full path to the file we are looking for + # (param 2) Directory to mount the partition containing our file + # Use $(df $MYMNT |tail -1 |tr -s ' ' |cut -d' ' -f1) to find that partition, + # it will remain mounted on the provided mountpoint upon function return. + scan_part() { + local FILEPATH="$1" + local MYMNT="$2" + local ISOPART="" + local PARTFS="" + echo "${MARKER}: Scanning for '$FILEPATH'..." + for ISOPART in $(ret_partition $(blkid |cut -d: -f1)) $(ret_blockdev $(blkid |cut -d: -f1)) ; do + PARTFS=$(blkid $ISOPART |rev |cut -d'"' -f2 |rev) + mount -t $PARTFS -o ro $ISOPART ${MYMNT} + if [ -f "${MYMNT}/${FILEPATH}" ]; then + # Found our file! + unset ISOPART + break + else + umount $ISOPART + fi + done + if [ -n "$ISOPART" ]; then + echo "${MARKER}: Partition scan unable to find $(basename $FILEPATH), trouble ahead." + return 1 + else + return 0 + fi + } # End scan_part() ## End support functions ## @@ -813,18 +856,32 @@ if [ "$RESCUE" = "" ]; then VENTID="VentoyOsParam-77772020-2e77-6576-6e74-6f792e6e6574" VENTVAR="/sys/firmware/efi/vars/${VENTID}" if [ ! -d "${VENTVAR}" ]; then + # Newer Slackware will use 'efivars' rather than 'vars' directory; VENTVAR="/sys/firmware/efi/efivars/${VENTID}" fi if [ -d "${VENTVAR}" ]; then echo "${MARKER}: (UEFI) Ventoy ISO boot detected..." ISOBOOT="ventoy" VENTOSPARM="${VENTVAR}/data" + elif [ -f "${VENTVAR}" ]; then + # Kernel >= 6.x does not offer a clean data sctructure, so we need to + # find the offset of the data block in the efivars file: + cat "${VENTVAR}" > /vent.dmp else # Detect Ventoy in memory (don't use the provided hooks), see # https://www.ventoy.net/en/doc_compatible_format.html: dd if=/dev/mem of=/vent.dmp bs=1 skip=$((0x80000)) count=$((0xA0000-0x80000)) 2>/dev/null + fi + if [ -f /vent.dmp ]; then + # Use 'strings' to find the decimal offset of the magic string; # With 'xargs' we remove leading and ending spaces: - OFFSET=$(strings -t d /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + if strings -t d /vent.dmp 1>/dev/null 2>/dev/null ; then + # Busybox in Slackware 15.0 or newer: + OFFSET=$(strings -t d /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + else + # Busybox in Slackware 14.2 or older: + OFFSET=$(strings -o /vent.dmp |grep ' www.ventoy.net' |xargs |cut -d' ' -f1) + fi if [ -n "${OFFSET}" ]; then echo "${MARKER}: (BIOS) Ventoy ISO boot detected..." ISOBOOT="ventoy" @@ -932,25 +989,12 @@ if [ "$RESCUE" = "" ]; then mkdir -p ${SUPERMNT} # if [ "$LIVEMEDIA" = "scandev" ]; then - # Scan partitions to find the one with the ISO and set LIVEMEDIA: - echo "${MARKER}: Scanning for '$LIVEPATH'..." - for ISOPART in $(ret_partition $(blkid |cut -d: -f1)) $(ret_blockdev $(blkid |cut -d: -f1)) ; do - PARTFS=$(blkid $ISOPART |rev |cut -d'"' -f2 |rev) - # Abuse the $SUPERMNT a bit, we will actually use it later: - mount -t $PARTFS -o ro $ISOPART ${SUPERMNT} - if [ -f ${SUPERMNT}/${LIVEPATH} ]; then - # Found our ISO! - LIVEMEDIA=$ISOPART - umount $ISOPART - unset ISOPART - break - else - umount $ISOPART - fi - done - if [ -n "$ISOPART" ]; then - echo "${MARKER}: Partition scan unable to find ISO, trouble ahead." - fi + # Scan partitions to find the one with the ISO and set LIVEMEDIA. + # Abuse the $SUPERMNT a bit, we will actually use it later. + # TODO: proper handling of scan_part return code. + scan_part ${LIVEPATH} ${SUPERMNT} + LIVEMEDIA="$(df ${SUPERMNT} 2>/dev/null |tail -1 |tr -s ' ' |cut -d' ' -f1)" + umount ${SUPERMNT} fi # At this point we know $LIVEMEDIA - either because the bootparameter # specified it or else because the 'scandev' found it for us. @@ -1083,7 +1127,7 @@ if [ "$RESCUE" = "" ]; then # Load a custom keyboard mapping: if [ -n "$KEYMAP" ]; then - echo "${MARKER}: Loading '$KEYMAP' keyboard mapping:" + echo "${MARKER}: Loading '$KEYMAP' keyboard mapping." tar xzOf /etc/keymaps.tar.gz ${KEYMAP}.bmap | loadkmap fi @@ -1439,7 +1483,7 @@ if [ "$RESCUE" = "" ]; then # Let Slackware mount the unlocked container: luksfs=$(blkid /dev/mapper/$luksnam |rev |cut -d'"' -f2 |rev) - if ! grep -q /dev/mapper/$luksnam /mnt/overlay/etc/fstab ; then + if ! grep -q "^/dev/mapper/$luksnam" /mnt/overlay/etc/fstab ; then echo "/dev/mapper/$luksnam $luksmnt $luksfs defaults 1 1" >> /mnt/overlay/etc/fstab fi # On shutdown, ensure that the container gets locked again: @@ -1629,7 +1673,7 @@ EOPW mkdir -p /mnt/overlay/run/dhcpcd mount --bind /run/dhcpcd /mnt/overlay/run/dhcpcd fi - cp -a /run/dhcpcd* /mnt/overlay/run/ + cp -a /run/dhcpcd* /run/${INTERFACE}.pid /mnt/overlay/run/ cat /etc/resolv.conf > /mnt/overlay/etc/resolv.conf # Disable NetworkManager: @@ -1783,7 +1827,7 @@ EOT done if [ $RUN_DEPMOD -eq 1 ]; then # This costs a few seconds in additional boot-up time unfortunately: - echo "${MARKER}: Additional kernel module(s) found... need a bit" + echo "${MARKER}: Additional kernel module(s) found... need a bit" chroot /mnt/overlay /sbin/depmod -a fi unset RUN_DEPMOD @@ -1794,11 +1838,14 @@ EOT # In case of network boot, do not kill the network, umount NFS prematurely # or stop udevd on shutdown: if [ -n "$NFSHOST" ]; then - sed -i /mnt/overlay/etc/rc.d/rc.0 \ - -e "/on \/ type nfs/s%grep -q 'on / type nfs'%egrep -q 'on / type (nfs|tmpfs)'%" \ - -e '/umount.*nfs/s/nfs,//' \ - -e 's/rc.udev force-stop/rc.udev stop/' \ - -e 's/$(pgrep mdmon)/& $(pgrep udevd)/' + for RUNLVL in 0 6 ; do + sed -i /mnt/overlay/etc/rc.d/rc.${RUNLVL} \ + -e "/on \/ type nfs/s%grep -q 'on / type nfs'%egrep -q 'on / type (nfs|tmpfs)'%" \ + -e "s%'on / type nfs4'%& -e 'on / type overlay'%" \ + -e '/umount.*nfs/s/nfs,//' \ + -e 's/rc.udev force-stop/rc.udev stop/' \ + -e 's/$(pgrep mdmon)/& $(pgrep udevd)/' + done fi # Copy contents of rootcopy directory (may be empty) to overlay: @@ -1835,8 +1882,8 @@ fi /sbin/udevadm control --exit unset ERR -umount /proc -umount /sys +umount /proc 2>/dev/null +umount /sys 2>/dev/null umount /run 2>/dev/null echo "${MARKER}: Slackware Live system is ready." diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 7932786..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, 2020, 2021, 2022 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,7 @@ # ----------------------------------------------------------------------------- # Version of the Live OS generator: -VERSION="1.6.0.1" +VERSION="1.8.1.1" # Timestamp: THEDATE=$(date +%Y%m%d) @@ -84,9 +84,11 @@ MOKCERT="" # to be defined through the '-S' parameter: MOKPRIVKEY="" -# Set to NO if you want to use the non-SMP kernel on 32bit Slackware. -# note: unsupported option since Slackware enabled preemption in 5.14.15. -SMP32=${SMP32:-"YES"} +# 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"} @@ -179,8 +181,9 @@ ONLY_ISO="NO" # The name of the directory used for storing persistence data: PERSISTENCE=${PERSISTENCE:-"persistence"} -# Add a Core OS to load into RAM (currently supported for XFCE, LEAN, DAW): +# 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): @@ -200,11 +203,17 @@ 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,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 local:mcpp" +SEQ_XFCEBASE="pkglist:${MINLIST},noxbase,x_base,xapbase,xfcebase local:mcpp" # Stripped-down Base Slackware: SEQ_LEAN="pkglist:${MINLIST},noxbase,x_base,xapbase,xfcebase,slackpkgplus,z00_plasma5supp,z01_plasma5base,z01_swdev" @@ -216,7 +225,7 @@ SEQ_DAW="pkglist:${MINLIST},noxbase,x_base,xapbase,slackpkgplus,z00_plasma5supp, # Slackware with 'ktown' Plasma5 instead of its own KDE (full install): # - each will become a squashfs module: -SEQ_KTOWN="tagfile:a,ap,d,e,f,k,l,n,t,tcl,x,xap,xfce,y pkglist:ktown,ktownalien,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 (full install): # - each will become a squashfs module: @@ -237,6 +246,7 @@ SEQ_STUDW="tagfile:a,ap,d,e,f,k,kde,l,n,t,tcl,x,xap,xfce,y pkglist:slackextra,sl # 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: @@ -247,7 +257,7 @@ TESTINGLIST_DAW="" # 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; # Virtio modules added to experiment with liveslak in a VM. -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: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: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"} +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 kernel/drivers/virtio" @@ -262,7 +272,7 @@ NETFIRMWARE="3com acenic adaptec bnx tigon e100 sun kaweth tr_smctr cxgb3 rtl_ni # 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_KTOWN="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" @@ -348,9 +358,9 @@ function cleanup() { 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} @@ -482,6 +492,16 @@ 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 @@ -727,6 +747,7 @@ function gen_bootmenu() { -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) @@ -772,6 +793,7 @@ EOL -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: @@ -802,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} @@ -832,12 +854,13 @@ function gen_uefimenu() { -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 @@ -883,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 @@ -890,35 +916,46 @@ 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() @@ -971,8 +1008,8 @@ function secureboot() { if [ "${SHIM_VENDOR}" = "fedora" ]; then # The version of Fedora's shim package - always use the latest! - SHIM_MAJVER=15.4 - SHIM_MINVER=5 + 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 - \ @@ -988,7 +1025,7 @@ function secureboot() { # ${LIVE_STAGING}/EFI/BOOT/fbx64.efi elif [ "${SHIM_VENDOR}" = "opensuse" ]; then SHIM_MAJVER=15.4 - SHIM_MINVER=4.2 + 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 - \ @@ -1003,10 +1040,10 @@ function secureboot() { #install -D -m0644 usr/share/efi/x86_64/fallback.efi \ # ${LIVE_STAGING}/EFI/BOOT/fallback.efi elif [ "${SHIM_VENDOR}" = "debian" ]; then - DEBSHIM_VER=1.38 + DEBSHIM_VER=1.40 DEBMOKM_VER=1 - SHIM_MAJVER=15.4 - SHIM_MINVER=7 + 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." @@ -1204,7 +1241,7 @@ EOT # 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.deskop + THEMEFIL=/usr/share/plasma/desktoptheme/default/metadata.desktop else # Frameworks 5.94.0 and newer: THEMEFIL=/usr/share/plasma/desktoptheme/default/plasmarc @@ -1234,6 +1271,18 @@ 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() # --------------------------------------------------------------------------- @@ -1266,6 +1315,7 @@ do 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" @@ -1278,7 +1328,7 @@ do echo " -v Show debug/error output." echo " -z version Define your ${DISTRO^} version (default: $SL_VERSION)." echo " -C Add RAM-based Console OS to boot menu." - echo " -G Generate ISO file from existing directory tree" + echo " -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." @@ -1407,20 +1457,18 @@ case "$LIVEDE" in ;; esac -if [ "${CORE2RAM}" == "YES" ] || [ "${LIVEDE}" == "XFCE" ] || [ "${LIVEDE}" == "LEAN" ] || [ "${LIVEDE}" == "DAW" ] ; then - # For now, allow CORE2RAM only for the variants that actually - # have the required modules in their system list. - # TODO: create these modules separately in the 'core2ram' subdirectory. - for MY_MOD in ${CORE2RAMMODS} ; do - if ! echo ${MSEQ} | grep -wq ${MY_MOD} ; then - echo ">> Modules required for Core RAM-based OS (${CORE2RAMMODS}) not available." - exit 1 - fi - done - # Whether to hide the Core OS menu on boot yes or no: - C2RMH="#" +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="" + C2RMH="" # syslinux + C2RMS="#" # grub fi if ! cat ${LIVE_TOOLDIR}/languages |grep -Ev '(^ *#|^$)' |grep -q ^${DEF_LANG}: @@ -1520,6 +1568,11 @@ 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} @@ -1551,7 +1604,7 @@ 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 @@ -1589,6 +1642,12 @@ RODIRS="${LIVE_BOOT}" # Create the verification file for the install_pkgs function: echo "${THEDATE} (${BUILDER})" > ${LIVE_BOOT}/${MARKER} +# 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." @@ -1628,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 @@ -1645,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 @@ -1719,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: @@ -1744,6 +1807,7 @@ sed -e "s/^\(127.0.0.1\t*\)darkstar.*/\1${LIVE_HOSTNAME}.home.arpa ${LIVE_HOSTNA cat <<EOT >> ${LIVE_ROOTDIR}/etc/resolv.conf nameserver 8.8.4.4 nameserver 8.8.8.8 +nameserver 1.1.1.1 EOT @@ -1761,7 +1825,7 @@ 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: -ln -s /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 @@ -1836,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 @@ -2056,7 +2130,7 @@ 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}/ @@ -2111,6 +2185,7 @@ 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 @@ -2522,14 +2597,14 @@ EOT fi # End KDE4 -# Only configure for Plasma5 if it is actually installed: -if [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/kf5 ]; then +# 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 Plasma5 based variant. + # This section is for any Plasma based variant. # Install a custom login/desktop/lock background if an image is present: plasma5_custom_bg @@ -2538,7 +2613,7 @@ if [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/kf5 ]; then 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 @@ -2551,6 +2626,12 @@ if [ -d ${LIVE_ROOTDIR}/usr/lib${DIRSUFFIX}/kf5 ]; then # 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 @@ -2578,6 +2659,18 @@ 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] @@ -2640,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 @@ -2650,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: @@ -2672,21 +2779,53 @@ EOT 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 Qt5 applications: +# 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 Qt5 applications: +# 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.* -fi # End Plasma5 +# 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 @@ -3106,6 +3245,10 @@ 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: @@ -3216,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} # ----------------------------------------------------------------------------- @@ -3223,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}/* @@ -3243,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 @@ -3294,6 +3441,12 @@ 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} \ @@ -3347,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} @@ -3361,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/ @@ -3387,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 \ diff --git a/media/ktown/bg/background.jpg b/media/ktown/bg/background.jpg new file mode 120000 index 0000000..06b955d --- /dev/null +++ b/media/ktown/bg/background.jpg @@ -0,0 +1 @@ +rauwven.jpg
\ No newline at end of file diff --git a/media/ktown/bg/rauwven.jpg b/media/ktown/bg/rauwven.jpg Binary files differnew file mode 100644 index 0000000..f1d4a6e --- /dev/null +++ b/media/ktown/bg/rauwven.jpg diff --git a/media/lean/bg/background.jpg b/media/lean/bg/background.jpg index 768d1ee..2094cf4 120000 --- a/media/lean/bg/background.jpg +++ b/media/lean/bg/background.jpg @@ -1 +1 @@ -ruwenberg.jpg
\ No newline at end of file +willibrordhaeghe.jpg
\ No newline at end of file diff --git a/media/lean/bg/groedezeeland.jpg b/media/lean/bg/groedezeeland.jpg Binary files differnew file mode 100644 index 0000000..84020cb --- /dev/null +++ b/media/lean/bg/groedezeeland.jpg diff --git a/media/lean/bg/theme b/media/lean/bg/theme new file mode 100644 index 0000000..37a6131 --- /dev/null +++ b/media/lean/bg/theme @@ -0,0 +1,2 @@ +# either 'dark' or 'light' +dark diff --git a/media/lean/bg/willibrordhaeghe.jpg b/media/lean/bg/willibrordhaeghe.jpg Binary files differnew file mode 100644 index 0000000..f10685a --- /dev/null +++ b/media/lean/bg/willibrordhaeghe.jpg diff --git a/pkglists/alien.lst b/pkglists/alien.lst index c5ba85b..9672d5f 100644 --- a/pkglists/alien.lst +++ b/pkglists/alien.lst @@ -20,7 +20,6 @@ gst-plugins-libav icedtea-web icu4c-compat keepassxc -#lame libreoffice #libreoffice-dict-af #libreoffice-dict-ar @@ -68,17 +67,14 @@ libreoffice libstatgrab #libtinfo libtorrent-rasterbar -#lumina #mkvtoolnix muparser netsurf nodejs -#nvme-cli openconnect openjdk11 #oxygen-gtk2 p7zip -#palemoon podofo poppler-qt5 python-twisted diff --git a/pkglists/cinnamon.lst b/pkglists/cinnamon.lst index 8cd76cf..752fe73 100644 --- a/pkglists/cinnamon.lst +++ b/pkglists/cinnamon.lst @@ -30,7 +30,9 @@ libgusb libtimezonemap libsass metacity +mint-cursor-themes mint-themes +mint-l-icons mint-y-icons mint-y-theme mozjs @@ -48,11 +50,13 @@ pygobject3-python3 python-pam python3 python3-xapp +python3-webencodings pytz sassc setproctitle speex tinycss +tinycss2 vala xapp xapps diff --git a/pkglists/ktown.conf b/pkglists/ktown.conf index 856f899..cd37cae 100644 --- a/pkglists/ktown.conf +++ b/pkglists/ktown.conf @@ -2,7 +2,9 @@ # or empty directory, then the content of 'SL_REPO_URL' will be rsync-ed # to the local directory 'SL_REPO'. -VARIANT=latest +# Either 'latest' or 'testing': +VARIANT=testing + if [ "${SL_ARCH}" == "x86_64" ]; then LIBSUFFIX="64" else diff --git a/pkglists/ktown.lst b/pkglists/ktown.lst index 3f85b71..18d8c74 100644 --- a/pkglists/ktown.lst +++ b/pkglists/ktown.lst @@ -1,74 +1,179 @@ -# Slackware Plasma5 deps: -SDL2 -QtAV -accountsservice -cfitsio -cryfs -cryptopp -dbus -dotconf -dvdauthor -eigen3 -elogind -frei0r-plugins -grantlee +# Slackware Plasma6 deps: +futuresql +gpgme kdsoap -lensfun -libappindicator -libburn -libdbusmenu -libdbusmenu-qt -libdmtx -libindicator -libqalculate -libsass -mlt +libQuotient +libdisplay-info +libfprint +olm opencv phonon -phonon-backend-gstreamer -pipewire -polkit polkit-qt-1 -qrencode -qt5 +poppler +python-html5lib +python-webencodings +qca +qcoro +qt6 qtkeychain quazip -rttr -sassc -speech-dispatcher -upower -vid.stab -# Slackware Plasma5 input-methods: -OpenCC -cldr-emoji-annotation -fcitx -fcitx-anthy -fcitx-configtool -fcitx-hangul -fcitx-kkc -fcitx-libpinyin -fcitx-m17n -fcitx-qt5 -fcitx-sayura -fcitx-table-extra -fcitx-table-other -fcitx-unikey -ibus -ibus-anthy -ibus-hangul -ibus-kkc -ibus-libpinyin -ibus-m17n -ibus-table -ibus-unikey -kcm-fcitx -libgee -libkkc -libkkc-data -libpinyin -marisa -skkdic -# Slackware Plasma5: +wayland-utils +# +# Slackware Plasma6: +# +# Frameworks 5: +attica-5 +baloo-5 +frameworkintegration-5 +kactivities-5 +kactivities-stats-5 +kapidox-5 +karchive-5 +kauth-5 +kbookmarks-5 +kcalendarcore-5 +kcmutils-5 +kcodecs-5 +kcompletion-5 +kconfig-5 +kconfigwidgets-5 +kcontacts-5 +kcoreaddons-5 +kcrash-5 +kdav-5 +kdbusaddons-5 +kdeclarative-5 +kded-5 +kdesignerplugin-5 +kdesu-5 +kdewebkit-5 +kdnssd-5 +kdoctools-5 +kemoticons-5 +kfilemetadata-5 +kglobalaccel-5 +kguiaddons-5 +kholidays-5 +khtml-5 +ki18n-5 +kiconthemes-5 +kidletime-5 +kimageformats-5 +kinit-5 +kio-5 +kirigami-5 +kitemmodels-5 +kitemviews-5 +kjobwidgets-5 +kjs-5 +kjsembed-5 +kmediaplayer-5 +knewstuff-5 +knotifications-5 +knotifyconfig-5 +kpackage-5 +kparts-5 +kpeople-5 +kplotting-5 +kpty-5 +kquickcharts-5 +kross-5 +krunner-5 +kservice-5 +ktexteditor-5 +ktextwidgets-5 +kunitconversion-5 +kwallet-5 +kwayland-5 +kwidgetsaddons-5 +kwindowsystem-5 +kxmlgui-5 +kxmlrpcclient-5 +plasma-framework-5 +prison-5 +purpose-5 +qqc2-breeze5-style +qqc2-desktop-style-5 +solid-5 +sonnet-5 +syndication-5 +syntax-highlighting-5 +threadweaver-5 +# Frameworks: +attica +baloo +bluez-qt +breeze-icons +extra-cmake-modules +frameworkintegration +kapidox +karchive +kauth +kbookmarks +kcalendarcore +kcmutils +kcodecs +kcolorscheme +kcompletion +kconfig +kconfigwidgets +kcontacts +kcoreaddons +kcrash +kdav +kdbusaddons +kdeclarative +kded +kdesu +kdnssd +kdoctools +kfilemetadata +kglobalaccel +kguiaddons +kholidays +ki18n +kiconthemes +kidletime +kimageformats +kio +kirigami +kitemmodels +kitemviews +kjobwidgets +knewstuff +knotifications +knotifyconfig +kpackage +kparts +kpeople +kplotting +kpty +kquickcharts +krunner +kservice +kstatusnotifieritem +ksvg +ktexteditor +ktexttemplate +ktextwidgets +kunitconversion +kuserfeedback +kwallet +kwidgetsaddons +kwindowsystem +kxmlgui +modemmanager-qt +networkmanager-qt +oxygen-icons +prison +purpose +qqc2-desktop-style +solid +sonnet +syndication +syntax-highlighting +threadweaver +# KDEPIM: akonadi akonadi-calendar akonadi-calendar-tools @@ -79,197 +184,250 @@ akonadi-notes akonadi-search akonadiconsole akregator -alkimia +calendarsupport +eventviews +grantlee-editor +grantleetheme +incidenceeditor +kaddressbook +kalarm +kcalutils +kdepim-addons +kdepim-runtime +khealthcertificate +kidentitymanagement +kimap +kitinerary +kldap +kleopatra +kmail +kmail-account-wizard +kmailtransport +kmbox +kmime +knotes +kontact +kontactinterface +kopeninghours +korganizer +kpimtextedit +kpkpass +ksmtp +ktnef +libgravatar +libkdepim +libkgapi +libkleo +libksieve +mailcommon +mailimporter +mbox-importer +messagelib +mimetreeparser +pim-data-exporter +pim-sieve-editor +pimcommon +# Plasma: +#breeze-plymouth +#discover +#ksysguard +#lancelot +#plasma-mobile +#plasma-nano +#plasma-tests +#plasma-thunderbolt +#plasma-welcome +#plymouth-kcm +bluedevil +breeze +breeze-grub +breeze-gtk +drkonqi +kactivitymanagerd +kde-cli-tools +kde-gtk-config +kdecoration +kdeplasma-addons +kgamma +kglobalacceld +kinfocenter +kmenuedit +kpipewire +kscreen +kscreenlocker +ksshaskpass +ksystemstats +kwallet-pam +kwayland +kwayland-integration +kwin +kwrited +layer-shell-qt +libkscreen +libksysguard +libplasma +milou +ocean-sound-theme +oxygen +oxygen-sounds +plasma-activities +plasma-activities-stats +plasma-browser-integration +plasma-desktop +plasma-disks +plasma-firewall +plasma-integration +plasma-nm +plasma-pa +plasma-sdk +plasma-systemmonitor +plasma-vault +plasma-workspace +plasma-workspace-wallpapers +plasma5support +polkit-kde-agent-1 +powerdevil +print-manager +qqc2-breeze-style +sddm-kcm +systemsettings +wacomtablet +xdg-desktop-portal-kde +# Plasma Extra: +##latte-dock +kirigami-addons +kmoretools +kpeoplevcard +ktextaddons +libqaccessibilityclient +oxygen-fonts +plasma-wayland-protocols +pulseaudio-qt +sddm +xwaylandvideobridge +# Applications: +#kajongg +# Still Qt5 based: +artikulate +cantor +cervisia +juk +kamoso +kde-dev-utils +kdesdk-thumbnailers +kdev-php +kdev-python +kdevelop +kgpg +kig +kio-gdrive +kipi-plugins +kmix +konversation +kqtquickcharts +krfb +ktouch +kwave +libkipi +lokalize +marble +poxml +rocs +umbrello +# End Qt5 based +#kaccounts-integration +#kaccounts-providers +#kalendar +#kalk +#kfloppy +#libkgeomap +#tokodon +alligator analitza ark -artikulate -attica audiocd-kio -baloo baloo-widgets blinken -bluedevil -bluez-qt bomber bovo -breeze -breeze-grub -breeze-gtk -breeze-icons -calendarsupport -calligra -calligraplan -cantor -cervisia -digikam +colord-kde dolphin dolphin-plugins dragon -drkonqi elisa -eventviews -extra-cmake-modules falkon ffmpegthumbs filelight -frameworkintegration +ghostwriter granatier -grantlee-editor -grantleetheme gwenview -incidenceeditor -juk +isoimagewriter +itinerary k3b -kactivities -kactivities-stats -kactivitymanagerd -kaddressbook -kalarm -kalarmcal kalgebra +kalk kalzium kamera -kamoso kanagram -kapidox kapman kapptemplate -karchive kate katomic -kauth kbackup kblackbox kblocks -kbookmarks kbounce kbreakout kbruch kcachegrind kcalc -kcalendarcore -kcalutils kcharselect -kcmutils -kcodecs kcolorchooser -kcompletion -kconfig -kconfigwidgets -kcontacts -kcoreaddons -kcrash kcron -kdav -kdbusaddons -kde-cli-tools kde-dev-scripts -kde-dev-utils -kde-gtk-config +kde-inotify-survey kdebugsettings -kdeclarative kdeconnect-kde -kdecoration -kded kdeedu-data kdegraphics-mobipocket kdegraphics-thumbnailers -kdelibs4support kdenetwork-filesharing kdenlive -kdepim-addons -kdepim-apps-libs -kdepim-runtime -kdeplasma-addons -kdesdk-kioslaves -kdesdk-thumbnailers -kdesignerplugin -kdesu -kdev-php -kdev-python -kdevelop -kdevelop-pg-qt -kdewebkit +kdesdk-kio kdf -kdiagram kdialog kdiamond -kdnssd -kdoctools keditbookmarks -kemoticons -kfilemetadata +keysmith kfind -kfloppy kfourinline -kgamma5 kgeography kget -kglobalaccel kgoldrunner -kgpg -kguiaddons khangman khelpcenter -kholidays -khotkeys -khtml -ki18n -kiconthemes -kid3 -kidentitymanagement -kidletime -kig kigo -kile killbots -kimageformats kimagemapeditor -kimap -kinfocenter -kinit -kio +kio-admin kio-extras -kio-gdrive -kipi-plugins +kio-zeroconf kirigami-gallery -kirigami2 kiriki -kitemmodels -kitemviews kiten -kitinerary -kjobwidgets -kjots -kjs -kjsembed kjumpingcube -kldap -kleopatra +klettres klickety klines kmag kmahjongg -kmail -kmail-account-wizard -kmailtransport -kmbox -kmediaplayer -kmenuedit -kmime kmines -kmix kmousetool kmouth kmplot -kmymoney knavalbattle knetwalk -knewstuff knights -knotes -knotifications -knotifyconfig kolf kollision kolourpaint @@ -277,153 +435,78 @@ kompare konqueror konquest konsole -kontact -kontactinterface -kopete -korganizer -kpackage -kparts +kontrast +kosmindoormap kpat -kpeople -kpeoplevcard -kpimtextedit -kpkpass -kplotting kpmcore -kpty -kqtquickcharts -kquickcharts +kpublictransport krdc -krename kreversi -krfb -krita -kross -kross-interpreters kruler -krunner -krusader -kscreen -kscreenlocker -kservice +ksanecore kshisen ksirk -ksmtp ksnakeduel kspaceduel ksquares -ksshaskpass -kstars ksudoku -ksysguard ksystemlog kteatime -ktexteditor -ktextwidgets ktimer -ktimetracker -ktnef ktorrent -ktouch +ktuberling kturtle kubrick -kunitconversion -kwallet -kwallet-pam kwalletmanager -kwave -kwayland -kwayland-integration -kwayland-server -kwidgetsaddons -kwin -kwindowsystem kwordquiz -kwrited -kxmlgui -kxmlrpcclient -latte-dock -libgravatar libkcddb libkcompactdisc libkdcraw libkdegames -libkdepim libkeduvocdocument libkexiv2 -libkgapi -libkgeomap -libkipi -libkleo libkmahjongg libkomparediff2 libksane -libkscreen -libksieve -libksysguard libktorrent -lokalize lskat -mailcommon -mailimporter -marble -mbox-importer -messagelib -milou +markdownpart +merkuro minuet -modemmanager-qt -networkmanager-qt -okteta okular -oxygen -oxygen-fonts -oxygen-gtk2 -oxygen-icons5 -oxygen-sounds palapeli parley partitionmanager picmi -pim-data-exporter -pim-sieve-editor -pimcommon -plasma-browser-integration -plasma-desktop -plasma-disks -plasma-framework -plasma-integration -plasma-nm -plasma-pa -plasma-sdk -plasma-vault -plasma-wayland-protocols -plasma-workspace -plasma-workspace-wallpapers -polkit-kde-agent-1 -powerdevil -poxml -print-manager -prison -pulseaudio-qt -purpose -qqc2-desktop-style -rocs -sddm -sddm-kcm skanlite -solid -sonnet +skanpage spectacle step svgpart sweeper -syndication -syntax-highlighting -systemsettings -threadweaver -umbrello -wacomtablet -xdg-desktop-portal-kde yakuake zanshin -zeroconf-ioslave +# Applications Extra: +##kstars +##labplot +#kuser +##alkimia +##calligra +##calligraplan +digikam +##kaudiocreator +kdevelop-pg-qt +kdiagram +kdsoap-ws-discovery-client +kid3 +##kile +kjots +kmymoney +krename +krita +krusader +ktimetracker +##okteta +oxygen-gtk2 +libkgapi-5 +# ------ diff --git a/pkglists/ktownalien.lst b/pkglists/ktownalien.lst index b6c6cf4..57bedaa 100644 --- a/pkglists/ktownalien.lst +++ b/pkglists/ktownalien.lst @@ -1,6 +1,5 @@ # Alien's packages that enrich the Plasma5 experience: NetworkManager-openconnect -freerdp openconnect vlc diff --git a/pkglists/ktownslack.lst b/pkglists/ktownslack.lst new file mode 100644 index 0000000..048f93d --- /dev/null +++ b/pkglists/ktownslack.lst @@ -0,0 +1,24 @@ +alkimia +#calligra +#calligraplan +fcitx5-configtool +fcitx5-theme-breeze +kColorPicker +kImageAnnotator +kaudiocreator +kdevelop +kdev-php +kdev-python +kile +kmymoney +kquickimageeditor +krita +kstars +labplot +latte-dock +libindi +libnova +okteta +stellarsolver +wcslib + diff --git a/pkglists/mate.lst b/pkglists/mate.lst index bb90716..9436ec0 100644 --- a/pkglists/mate.lst +++ b/pkglists/mate.lst @@ -14,6 +14,7 @@ libgksu libgtop libgxps libpeas +libsoup3 libunique libunique3 libwnck3 diff --git a/pkglists/min.lst b/pkglists/min.lst index ca0cfc3..a2cf1f6 100644 --- a/pkglists/min.lst +++ b/pkglists/min.lst @@ -5,12 +5,14 @@ aaa_libraries aaa_terminfo acl attr +avahi bash bin binutils # Add 'bind' at the end because it does a chroot: #bind bsd-games +btrfs-progs bzip2 ca-certificates coreutils @@ -27,6 +29,7 @@ dialog diffutils dmidecode dnsmasq +duktape e2fsprogs ed elilo @@ -34,6 +37,7 @@ elvis etc eudev exfatprogs +f2fs-tools file findutils floppy @@ -55,11 +59,13 @@ haveged hostname idnkit infozip +inih inotify-tools iproute2 iptables iputils jemalloc +jfsutils kbd kernel-generic kernel-firmware @@ -69,6 +75,7 @@ kmod krb5 less libassuan +libdaemon libedit libevent libgcrypt @@ -79,6 +86,7 @@ libksba libmnl ##libmpc libpwquality +libseccomp libtermcap libunistring libuv @@ -96,6 +104,8 @@ mozjs52 mozjs60 mozjs68 mozjs78 +mozjs102 +mozjs115 ##mpfr mtr nano @@ -142,14 +152,17 @@ sysvinit sysvinit-scripts tar terminus-font +tmux traceroute usbutils +userspace-rcu utempter util-linux wget which whois zstd +xfsprogs xxHash xz # Bind needs to run at the end: diff --git a/pkglists/multilib.lst b/pkglists/multilib.lst index 0fcbc6c..171377e 100644 --- a/pkglists/multilib.lst +++ b/pkglists/multilib.lst @@ -47,6 +47,7 @@ libtool-compat32 llvm-compat32 opencl-headers-compat32 # The L/ series: +Imath-compat32 Mako-compat32 SDL2-compat32 SDL2_gfx-compat32 @@ -115,6 +116,7 @@ libcdio-paranoia-compat32 libclc-compat32 libcroco-compat32 libdbusmenu-compat32 +libdeflate-compat32 libdvdnav-compat32 libedit-compat32 libexif-compat32 @@ -148,6 +150,7 @@ libunistring-compat32 libunwind-compat32 liburing-compat32 libusb-compat32 +libvisual-compat32 libvorbis-compat32 libvpx-compat32 libwebp-compat32 @@ -158,9 +161,11 @@ lmdb-compat32 lz4-compat32 lzo-compat32 mozilla-nss-compat32 +neon-compat32 ncurses-compat32 ocl-icd-compat32 openal-soft-compat32 +opencv-compat32 openexr-compat32 openjpeg-compat32 opus-compat32 @@ -173,6 +178,7 @@ polkit-compat32 popt-compat32 pulseaudio-compat32 python-six-compat32 +qrencode-compat32 qt-compat32 qt5-compat32 readline-compat32 @@ -183,6 +189,7 @@ seamonkey-solibs-compat32 slang-compat32 speex-compat32 speexdsp-compat32 +spirv-llvm-translator-compat32 startup-notification-compat32 svgalib-compat32 taglib-compat32 @@ -196,6 +203,7 @@ woff2-compat32 xxHash-compat32 zlib-compat32 zstd-compat32 +zxing-cpp-compat32 # The N/ series: curl-compat32 cyrus-sasl-compat32 @@ -205,6 +213,7 @@ libgcrypt-compat32 libgpg-error-compat32 libtirpc-compat32 nettle-compat32 +nghttp2-compat32 openldap-client-compat32 openldap-compat32 openssl-compat32 diff --git a/pkglists/noxbase.lst b/pkglists/noxbase.lst index a391860..f8bab71 100644 --- a/pkglists/noxbase.lst +++ b/pkglists/noxbase.lst @@ -7,6 +7,8 @@ alsa-oss alsa-plugins alsa-utils audiofile +##autoconf +##automake bc ##bison brotli @@ -16,6 +18,7 @@ db48 dbus dbus-glib ddrescue +efibootmgr efivar elfutils elogind @@ -28,6 +31,7 @@ gamin ##gccmakedep gdk-pixbuf2 gdk-pixbuf2-xlib +##gettext giflib glib-networking glib @@ -37,12 +41,14 @@ glibc-i18n htop icu4c ilmbase +iniparser ##intltool inxi ipw2100-fw ipw2200-fw isl iw +jansson js185 lcms2 libX11 @@ -59,11 +65,13 @@ libcddb libcdio libcdio-paranoia libcgroup +libdeflate libdvdnav libdvdread libexif libffi libgphoto2 +libgtop libical libieee1284 libimobiledevice @@ -80,6 +88,7 @@ libnih libnl libnl3 libnotify +libnvme libogg libpcap libpciaccess @@ -99,6 +108,7 @@ libtasn1 libtheora libtiff libtirpc +##libtool libusbmuxd libvorbis libvpx @@ -109,8 +119,10 @@ libxslt llvm lm_sensors lmdb +lsof lynx lzo +##m4 ##make mozilla-nss mpg123 @@ -121,6 +133,7 @@ newt nfs-utils nghttp2 nmap +nss-mdns ntfs-3g nvme-cli openexr @@ -129,6 +142,7 @@ orc os-prober p11-kit pm-utils +pkg-config pulseaudio radeontool rpcbind diff --git a/pkglists/x_base.lst b/pkglists/x_base.lst index 4896507..07a6ab8 100644 --- a/pkglists/x_base.lst +++ b/pkglists/x_base.lst @@ -1,5 +1,6 @@ ConsoleKit2 GConf +Imath Mako SDL2 SDL2_gfx @@ -23,6 +24,7 @@ cdrtools compositeproto cups cups-filters +cxxopts damageproto dbus-python dejavu-fonts-ttf @@ -62,6 +64,7 @@ fribidi fslsfonts fstobdf gcr +gcr4 gd gegl gexiv2 @@ -90,6 +93,7 @@ gtk+2 gtk+3 gtksourceview3 gtkspell +gtkspell3 gvfs harfbuzz hicolor-icon-theme @@ -211,8 +215,10 @@ pycairo pygobject pygobject3 pygtk +python2-pycairo python-MarkupSafe python-distro +qrencode randrproto recordproto rendercheck @@ -229,6 +235,7 @@ shared-mime-info showfont sinhala_lklug-font-ttf smproxy +sof-firmware speex spirv-llvm-translator startup-notification @@ -241,6 +248,7 @@ ttf-indic-fonts videoproto viewres vte +vulkan-sdk wayland wqy-zenhei-font-ttf x11-skel diff --git a/pkglists/xapbase.lst b/pkglists/xapbase.lst index 145abc8..03d497b 100644 --- a/pkglists/xapbase.lst +++ b/pkglists/xapbase.lst @@ -23,11 +23,13 @@ gucharmap gv hexchat imagemagick -jansson +# Needed in Core OS, moved to noxbase: +#jansson libcue libgnt libnice libnma +libptytty libsigc++ libsigc++3 libsodium @@ -43,6 +45,7 @@ polkit-gnome python-cffi python-pycparser rdesktop +ruby rxvt rxvt-unicode sane diff --git a/pkglists/z00_plasma5supp.lst b/pkglists/z00_plasma5supp.lst index 84227df..ff1b96b 100644 --- a/pkglists/z00_plasma5supp.lst +++ b/pkglists/z00_plasma5supp.lst @@ -1,6 +1,7 @@ # # Libraries and programs to support a basic Plasma5 installation: # +#Imath #LibRaw PyQt5 QScintilla @@ -77,7 +78,7 @@ libpinyin libqalculate libraw1394 libsass -libseccomp +#libseccomp libspectre liburing libva-utils @@ -109,14 +110,15 @@ python-PyYAML python-doxypypy python-doxyqml qca -qrencode +#qrencode qt5 qt5-webkit qtkeychain rttr -ruby +#ruby rxvt # xapbase: +#libptytty #rxvt-unicode #sane # x_base: @@ -130,7 +132,7 @@ taglib-extras # x_base: #vim #vim-gvim -vulkan-sdk +#vulkan-sdk woff2 xcb-util-cursor xcb-util-errors diff --git a/pkglists/z01_plasma5base.lst b/pkglists/z01_plasma5base.lst index 6ffdb14..bb5c62c 100644 --- a/pkglists/z01_plasma5base.lst +++ b/pkglists/z01_plasma5base.lst @@ -44,6 +44,8 @@ kidletime kimageformats kinit kio +kio-admin +kirigami-addons kirigami2 kitemmodels kitemviews @@ -158,6 +160,7 @@ khelpcenter khotkeys kinfocenter kmenuedit +kpipewire kscreen kscreenlocker ksshaskpass @@ -273,6 +276,7 @@ kgpg #killbots kimagemapeditor kio-extras +kio-zeroconf kirigami-gallery #kiriki #kiten @@ -310,6 +314,7 @@ krdc #kreversi krfb #kruler +ksanecore #kshisen #ksirk #ksnakeduel @@ -351,6 +356,8 @@ okular #poxml print-manager #rocs +skanlite +skanpage spectacle #step #svgpart @@ -358,6 +365,7 @@ spectacle #umbrello #zanshin zeroconf-ioslave +zxing-cpp # applications-extra: #alkimia @@ -365,6 +373,13 @@ zeroconf-ioslave #calligraplan #digikam falkon +ktextaddons +kColorPicker +kImageAnnotator +#immer +#lager +#libunibreak +#zug #krita #kdev-php #kdev-python @@ -376,7 +391,7 @@ falkon #kile #kjots #kmymoney -#kpmcore +kpmcore #krename #krusader #kstars @@ -385,7 +400,6 @@ falkon #kuser libktorrent #partitionmanager -skanlite # Issues with 3 files in the squashfs module missing the last character: plasma-workspace diff --git a/pkglists/z01_plasma5extra.lst b/pkglists/z01_plasma5extra.lst index 3943867..744e3f6 100644 --- a/pkglists/z01_plasma5extra.lst +++ b/pkglists/z01_plasma5extra.lst @@ -1,5 +1,6 @@ elisa -kColorPicker -kImageAnnotator +#kColorPicker +#kImageAnnotator kdenlive +keysmith kwave diff --git a/pkglists/z01_swdev.lst b/pkglists/z01_swdev.lst index cf46325..7542118 100644 --- a/pkglists/z01_swdev.lst +++ b/pkglists/z01_swdev.lst @@ -3,13 +3,27 @@ glibc libmpc mpfr # noxbase.lst: +autoconf +automake bison flex gcc gccmakedep +gettext guile intltool +libtool +lua +m4 make +python-build +python-flit-core +python-glad2 +python-installer +python-lxml +python-pyproject-hooks +python-tomli-w +python-wheel # z00_plasma5supp.lst: gcc-g++ gcc-gfortran diff --git a/pkglists/z03_daw.lst b/pkglists/z03_daw.lst index fa9ab4a..efe3cd2 100644 --- a/pkglists/z03_daw.lst +++ b/pkglists/z03_daw.lst @@ -7,6 +7,7 @@ ardour aubio audacity avldrums.lv2 +boca cadence calf capnproto @@ -24,6 +25,7 @@ elektroid eq10q faad2 faust +freac frescobaldi geonkick giada @@ -52,6 +54,7 @@ libmicrohttpd libmodplug libmp4v2 libmpdclient +libsbsms libsmf libwebsockets lilv @@ -72,8 +75,10 @@ ntk pipewire-jack portaudio portmidi +portsmf protobuf pulseaudio-jack +python-attrdict python-ly python-numpy python-pathlib2 @@ -97,14 +102,18 @@ rubberband sc3-plugins serd shntool +smooth sonic-pi sonic-visualiser sord soundfont-unison soundtouch +speex sratom suil supercollider +twolame +uriparser vamp-aubio-plugins vamp-plugin-sdk vcvrack diff --git a/pxeserver.tpl b/pxeserver.tpl index 1bde266..46e19ee 100755 --- a/pxeserver.tpl +++ b/pxeserver.tpl @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2011, 2016, 2017, 2019 Eric Hameleers, Eindhoven, NL +# Copyright 2011, 2016, 2017, 2019, 2023 Eric Hameleers, Eindhoven, NL # Copyright 2011 Patrick Volkerding, Sebeka, Minnesota USA # All rights reserved. # @@ -43,6 +43,8 @@ # - The script will detect if you have an outside network connection on # another interface and will enable IP forwarding if needed, so that the # PXE clients will also have network access. +# - Optionally, the script can hide its PXE clients behind a NAT router +# in case external network is not accessible via normal routing. # - The Live OS booted via pxelinux is configured with additional boot # parameters: # * nfsroot=${LOCAL_IPADDR}:/mnt/livemedia @@ -83,6 +85,14 @@ GLOBAL_GW_INT="" GLOBAL_GATEWAY="" LOCAL_GATEWAY="" +# Defining more global variables ahead of time: +LOCAL_IPADDR="" +LOCAL_NETMASK="" +LOCAL_NETWORK="" + +# The script optionally configures a NAT gateway: +ENABLE_NAT="no" + # The Slackware setup depends on english language settings because it # parses program output like that of "fdisk -l". So, we need to override # the Live user's local language settings here: @@ -128,10 +138,25 @@ if [ -n "$PXETXTSRC" ]; then fi # For UEFI computers: +if [ ! -f /mnt/livemedia${UEFIPREFIX}/SLACKWARELIVE ]; then + # We boot from a USB stick created with isu2usb.sh: + if ! mount |grep -q 'on /boot/efi' ; then + # USB EFI partition is not yet mounted, let's find where it is: + LIVEPART="$(df -P /mnt/livemedia/ |tail -n1 |cut -d' ' -f1)" + USBDEV="/dev/$(lsblk -no pkname ${LIVEPART=})" + EFIPART="$(blkid -t PARTLABEL="EFI System Partition" ${USBDEV=}* |cut -d: -f1)" + mkdir -p /boot/efi + mount -t vfat -o defaults ${EFIPART} /boot/efi + fi + UEFI_TFTP="/boot/efi" +else + UEFI_TFTP="/mnt/livemedia" +fi +# Allow the boot files to be served by tftp: mkdir -p /var/lib/tftpboot${UEFIPREFIX} -ln -sf /mnt/livemedia${UEFIPREFIX}/@MARKER@ /var/lib/tftpboot${UEFIPREFIX}/ -ln -sf /mnt/livemedia${UEFIPREFIX}/bootx64.efi /var/lib/tftpboot${UEFIPREFIX}/ -ln -sf /mnt/livemedia${UEFIPREFIX}/theme /var/lib/tftpboot${UEFIPREFIX}/ +ln -sf ${UEFI_TFTP}${UEFIPREFIX}/SLACKWARELIVE /var/lib/tftpboot${UEFIPREFIX}/ +ln -sf ${UEFI_TFTP}${UEFIPREFIX}/bootx64.efi /var/lib/tftpboot${UEFIPREFIX}/ +ln -sf ${UEFI_TFTP}${UEFIPREFIX}/theme /var/lib/tftpboot${UEFIPREFIX}/ # # Function definitions: @@ -180,6 +205,8 @@ get_dhcpcd_pid() { echo "/run/dhcpcd-${MYDEV}.pid" elif [ -s /run/dhcpcd-${MYDEV}-4.pid ]; then echo "/run/dhcpcd-${MYDEV}-4.pid" + elif [ -s /run/${MYDEV}.pid ]; then + echo "/run/${MYDEV}.pid" else echo UNKNOWNLOC fi @@ -190,6 +217,7 @@ get_nm_internal_lease() { # Find the lease of NetworkManager internal dhcp client: MYDEV="$1" if [ -s /var/lib/NetworkManager/intern*-${MYDEV}.lease ]; then + # NM is indeed managing this interface: echo "$(ls --indicator-style=none /var/lib/NetworkManager/intern*-${MYDEV}.lease)" else echo UNKNOWNLOC @@ -210,7 +238,7 @@ devconfig() { elif ! ip -f inet -o addr show |grep -v " lo " |grep -qw 172.16 ; then MYIP="172.16.10.10" else - MYIP="10.10.10.10" + MYIP="10.16.10.10" fi # Main loop IP configuration: @@ -311,17 +339,20 @@ EOF dhcpcd -k $MYIF 1>/dev/null 2>&1 rm -f /run/dhcpcd/dhcpcd-${MYIF}.pid 2>/dev/null rm -f /run/dhcpcd-${MYIF}.pid 2>/dev/null + rm -f /run/${MYIF}.pid 2>/dev/null # Broadcast and network are derived from IP and netmask: - LOCAL_BROADCAST=$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 1 -d ' ') - LOCAL_NETWORK=$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 2 -d ' ') + LOCAL_BROADCAST="$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 1 -d ' ')" + LOCAL_NETWORK="$(ipmask $LOCAL_NETMASK $LOCAL_IPADDR | cut -f 2 -d ' ')" if [ -x /etc/rc.d/rc.networkmanager 2>/dev/null ]; then # Use nmcli to reconfigure NetworkManager: - nmcli con add con-name pxe-${MYIF} ifname ${MYIF} type ethernet ip4 $LOCAL_IPADDR/$(mask_cvt $LOCAL_NETMASK) + nmcli con add save no con-name pxe-${MYIF} ifname ${MYIF} type ethernet + nmcli con mod pxe-${MYIF} ipv4.addresses ${LOCAL_IPADDR}/$(mask_cvt ${LOCAL_NETMASK}) ipv4.method manual connection.autoconnect no if [ "x$GLOBAL_GATEWAY" = "x" -a "x$LOCAL_GATEWAY" != "x" ]; then nmcli con mod pxe-${MYIF} ipv4.gateway $LOCAL_GATEWAY fi - nmcli dev connect ${MYIF} + nmcli con up pxe-${MYIF} + if [ $DEBUG -ne 0 ]; then read -p "Press ENTER to continue: " JUNK ; fi else # Use ifconfig and route commands: ifconfig $MYIF $LOCAL_IPADDR netmask $LOCAL_NETMASK broadcast $LOCAL_BROADCAST @@ -405,7 +436,7 @@ Alternate keys may also be used: '+', '-', and TAB." 13 72 9 \ # If our interface is configured by DHCP, it likely has a lease from a # LAN DHCP server, so we should not activate another DHCP server ourself now: - if [ -s $(get_dhcpcd_pid ${INTERFACE}) -a -n "$(ps -q $(cat $(get_dhcpcd_pid ${INTERFACE})) -o comm=)" ]; then + if [ -s $(get_dhcpcd_pid ${INTERFACE}) -a -n "$(ps -q $(cat $(get_dhcpcd_pid ${INTERFACE})) -o comm= 2>/dev/null)" ]; then OWNDHCP="no" elif [ -s $(get_nm_internal_lease ${INTERFACE}) ]; then OWNDHCP="no" @@ -452,6 +483,23 @@ not in reach of any DHCP server." 13 68 fi fi + if [ "$OWNDHCP" == "yes" ]; then + if [ "$INTERFACE" != "$GLOBAL_GW_INT" ]; then + # The default gateway for this computer is on another interface; + $DIALOG --title "ENABLE NAT FIREWALL" --defaultno --yesno " \ +This computer's default gateway is network interface ${GLOBAL_GW_INT}. \ +The network behind the PXE server's interface ${INTERFACE} seems to be isolated.\n\ +Do you want to hide your PXE clients behind a NAT gateway?\n\ +This may be helpful if PXE clients cannot reach the external network otherwise.\n\ +Say 'NO' if you are not sure which is best." 12 68 + if [ $? = 0 ]; then + ENABLE_NAT="yes" + else + ENABLE_NAT="no" + fi + fi + fi + # Assemble the network parameters: LOCAL_IPADDR=$(ip -f inet -o addr show ${INTERFACE} |tr -s ' ' |head -1 |cut -f4 -d' ' |cut -f1 -d/) if [ "x$LOCAL_IPADDR" = "x" ]; then # no IP Address was configured?!? @@ -581,9 +629,9 @@ dhcp-leasefile=$TMP/pxe_dnsmasq.leases # Test for the architecture of a netboot client. PXE clients are # supposed to send their architecture as option 93. (See RFC 4578) . -# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86, +# The known types are X86PC, PC98, IA64_EFI, Alpha, Arc_x86, # Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI -dhcp-match=x86PC, option:client-arch, 0 #BIOS x86 +dhcp-match=X86PC, option:client-arch, 0 #BIOS x86 dhcp-match=BC_EFI, option:client-arch, 7 #EFI Byte Code dhcp-match=X86-64_EFI, option:client-arch, 9 #EFI x86_64 @@ -613,13 +661,14 @@ pxe-service=X86PC, "Boot from local hard disk", 0 # The above 'pxe-service' menu does not always work for UEFI-based clients, # so alternatively you could implement a combination of 'dhcp-match' and # 'dhcp-boot' to provide a boot image. Here is a commented-out example: -#dhcp-match=set:efi-x86_64,option:client-arch,7 -#dhcp-match=set:efi-x86_64,option:client-arch,9 -#dhcp-match=set:efi-x86,option:client-arch,6 -#dhcp-match=set:bios,option:client-arch,0 -#dhcp-boot=tag:efi-x86_64,"${UEFIPREFIX}/bootx64.efi" -#dhcp-boot=tag:efi-x86,"${UEFIPREFIX}/bootia32.efi" -#dhcp-boot=tag:bios,"bios/lpxelinux.0" +#dhcp-match=set:BC_EFI,option:client-arch,7 +#dhcp-match=set:X86-64_EFI,option:client-arch,9 +#dhcp-match=set:X86_EFI,option:client-arch,6 +#dhcp-match=set:X86PC,option:client-arch,0 +#dhcp-boot=tag:X86-64_EFI,"${UEFIPREFIX}/bootx64.efi,${LOCAL_IPADDR}" +#dhcp-boot=tag:BC_EFI,"${UEFIPREFIX}/bootx64.efi,${LOCAL_IPADDR}" +#dhcp-boot=tag:X86_EFI,"${UEFIPREFIX}/bootia32.efi,${LOCAL_IPADDR}" +#dhcp-boot=tag:X86PC,"pxelinux.0,${LOCAL_IPADDR}" EOF @@ -680,7 +729,7 @@ F4 f4.txt #00000000 menu hshift 1 menu vshift 9 -menu width 45 +menu width 55 menu margin 1 menu rows 10 menu helpmsgrow 14 @@ -710,7 +759,7 @@ menu color help 37;40 #ff354172 #00000000 none label pxelive menu label Boot @CDISTRO@ Linux Live (@LIVEDE@) from network kernel /generic - append initrd=/initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nfsroot=${LOCAL_IPADDR}:/mnt/livemedia luksvol= nop hostname=@DISTRO@ tz=$(cat /etc/timezone) locale=${SYSLANG:-"en_US.UTF-8"} kbd=${KBD:-"us"} + append initrd=/initrd.img @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nfsroot=${LOCAL_IPADDR}:/mnt/livemedia luksvol= nop hostname=@DISTRO@ tz=$(cat /etc/timezone) locale=${SYSLANG:-"en_US.UTF-8"} kbd=${KBD:-"us"} EOF # And a Grub configuration for UEFI boot: @@ -738,6 +787,8 @@ insmod ext2 # Determine whether we can show a graphical themed menu: insmod font if loadfont \$prefix/theme/dejavusansmono12.pf2 ; then + loadfont \$prefix/theme/dejavusansmono24.pf2 + loadfont \$prefix/theme/dejavusansmono20.pf2 loadfont \$prefix/theme/dejavusansmono10.pf2 loadfont \$prefix/theme/dejavusansmono5.pf2 set font="DejaVu Sans Mono Regular 12" @@ -756,7 +807,7 @@ set gfxpayload=keep menuentry 'Boot @CDISTRO@ Linux Live (@LIVEDE@) from network' --class slackware --class gnu-linux --class gnu --class os { echo "Loading @CDISTRO@ kernel" - linux generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nfs root=${LOCAL_IPADDR}:/mnt/livemedia luksvol= nop hostname=@DISTRO@ tz=$(cat /etc/timezone) locale=${SYSLANG:-"en_US.UTF-8"} kbd=${KBD:-"us"} + linux generic @KAPPEND@ load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nfsroot=${LOCAL_IPADDR}:/mnt/livemedia luksvol= nop hostname=@DISTRO@ tz=$(cat /etc/timezone) locale=${SYSLANG:-"en_US.UTF-8"} kbd=${KBD:-"us"} initrd initrd.img echo "Booting @CDISTRO@ kernel" } @@ -777,7 +828,7 @@ while [ 0 ]; do --menu \ "Welcome to @CDISTRO@ Linux Live PXE Server.\n\ Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\ -Alternate keys may also be used: '+', '-', and TAB." 13 72 9 \ +Alternate keys may also be used: '+', '-', and TAB." 11 72 7 \ "NETWORK" "Configure your network parameters" \ "ACTIVATE" "Activate the @CDISTRO@ PXE Server" \ "EXIT" "Exit @CDISTRO@ PXE Setup" 2> $TMP/hdset @@ -818,7 +869,11 @@ Press ENTER to return to the main menu." 14 68 Ready to start the PXE Server!\n\ The PXE server log will be displayed in the next screen. \n\ -Press ENTER to start." 14 68 +Press ENTER to start or ESCAPE to return to the main menu." 14 68 + if [ $? -ne 0 ]; then + # User did not press ENTER, let's return to main menu: + continue + fi fi # Time to start the BOOTP/TFTP/NFS servers: @@ -837,9 +892,16 @@ EOT # we need to enable forwarding: OLDROUTING=$(cat /proc/sys/net/ipv4/ip_forward) echo 1 > /proc/sys/net/ipv4/ip_forward - # also start the route daemon: - if [ -z "$(pidof routed)" ]; then - /usr/sbin/routed -g -s + if [ "${ENABLE_NAT}" == "yes" ]; then + # Add NAT firewall rule: + iptables -t nat -A POSTROUTING -o ${GLOBAL_GW_INT} -j MASQUERADE + iptables -A FORWARD -p ALL -i ${GLOBAL_GW_INT} -j ACCEPT + iptables -A FORWARD -m state --state ESTABLISHED,RELATED -i ${GLOBAL_GW_INT} -j ACCEPT + else + if [ -z "$(pidof routed)" ]; then + # Also start the route daemon: + /usr/sbin/routed -g -s /var/log/routed_pxeserver.log + fi fi else OLDROUTING="" @@ -851,8 +913,16 @@ EOT --ok-label "EXIT" \ --tailbox /var/log/pxe_dnsmasq.log 20 68 - # Time to kill the BOOTP/TFTP/NFS servers: - [ -n "$OLDROUTING" ] && echo $OLDROUTING > /proc/sys/net/ipv4/ip_forward + # Time to kill the BOOTP/TFTP/NFS servers and revert network settings: + if [ "${ENABLE_NAT}" == "yes" ]; then + # Remove NAT firewall rule: + iptables -D FORWARD -m state --state ESTABLISHED,RELATED -i ${GLOBAL_GW_INT} -j ACCEPT + iptables -D FORWARD -p ALL -i ${GLOBAL_GW_INT} -j ACCEPT + iptables -t nat -D POSTROUTING -o ${GLOBAL_GW_INT} -j MASQUERADE + fi + if [ -n "$OLDROUTING" ]; then + echo $OLDROUTING > /proc/sys/net/ipv4/ip_forward + fi kill -TERM $(cat ${TMP}/pxe_dnsmasq.pid) sh /etc/rc.d/rc.nfsd stop sed -i -e "s%^/mnt/livemedia.*%#&%" /etc/exports @@ -860,6 +930,18 @@ EOT if [ "$MAINSELECT" = "EXIT" ]; then clear + + if [ -x /etc/rc.d/rc.networkmanager 2>/dev/null ]; then + # Use nmcli to remove the NetworkManager connection: + nmcli con down pxe-${INTERFACE} + nmcli con del pxe-${INTERFACE} + else + # Manually bring the interface down: + dhcpcd -k ${INTERFACE} 2>/dev/null + ip link set dev ${INTERFACE} down + ip address flush dev ${INTERFACE} + fi + break fi diff --git a/setup2hd.tpl b/setup2hd.tpl index 8a47755..f87a697 100755 --- a/setup2hd.tpl +++ b/setup2hd.tpl @@ -97,7 +97,7 @@ sleep 1 vgchange -ay 1> /dev/null 2> /dev/null if probe -l 2> /dev/null | grep -E 'Linux$' 1> /dev/null 2> /dev/null ; then RUNPART=no - probe -l 2> /dev/null | grep -E 'Linux$' | sort 1> $TMP/SeTplist 2> /dev/null + probe -l 2>/dev/null |grep -E 'Linux$' |sort |uniq 1>$TMP/SeTplist 2>/dev/null ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "LINUX PARTITIONS DETECTED" \ --yes-label "Continue" --no-label "Skip" --defaultno \ @@ -121,6 +121,10 @@ To do this, you'll get a chance to make these partitions now using \ 'cfdisk' (MBR partitions) or 'cgdisk' (GPT partitions)." 10 64 fi if [ -d /sys/firmware/efi ]; then + # First, let's make sure that efivarfs is active: + if [ "$(/bin/ls /sys/firmware/efi/efivars 2> /dev/null | wc -l)" = "0" ]; then + mount -t efivarfs none /sys/firmware/efi/efivars + fi if ! probe -l 2> /dev/null | grep "EFI System Partition" 1> /dev/null 2> /dev/null ; then RUNPART=yes ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ @@ -156,11 +160,11 @@ ROOT_DEVICE="`mount | grep "on / " | cut -f 1 -d ' '`" echo "$ROOT_DEVICE" > $TMP/SeTrootdev if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then # clear source location: # In case of bind mounts, try to unmount them first: - umount /var/log/mount/dev 2> /dev/null - umount /var/log/mount/proc 2> /dev/null - umount /var/log/mount/sys 2> /dev/null + umount -R /var/log/mount/dev 2> /dev/null + umount -R /var/log/mount/proc 2> /dev/null + umount -R /var/log/mount/sys 2> /dev/null # Unmount target partition: - umount /var/log/mount + umount -R /var/log/mount fi # Anything mounted on /var/log/mount now is a fatal error: if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then @@ -260,9 +264,9 @@ Alternate keys may also be used: '+', '-', and TAB." 14 72 5 \ cat /usr/sbin/eliloconfig > $T_PX/usr/sbin/eliloconfig fi # Make bind mounts for /dev, /proc, and /sys: - mount -o bind /dev $T_PX/dev 2> /dev/null - mount -o bind /proc $T_PX/proc 2> /dev/null - mount -o bind /sys $T_PX/sys 2> /dev/null + mount -o rbind /dev $T_PX/dev 2> /dev/null + mount -o rbind /proc $T_PX/proc 2> /dev/null + mount -o rbind /sys $T_PX/sys 2> /dev/null SeTconfig REPLACE_FSTAB=Y if [ -r $TMP/SeTnative ]; then @@ -317,7 +321,7 @@ if mount | grep /var/log/mntiso 1> /dev/null 2> /dev/null ; then umount -f /var/log/mntiso fi if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then - umount /var/log/mount + umount -R /var/log/mount fi # Anything mounted on /var/log/mount now is a fatal error: if mount | grep /var/log/mount 1> /dev/null 2> /dev/null ; then diff --git a/setup2hd/setup.liveslak.tpl b/setup2hd/setup.liveslak.tpl index 789b81f..fb6e03e 100644 --- a/setup2hd/setup.liveslak.tpl +++ b/setup2hd/setup.liveslak.tpl @@ -162,7 +162,7 @@ EOT /etc/slackpkg \ /etc/vconsole.conf \ /var/lib/sddm/state.conf \ - /var/lib/slackpkg/current + /var/lib/slackpkg # Point xdm to the custom /etc/X11/xdm/liveslak-xdm/xdm-config: sed -i ${T_PX}/etc/rc.d/rc.4 -e 's,bin/xdm -nodaemon,& -config /etc/X11/xdm/liveslak-xdm/xdm-config,' # If gcc was not installed, create a symlink to cpp pointing to mcpp; @@ -224,7 +224,8 @@ EOT /home/@LIVEUID@/.jackdrc \ /home/@LIVEUID@/.config/autostart/qjackctl.desktop \ /home/@LIVEUID@/.config/rncbc.org/QjackCtl.conf \ - /home/@LIVEUID@/.config/kscreenlockerrc + /home/@LIVEUID@/.config/kscreenlockerrc \ + /home/@LIVEUID@/.config/plasmarc fi fi @@ -251,11 +252,12 @@ EOT - default runlevel - keyboard layout - language setting + - slackpkg/slackpkg+ EOF ${DIALOG} --backtitle "@CDISTRO@ Linux Setup (Live Edition)" \ --title "POST INSTALL HINTS AND TIPS" --msgbox "`cat $TMP/tempmsg`" \ - 18 65 + 19 65 rm $TMP/tempmsg MAINSELECT="CONFIGURE" diff --git a/setup2hd/setup.slackware.tpl b/setup2hd/setup.slackware.tpl index eff6b9a..e1b9fa1 100644 --- a/setup2hd/setup.slackware.tpl +++ b/setup2hd/setup.slackware.tpl @@ -150,6 +150,10 @@ to choose packages individually." 4 60 else slackinstall --device noremount --promptmode $MODE --srcpath `cat $TMP/SeTDS` --mountpoint /var/log/mount --target $T_PX --series $SERIES fi + # Run ldconfig on the newly installed system: + if [ -x $T_PX/sbin/ldconfig ]; then + $T_PX/sbin/ldconfig -r $T_PX + fi if [ $MODE = terse ]; then # Let's pause a moment and then restore the terminal settings sleep 1 diff --git a/syslinux/f3.txt b/syslinux/f3.txt index a311cb5..833956b 100644 --- a/syslinux/f3.txt +++ b/syslinux/f3.txt @@ -51,6 +51,10 @@ toram => copy the OS from the media to to RAM before running it. toram=all => Prevent writes to disk since we are supposed to run from RAM; equivalent to parameter "toram". +toram=core => Load Console OS modules into RAM. Console-only Slackware + loads fast, contains 'setup2hd' and frees up your USB drive so you can + overwrite it with a Persistent Live OS. + toram=os => Load OS modules into RAM, but write persistent data to USB. == [F1]: Home [F2]: Desktop setup [F4]: HW/debug [F5]: Network boot == @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017, 2019, 2021, 2022 Eric Hameleers, Eindhoven, NL +# Copyright 2017, 2019, 2021, 2022, 2023 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -62,15 +62,28 @@ UPKERNEL=0 # Do not change usb wait time by default: WAIT=-1 +# Not extending any container by default: +EXTENSION="" + # --------------------------------------------------------------------------- # END possible tasks to be executed by the script: # --------------------------------------------------------------------------- +# The extension for containerfiles accompanying an ISO is '.icc', +# whereas the persistent USB stick created with iso2usb.sh uses '.img'. +DEFEXT=".img" +CNTEXT="${DEFEXT}" + +# Default filesystem for devices/containers: +DEF_FS="ext4" +FSYS="${DEF_FS}" + # Determine whether the USB stick has a supported kernel configuration # i.e. one active and optionally one backup kernel plus mmodules: SUPPORTED=1 # Values obtained from the init script on the USB: +CORE2RAMMODS="" DEF_KBD="" DEF_LOCALE="" DEF_TZ="" @@ -81,7 +94,6 @@ LIVEUID="" MARKER="" MEDIALABEL="" PERSISTENCE="" -CORE2RAMMODS="" SQ_EXT_AVAIL="" VERSION="" @@ -89,9 +101,15 @@ VERSION="" KBACKUP=1 # Does the initrd contain an old kernel that we can restore? -# The 'read_initrd' routing may set this to '0': +# The 'read_initrddir' routine may set this to '0': KRESTORE=1 +# By default we create an addon live module for the new kernel modules, +# otherwise the Live OS will be broken after reboot. +# User can skip this if they already installed the kernel-modules package +# in the Live OS earlier: +NOLIVEMODS=0 + # Timeout when scanning for inserted USB device, 30 seconds by default, # but this default can be changed from outside the script: SCANWAIT=${SCANWAIT:-30} @@ -110,7 +128,6 @@ MINFREE=${MINFREE:-10} # Variables to store content from an initrd we are going to refresh: OLDKERNELSIZE="" OLDKMODDIRSIZE="" -OLDKVER="" OLDWAIT="" # Record the version of the new kernel: @@ -121,10 +138,22 @@ IMGDIR="" KERDIR="" USBMNT="" EFIMNT="" +CNTDEV="" +LODEV="" + +# Empty initialization: +INCSIZE="" +PARTFREE="" +PARTSIZE="" # These tools are required by the script, we will check for their existence: REQTOOLS="cpio gdisk inotifywait lsblk strings xz" +# Minimim free space (in MB) we want to have left in any partition +# after we are done. +# The default value can be changed from the environment: +MINFREE=${MINFREE:-10} + # Compressor used on the initrd ("gzip" or "xz --check=crc32"); # Note that the kernel's XZ decompressor does not understand CRC64: COMPR="xz --check=crc32" @@ -133,7 +162,7 @@ COMPR="xz --check=crc32" # 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; # Virtio modules added to experiment with liveslak in a VM. -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: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: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"} +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 kernel/drivers/virtio" @@ -147,22 +176,32 @@ NETEXCL="appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvla # # Clean up in case of failure: -cleanup() { +function cleanup() { # Clean up by unmounting our loopmounts, deleting tempfiles: echo "--- Cleaning up the staging area..." # During cleanup, do not abort due to non-zero exit code: set +e sync + + if [ -n "$CNTDEV" ]; then + # In case of failure, only most recent LUKS mapped device is still open: + if mount | grep -q ${CNTDEV} ; then + umount -f ${CNTDEV} + cryptsetup luksClose $(basename ${CNTDEV}) + losetup -d ${LODEV} + fi + fi + # No longer needed: [ -n "${IMGDIR}" ] && ( rm -rf $IMGDIR ) [ -n "${KERDIR}" ] && ( rm -rf $KERDIR ) if [ -n "${USBMNT}" ]; then if mount |grep -qw ${USBMNT} ; then umount ${USBMNT} ; fi - rm -rf $USBMNT + rmdir $USBMNT fi if [ -n "${EFIMNT}" ]; then if mount |grep -qw ${EFIMNT} ; then umount ${EFIMNT} ; fi - rm -rf $EFIMNT + rmdir $EFIMNT fi set -e } # End of cleanup() @@ -170,7 +209,7 @@ cleanup() { trap 'echo "*** $0 FAILED at line $LINENO ***"; cleanup; exit 1' ERR INT TERM # Show the help text for this script: -showhelp() { +function showhelp() { cat <<EOT # # Purpose: to update the content of a Slackware Live USB stick. @@ -178,6 +217,7 @@ cat <<EOT # $(basename $0) accepts the following parameters: # -b|--nobackup Do not try to backup original kernel and modules. # -d|--devices List removable devices on this computer. +# -e|--examples Show some common usage examples. # -h|--help This help. # -i|--init <filename> Replacement init script. # -k|--kernel <filename> The kernel file (or package). @@ -190,21 +230,71 @@ cat <<EOT # providing a devicename (using option '-o'). # -v|--verbose Show verbose messages. # -w|--wait<number> Add <number> seconds wait time to initialize USB. +# -x|--extend <fullpath> Full path (either in your filesystem or else +# relative to the USB partition root) +# to an existing (encrypted) container file, +# whose size you want to extend. +# Limitations: +# - container needs to be LUKS encrypted. +# - filename extension needs to be '${CNTEXT}'. +# Supported filesystems inside container: +# - $(resizefs). +# -N|--nolivemods Don't create an addon live module containing +# the new kernelmodules. Normally you *will* need +# this addon module, *unless* you have already +# installed these kernel-modules in the Live OS. +# FYI: the kernel and module upgrade applies only +# to the USB boot kernel and its initrd. +# -X|--extendsize <size|perc> Extend size of existing container; value +# is the requested extension of the container +# in kB, MB, GB, or as percentage of free space +# (integer numbers only). +# Examples: '-X 125M', '-X 2G', '-X 20%'. # EOT } # End of showhelp() +function showexamples() { +cat <<EOT +# +# Some common usage examples for $(basename $0) +# --------------------------------------------------------------------------- +# +# Get a listing of all available removable devices on the computer: +# ./$(basename $0) -d +# +# Updating kernel and modules, providing two packages as input and assuming +# that the USB stick is known as /dev/sdX: +# ./$(basename $0) -o /dev/sdX -m kernel-modules-4.19.0-x86_64-1.txz -k kernel-generic-4.19.0-x86_64-1.txz +# +# Restore the previous kernel and modules after a failed update, +# and let the script scan your computer for the insertion of your USB stick: +# ./$(basename $0) -s -r +# +# Replace the Live init script with the latest template taken from +# the liveslak git repository: +# wget https://git.liveslak.org/liveslak/plain/liveinit.tpl +# ./$(basename $0) -o /dev/sdX -i liveinit.tpl +# +# Extend the size of the pre-existing LUKS container for your homedirectory +# with 3 GB, and let the script scan for the insertion of your USB stick: +# ./$(basename $0) -s -x /slhome.img -X 3G +# +EOT +} # End of showexamples() + # Scan for insertion of a USB device: -scan_devices() { +function scan_devices() { + local MYSCANWAIT="${1}" local BD # Inotifywatch does not trigger on symlink creation, # so we can not watch /sys/block/ - BD=$(inotifywait -q -t ${SCANWAIT} -e create /dev 2>/dev/null |cut -d' ' -f3) + BD=$(inotifywait -q -t ${MYSCANWAIT} -e create /dev 2>/dev/null |cut -d' ' -f3) echo ${BD} } # End of scan_devices() # Show a list of removable devices detected on this computer: -show_devices() { +function show_devices() { local MYDATA="${*}" if [ -z "${MYDATA}" ]; then MYDATA="$(ls --indicator-style=none /sys/block/ |grep -Ev '(ram|loop|dm-)')" @@ -218,8 +308,110 @@ show_devices() { echo "#" } # End of show_devices() +# Determine size of a mounted partition (in MB): +function get_part_mb_size() { + local MYPART="${1}" + local MYSIZE + MYSIZE=$(df -P -BM ${MYPART} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f2) + echo "${MYSIZE%M}" +} # End of get_part_mb_size() + +# Determine free space of a mounted partition (in MB): +function get_part_mb_free() { + local MYPART="${1}" + local MYSIZE + MYSIZE=$(df -P -BM ${MYPART} |tail -n -1 |tr -s '\t' ' ' |cut -d' ' -f4) + echo "${MYSIZE%M}" +} # End of get_part_mb_free() + +# Determine requested container size in MB (allow for '%|k|K|m|M|g|G' suffix). +# Note: sizes need to be integer values! Bash arithmetics don't work for floats. +function cont_mb() { + # Uses global variables: PARTFREE + local MYSIZE="$1" + case "${MYSIZE: -1}" in + "%") MYSIZE="$(( $PARTFREE * ${MYSIZE%\%} / 100 ))" ;; + "k") MYSIZE="$(( ${MYSIZE%k} / 1024 ))" ;; + "K") MYSIZE="$(( ${MYSIZE%K} / 1024 ))" ;; + "m") MYSIZE="${MYSIZE%m}" ;; + "M") MYSIZE="${MYSIZE%M}" ;; + "g") MYSIZE="$(( ${MYSIZE%g} * 1024 ))" ;; + "G") MYSIZE="$(( ${MYSIZE%G} * 1024 ))" ;; + *) MYSIZE=-1 ;; + esac + echo "$MYSIZE" +} # End of cont_mb() + +# Expand existing encrypted container file: +function expand_container() { + # Uses external function: cleanup + # Uses global variables: CNTEXT, MINFREE + # Sets global variables: CNTDEV, LODEV, PARTFREE, PARTSIZE + local MYPART="$1" # disk partition + local MYINC="$2" # requested increase ('%|k|K|m|M|g|G' suffix) + local MYFILE="$3" # full path to ${CNTEXT} containerfile + local MYMAP="" # Name of the device-mapped file + local CNTIS="" # Stores size of the container + + # Determine requested container increase in MB: + MYINC=$(cont_mb ${MYINC}) + + # Determine size of the target partition (in MB), and the free space: + PARTSIZE=$(get_part_mb_size ${MYPART}) + PARTFREE=$(get_part_mb_free ${MYPART}) + + if [ $PARTFREE -lt $(( ${MYINC} + ${MINFREE} )) ]; then + echo "*** Free space on USB partition after file-resizing would be less than ${MINFREE} MB;" + echo "*** Not resizing the container file!" + cleanup + exit 1 + fi + + if ! file ${MYFILE} |grep -q 'LUKS' ; then + echo "*** No LUKS container: '${MYFILE}'" + cleanup + exit 1 + else + echo "--- Expanding '$(basename ${MYFILE})' on '${MYPART}' with ${MYINC} MB..." + fi + + # Append random bytes to the end of the container file: + dd if=/dev/urandom of=${MYFILE} bs=1M count=${MYINC} oflag=append conv=notrunc 2>/dev/null + + # Setup a loopback device that we can use with or without cryptsetup: + LODEV=$(losetup -f) + losetup ${LODEV} ${MYFILE} + + if cryptsetup isLuks ${LODEV} ; then + # Unlock LUKS encrypted container first: + MYMAP=$(basename ${MYFILE} ${CNTEXT}) + CNTDEV=/dev/mapper/${MYMAP} + echo "--- Unlocking the LUKS container requires your passphrase..." + until cryptsetup luksOpen ${LODEV} ${MYMAP} ; do + echo ">>> Did you type an incorrect passphrases?" + read -p ">>> Press [ENTER] to try again or Ctrl-C to abort ..." REPLY + done + else + # Use the loopmounted block device for the un-encrypted container: + CNTDEV=${LODEV} + fi + + # Run fsck so the filesystem is clean before we resize it: + fsck -fvy ${CNTDEV} + # Resize the filesystem to occupy the full new size: + resizefs ${CNTDEV} + # Just to be safe: + fsck -fvy ${CNTDEV} + + # Don't forget to clean up after ourselves: + if cryptsetup isLuks ${LODEV} ; then + cryptsetup luksClose ${MYMAP} + fi + losetup -d ${LODEV} || true +} # End of expand_container() + # 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 @@ -227,10 +419,76 @@ uncompressfs () { fi } # End of uncompressfs () +# Resize the filesystem on a block device: +function resizefs() { + # Uses external function: cleanup + local MYDEV="${1}" + local MYFS + local TMPMNT + + if [ -z "${MYDEV}" ]; then + # Without arguments given, reply with list of supported fs'es: + echo "btrfs,ext2,ext4,f2fs,jfs,xfs" + return + fi + + # Determine the current filesystem for the block device: + MYFS=$(lsblk -n -o FSTYPE ${MYDEV}) + if [ -z "${MYFS}" ]; then + echo "*** Failed to resize filesystem on device '${MYDEV}'!" + echo "*** No filesystem found." + cleanup + exit 1 + fi + + TMPMNT=$(mktemp -d -p ${TMP:=/tmp} -t alienres.XXXXXX) + if [ ! -d $TMPMNT ]; then + echo "*** Failed to create temporary mount for the filesystem resize!" + cleanup + exit 1 + else + chmod 711 ${TMPMNT} + fi + + # Mount the block device prior to the resize + # (btrfs, jfs and xfs do not support offline resize): + mount -o rw -t ${MYFS} ${MYDEV} ${TMPMNT} + + # Resize the filesystem to occupy the full new device capacity: + case "${MYFS}" in + btrfs) btrfs filesystem resize max ${TMPMNT} + ;; + ext*) resize2fs ${MYDEV} + ;; + f2fs) resize.f2fs ${MYDEV} + ;; + jfs) mount -o remount,resize,rw ${TMPMNT} + ;; + xfs) xfs_growfs -d ${TMPMNT} + ;; + *) echo "*** Unsupported filesystem '${MYFS}'!" + cleanup + exit 1 + ;; + esac + + if [ ! $? ]; then + echo "*** Failed to resize '${MYFS}'filesystem on device '${MYDEV}'!" + cleanup + exit 1 + else + # Un-mount the device again: + sync + umount ${TMPMNT} + rmdir ${TMPMNT} + fi +} # End of resizefs() + + # Collect the kernel modules we need for the liveslak initrd. # When calling this function, the old module tree must already # have been renamed to ${OLDKVER}.prev -collect_kmods() { +function collect_kmods() { local IMGDIR="$1" # Borrow (and mangle) code from Slackware's mkinitrd @@ -363,9 +621,14 @@ collect_kmods() { fi } # End of collect_kmods () -# Read configuration data from old initrd: -read_initrd() { +# Read configuration data from old initrd, +# after it has been extracted into a directory: +function read_initrddir() { local IMGDIR="$1" + local INITVARS="$2" + local OLDKVER + local OLDMODDIR + local PREVMODDIR cd ${IMGDIR} @@ -373,7 +636,7 @@ read_initrd() { OLDWAIT=$(cat ./wait-for-root) # Read the values of liveslak template variables in the init script: - for TEMPLATEVAR in DEF_KBD DEF_LOCALE DEF_TZ DISTRO LIVE_HOSTNAME LIVEMAIN LIVEUID MARKER MEDIALABEL PERSISTENCE CORE2RAMMODS SQ_EXT_AVAIL VERSION ; do + for TEMPLATEVAR in ${INITVARS} ; do eval $(grep "^ *${TEMPLATEVAR}=" ./init |head -1) done @@ -405,23 +668,36 @@ read_initrd() { fi fi fi -} # End read_initrd() - -# Extract the initrd: -extract_initrd() { - local IMGFILE="$1" +} # End read_initrddir() + +# Extract the initrd into a new directory and report the dirname back: +function extract_initrd() { + local MYIMGFILE="$1" + local MYIMGDIR=$(mktemp -d -p ${TMP:=/tmp} -t alienimg.XXXXXX) + if [ ! -d $MYIMGDIR ]; then + echo "*** Failed to create temporary extraction directory for the initrd!" + cleanup + exit 1 + else + chmod 711 $MYIMGDIR + fi - cd ${IMGDIR} - uncompressfs ${IMGFILE} \ - | cpio -i -d -m -H newc + cd ${MYIMGDIR} + uncompressfs ${MYIMGFILE} 2>/dev/null \ + | cpio -i -d -m -H newc 2>/dev/null + echo "$MYIMGDIR" } # End of extract_initrd() # Modify the extracted initrd and re-pack it: -update_initrd() { - local IMGFILE="$1" +function update_initrd() { + local MYIMGFILE="$1" + local MYIMGDIR="$2" local NEED_RECOMP=0 + local NEWMODDIR + local OLDMODDIR + local OLDKVER - cd ${IMGDIR} + cd ${MYIMGDIR} if [ ${WAIT} -ge 0 ]; then if [ $WAIT != $OLDWAIT ]; then echo "--- Updating 'waitforroot' time from '$OLDWAIT' to '$WAIT'" @@ -432,24 +708,23 @@ update_initrd() { if [ $UPKERNEL -eq 1 ]; then OLDMODDIR=$(find ./lib/modules -type d -mindepth 1 -maxdepth 1 |grep -v .prev) + OLDKVER=$(strings $(find ${OLDMODDIR}/kernel/ -name "*.ko*" |head -1) |grep ^vermagic |cut -d= -f2 |cut -d' ' -f1) rm -rf ./lib/modules/*.prev if [ $KBACKUP -eq 1 ]; then # We make one backup: - if [ $VERBOSE -eq 1 ]; then - echo "--- Making backup of kernel modules" - fi + echo "--- Making backup of kernel modules (${OLDKVER}) in initrd" mv -i ${OLDMODDIR} ${OLDMODDIR}.prev else - echo "--- No room for backing up old kernel modules" + echo "--- No room for backing up old kernel modules in initrd" rm -rf ${OLDMODDIR} fi # Add modules for the new kernel: - echo "--- Adding new kernel modules" - collect_kmods ${IMGDIR} + echo "--- Adding new kernel modules (${KVER}) to initrd" + collect_kmods ${MYIMGDIR} NEED_RECOMP=1 elif [ $RESTORE -eq 1 -a $KRESTORE -eq 1 ]; then # Restore previous kernel module tree. - # The 'read_initrd' routine will already have checked that we have + # The 'read_initrddir' routine will already have checked that we have # one active and one .prev modules tree: OLDMODDIR=$(find ./lib/modules -type d -mindepth 1 -maxdepth 1 |grep .prev || true) NEWMODDIR=$(find ./lib/modules -type d -mindepth 1 -maxdepth 1 |grep -v .prev) @@ -460,6 +735,11 @@ update_initrd() { fi if [ -n "${LIVEINIT}" ]; then + if ! file "${LIVEINIT}" |grep -q 'shell script' ; then + echo "*** Not a shell script: "${LIVEINIT}"!" + cleanup + exit 1 + fi echo "--- Replacing live init script" cp ./init ./init.prev if grep -q "@LIVEMAIN@" ${LIVEINIT} ; then @@ -474,19 +754,21 @@ update_initrd() { if [ ${NEED_RECOMP} -eq 1 ]; then echo "--- Compressing the initrd image again" - chmod 0755 ${IMGDIR} - find . |cpio -o -H newc |$COMPR > ${IMGFILE} + chmod 0755 ${MYIMGDIR} + find . |cpio -o -H newc |$COMPR > ${MYIMGFILE} fi - cd - 1>/dev/null # End of 'cd ${IMGDIR}' + cd - 1>/dev/null # End of 'cd ${MYIMGDIR}' } # End of update_initrd() # Accept either a kernelimage or a packagename, # and return the path to a kernelimage: -getpath_kernelimg () { +function getpath_kernelimg () { local MYDATA="${*}" - [ -z "${MYDATA}" ] && echo "" - if [ -n "$(file "${MYDATA}" |grep -E 'x86 boot (executable|sector)')" ]; then + if [ -z "${MYDATA}" ]; then + echo "" + return + elif [ -n "$(file "${MYDATA}" |grep -E 'x86 boot (executable|sector)')" ]; then # We have a kernel image: echo "${MYDATA}" else @@ -499,38 +781,48 @@ getpath_kernelimg () { # Accept either a directory containing module tree, or a packagename, # and return the path to a module tree: -getpath_kernelmods () { +function getpath_kernelmods () { local MYDATA="${*}" - [ -z "${MYDATA}" ] && echo "" + local MYKVER - if [ -d "${MYDATA}" ]; then + if [ -z "${MYDATA}" ]; then + echo "" + return + elif [ -d "${MYDATA}" ]; then # We have directory, assume it contains the kernel modules: - echo "${MYDATA}" + MYKVER=$(strings $(find ${MYDATA}/kernel/ -name "*.ko*" |head -1) |grep ^vermagic |cut -d= -f2 |cut -d' ' -f1) + if [ -z "${MYKVER}" ]; then + echo "*** Could not determine new kernel version from module directory!" + cleanup + exit 1 + fi + mkdir -p ${KERDIR}/lib/modules/${MYKVER} + rsync -a ${MYDATA}/ ${KERDIR}/lib/modules/${MYKVER}/ else # We assume a Slackware package: # Extract the kernel modules from the package and return the path: tar -C ${KERDIR} -xf ${MYDATA} lib/modules - cd ${KERDIR}/lib/modules/* - pwd fi + cd ${KERDIR}/lib/modules/* + pwd } # End of getpath_kernelmods # Determine size of a mounted partition (in MB): -get_part_mb_size() { +function get_part_mb_size() { local MYSIZE MYSIZE=$(df -P -BM ${1} |tail -1 |tr -s '\t' ' ' |cut -d' ' -f2) echo "${MYSIZE%M}" } # End of get_part_mb_size # Determine free space of a mounted partition (in MB): -get_part_mb_free() { +function get_part_mb_free() { local MYSIZE MYSIZE=$(df -P -BM ${1} |tail -1 |tr -s '\t' ' ' |cut -d' ' -f4) echo "${MYSIZE%M}" } # End of get_part_mb_free -parse_template() { - # Parse a liveslak template file and substitute the placeholders. +# Parse a liveslak template file and substitute the placeholders. +function parse_template() { local INFILE="$1" local OUTFILE="$2" @@ -581,6 +873,10 @@ while [ ! -z "$1" ]; do show_devices exit ;; + -e|--examples) + showexamples + exit + ;; -h|--help) showhelp exit @@ -625,6 +921,18 @@ while [ ! -z "$1" ]; do WAIT="$2" shift 2 ;; + -N|--nolivemods) + NOLIVEMODS=1 + shift + ;; + -x|--extend) + EXTENSION="$2" + shift 2 + ;; + -X|--extendsize) + INCSIZE="$2" + shift 2 + ;; *) echo "*** Unknown parameter '$1'!" exit 1 @@ -645,8 +953,8 @@ fi # Either provide a block device, or else scan for a block device: if [ -z "$TARGET" ]; then if [ $SCAN -eq 1 ]; then - echo "-- Waiting ${SCANWAIT} seconds for a USB stick to be inserted..." - TARGET=$(scan_devices) + echo "--- Waiting ${SCANWAIT} seconds for a USB stick to be inserted..." + TARGET=$(scan_devices ${SCANWAIT}) if [ -z "$TARGET" ]; then echo "*** No new USB device detected during $SCANWAIT seconds scan." exit 1 @@ -655,6 +963,7 @@ if [ -z "$TARGET" ]; then fi else echo "*** You must specify the Live USB devicename (option '-o')!" + echo "*** Alternatively, let the script scan for insertion (option '-s')!" exit 1 fi elif [ $SCAN -eq 1 ]; then @@ -706,7 +1015,6 @@ else KVER=$(strings $(find ${KMODDIR}/kernel/ -name "*.ko*" |head -1) |grep ^vermagic |cut -d= -f2 |cut -d' ' -f1) if [ -z "${KVER}" ]; then echo "*** Could not determine kernel version from the module directory" - echo "*** (querying module kernel/fs/overlayfs/overlay.ko)!" cleanup exit 1 fi @@ -720,7 +1028,16 @@ if [ -n "${LIVEINIT}" -a ! -f "${LIVEINIT}" ]; then exit 1 fi -if [ $CHANGES2SXZ -eq 1 ]; then +if [ -n "${EXTENSION}" ]; then + if [ -z "${INCSIZE}" ]; then + echo "*** LUKS container '${EXTENSION}' defined but no extension size provided!" + echo "*** Not extending encrypted ${EXTENSION}, please use '-X' parameter." + cleanup + exit 1 + fi +fi + +if [ $CHANGES2SXZ -eq 1 ] || [ $UPKERNEL -eq 1 ]; then # We need to create a module, so add squashfs to the required tools: REQTOOLS="${REQTOOLS} mksquashfs" fi @@ -733,9 +1050,9 @@ for PROGN in ${REQTOOLS} ; do fi done if [ ! -z "$PROG_MISSING" ] ; then - echo "-- Required program(s) not found in search path '$PATH'!" + echo "--- Required program(s) not found in search path '$PATH'!" echo -e ${PROG_MISSING} - echo "-- Exiting." + echo "--- Exiting." cleanup exit 1 fi @@ -760,7 +1077,7 @@ echo q |gdisk -l $TARGET 2>/dev/null | \ # If the user just used the scan option (-s) and did not select a task, # we will exit the script gracefully now: -if [[ $WAIT -lt 0 && $UPKERNEL -ne 1 && $RESTORE -ne 1 && $NETSUPPORT -ne 1 && $LIVEINIT = "" && $CHANGES2SXZ -ne 1 ]]; then +if [[ $WAIT -lt 0 && $UPKERNEL -ne 1 && $RESTORE -ne 1 && $NETSUPPORT -ne 1 && $LIVEINIT = "" && $CHANGES2SXZ -ne 1 && $EXTENSION = "" ]]; then cleanup exit 0 else @@ -780,15 +1097,19 @@ TARGETP1=$(fdisk -l $TARGET |grep ^$TARGET |cut -d' ' -f1 |grep -E '[^0-9]1$') TARGETP2=$(fdisk -l $TARGET |grep ^$TARGET |cut -d' ' -f1 |grep -E '[^0-9]2$') TARGETP3=$(fdisk -l $TARGET |grep ^$TARGET |cut -d' ' -f1 |grep -E '[^0-9]3$') -# Create a temporary extraction directory for the initrd: -mkdir -p /mnt -IMGDIR=$(mktemp -d -p /mnt -t alienimg.XXXXXX) -if [ ! -d $IMGDIR ]; then - echo "*** Failed to create temporary extraction directory for the initrd!" - cleanup - exit 1 +# Normalize filepath: +if [ -f "${EXTENSION}" ]; then + # Container is an actual file, so where are we mounted? + EXTPART=$(cd "$(dirname "${EXTENSION}")" ; df --output=source . |tail -1) + EXTMNT=$(cd "$(dirname "${EXTENSION}")" ; df --output=target . |tail -1) + if [ "${EXTPART}" == "${TARGETP3}" ]; then + # User already mounted the USB linux partition; remove mountpoint: + EXTENSION="${EXTENSION#$EXTMNT}" + fi +elif [ -n "${EXTENSION}" && "$(dirname ${EXTENSION})" == "." ]; then + # Containerfile was provided without leading slash, add one: + EXTENSION="/${EXTENSION}" fi -chmod 711 $IMGDIR # Create temporary mount point for the USB device: mkdir -p /mnt @@ -826,13 +1147,27 @@ EFIPFREE=$(get_part_mb_free ${EFIMNT}) # Record the Slackware Live version: OLDVERSION="$(cat ${USBMNT}/.isoversion 2>/dev/null)" -echo "-- The medium '${TARGET}' contains '${OLDVERSION}'" +echo "--- The medium '${TARGET}' contains '${OLDVERSION}'" + +# Try a write to the partition: +if touch ${USBMNT}/.rwtest 2>/dev/null && rm ${USBMNT}/.rwtest 2>/dev/null +then + echo "--- The partition '${TARGETP3}' is writable." +else + echo "--- Trying to remount readonly partition '${TARGETP3}' as writable..." + mount -o remount,rw ${USBMNT} + if [ $? -ne 0 ]; then + echo "*** Failed to remount '${TARGETP3}' writable, unable to continue!" + cleanup + exit 1 + fi +fi # Find out if the USB contains an EFI bootloader and use it: if [ ! -f ${EFIMNT}/EFI/BOOT/boot*.efi ]; then EFIBOOT=0 - echo "-- Note: UEFI boot file 'bootx64.efi' or 'bootia32.efi' not found on ISO." - echo "-- UEFI boot will not be supported" + echo "--- Note: UEFI boot file 'bootx64.efi' or 'bootia32.efi' not found on ISO." + echo "--- UEFI boot will not be supported" else EFIBOOT=1 fi @@ -847,10 +1182,10 @@ fi OLDKERNELSIZE=$(du -sm "${KIMG}" |tr '\t' ' ' |cut -d' ' -f1) # Collect data from the USB initrd: -extract_initrd ${USBMNT}/boot/initrd.img -read_initrd ${IMGDIR} +IMGDIR="$( extract_initrd ${USBMNT}/boot/initrd.img )" +read_initrddir ${IMGDIR} "DEF_KBD DEF_LOCALE DEF_TZ DISTRO LIVE_HOSTNAME LIVEMAIN LIVEUID MARKER MEDIALABEL PERSISTENCE CORE2RAMMODS SQ_EXT_AVAIL VERSION" -# The read_initrd routine will set SUPPORTED to '0' +# The read_initrddir routine will set SUPPORTED to '0' # if it finds a non-standard configuration for kernel & modules: if [ $KBACKUP -eq 1 ]; then if [ $SUPPORTED -ne 1 ]; then @@ -877,14 +1212,27 @@ if [ $KBACKUP -eq 1 ]; then fi # Update the initrd with regard to USB wait time, liveinit, kernel: -update_initrd ${USBMNT}/boot/initrd.img +update_initrd ${USBMNT}/boot/initrd.img ${IMGDIR} + +# Add the new kernel modules as a squashfs module: +if [ $UPKERNEL -eq 1 ] && [ $NOLIVEMODS -eq 0 ]; then + LIVE_MOD_SYS=$(dirname $(find ${USBMNT} -name "0099-${DISTRO}_zzzconf*.sxz" |head -1)) + LIVE_MOD_ADD=$(dirname ${LIVE_MOD_SYS})/addons + MODNAME="0100-${DISTRO}_kernelmodules_${KVER}.sxz" + echo "--- Creating kernelmodules addon live module '${MODNAME}'" + rm -f ${LIVE_MOD_ADD}/${MODNAME} + mksquashfs ${KERDIR} ${LIVE_MOD_ADD}/${MODNAME} -e boot -noappend -comp xz -b 1M + unset LIVE_MOD_SYS LIVE_MOD_ADD MODNAME +fi # Take care of the kernel in the Linux partition: if [ $UPKERNEL -eq 1 ]; then if [ $KBACKUP -eq 1 ]; then # We always make one backup with the suffix ".prev": if [ $VERBOSE -eq 1 ]; then - echo "-- Backing up ${KIMG} to ${USBMNT}/boot/$(basename \"${KIMG}\").prev" + echo "--- Backing up ${KIMG} to ${USBMNT}/boot/$(basename \"${KIMG}\").prev" + else + echo "--- Backing up old kernel" fi mv "${KIMG}" ${USBMNT}/boot/$(basename "${KIMG}").prev else @@ -892,15 +1240,21 @@ if [ $UPKERNEL -eq 1 ]; then fi # And we name our new kernel exactly as the old one: if [ $VERBOSE -eq 1 ]; then - echo "-- Copying \"${KERNEL}\" to ${USBMNT}/boot/$(basename \"${KIMG}\")" + echo "--- Copying \"${KERNEL}\" to ${USBMNT}/boot/$(basename \"${KIMG}\")" + else + echo "--- Adding new kernel" fi cp "${KERNEL}" ${USBMNT}/boot/$(basename "${KIMG}") elif [ $RESTORE -eq 1 -a $KRESTORE -eq 1 ]; then if [ $VERBOSE -eq 1 ]; then - echo "-- Restoring ${USBMNT}/boot/$(basename \"${KIMG}\").prev to ${KIMG}" + echo "--- Restoring ${USBMNT}/boot/$(basename \"${KIMG}\").prev to ${KIMG}" + else + echo "--- Restoring old kernel" fi + OLDKVER=$(file "${KIMG}" |sed 's/^.*\(version [^ ]* \).*$/\1/' |cut -d' ' -f2) rm -f "${KIMG}" mv ${USBMNT}/boot/$(basename "${KIMG}").prev "${KIMG}" + echo "--- You may remove obsolete 'addons/0100-${DISTRO}_kernelmodules_${OLDKVER}.sxz' module" fi if [ $EFIBOOT -eq 1 ]; then @@ -926,16 +1280,40 @@ if [ $CHANGES2SXZ -eq 1 ]; then echo "*** Unable to create file '/mnt/live/changes/.wipe'!" echo "*** Are you sure you are running ${DISTRO^} Live Edition?" else - # Squash the persistence data into a Live .sxz module: + # Squash the persistence data into a Live .sxz module, + # but only if we find the space to do so: + CHANGESSIZE=$(du -sm /mnt/live/changes/ |tr '\t' ' ' |cut -d' ' -f1) + if [ $(( $USBPFREE - $CHANGESSIZE )) -lt $MINFREE ]; then + CHANGES2SXZ=-1 + fi + if [ $CHANGES2SXZ -eq -1 ]; then + echo "*** Not enough space to squash persistence data into a module." + # Don't wipe persistence data on next boot! + rm -f /mnt/live/changes/.wipe + cleanup + exit 1 + fi LIVE_MOD_SYS=$(dirname $(find ${USBMNT} -name "0099-${DISTRO}_zzzconf*.sxz" |head -1)) LIVE_MOD_ADD=$(dirname ${LIVE_MOD_SYS})/addons MODNAME="0100-${DISTRO}_customchanges-$(date +%Y%m%d%H%M%S).sxz" - echo "-- Moving current persistence data into addons module '${MODNAME}'" + echo "--- Moving current persistence data into addons module '${MODNAME}'" mksquashfs /mnt/live/changes ${LIVE_MOD_ADD}/${MODNAME} -noappend -comp xz -b 1M -e .wipe fi fi fi +# Should we extend the size of a container? +if [ -n "${EXTENSION}" ]; then + if [ "$(basename ${EXTENSION} ${CNTEXT})" == "$(basename ${EXTENSION})" ]; + then + echo "*** File '${EXTENSION}' does not have an '${CNTEXT}' extension!" + cleanup + exit 1 + fi + # Expand existing container file: + expand_container ${TARGETP3} ${INCSIZE} ${USBMNT}/${EXTENSION} +fi + # Unmount/remove stuff: cleanup diff --git a/xdm/Xresources b/xdm/Xresources index ceffb27..91f066a 100644 --- a/xdm/Xresources +++ b/xdm/Xresources @@ -36,8 +36,30 @@ xlogin.Login.y: LOGIN_POS_Y xlogin.Login.borderWidth: 0 xlogin.Login.foreground: #ffe4e4 xlogin.Login.background: black +xlogin.Login.hiColor: black +xlogin.Login.shdColor: black +xlogin.Login.inpColor: black +xlogin.Login.innerFramesWidth: 0 +xlogin.Login.sepWidth: 0 xlogin.Login.logoFileName: /etc/X11/xdm/liveslak-xdm/bluepiSW.xpm +xlogin*login.translations: #override \ + Ctrl<Key>R: abort-display()\n\ + <Key>Delete: delete-character()\n\ + <Key>Left: move-backward-character()\n\ + <Key>Right: move-forward-character()\n\ + <Key>Home: move-to-begining()\n\ + <Key>End: move-to-end()\n\ + Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()\n\ + <Key>KP_Enter: set-session-argument() finish-field()\n\ + Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\ + <Key>Return: set-session-argument() finish-field() + <Key>F1: set-session-argument(failsafe) finish-field()\n\ + <Key>F2: set-session-argument(kde) finish-field()\n\ + <Key>F3: set-session-argument(xfce) finish-field()\n\ + <Key>F4: set-session-argument(fvwm2) finish-field()\n\ + <Key>F5: set-session-argument(fluxbox) finish-field()\n\ + .XClock.geometry: 350x28+0-0 .XClock.Clock.analog: false .XClock.Clock.strftime: (%A)\040%F\040%T |