diff options
Diffstat (limited to 'source/installer/build_installer.sh')
-rwxr-xr-x | source/installer/build_installer.sh | 194 |
1 files changed, 162 insertions, 32 deletions
diff --git a/source/installer/build_installer.sh b/source/installer/build_installer.sh index 47c93734a..6cf9cf664 100755 --- a/source/installer/build_installer.sh +++ b/source/installer/build_installer.sh @@ -1,9 +1,7 @@ #!/bin/bash set +o posix -# $Id: build_installer.sh,v 1.129 2011/04/13 23:03:07 eha Exp eha $ -# -# Copyright 2005-2021 Stuart Winter, Surrey, England, UK +# Copyright 2005-2024 Stuart Winter, Earth, Milky Way, "" # Copyright 2008, 2009, 2010, 2011, 2017 Eric Hameleers, Eindhoven, Netherlands # Copyright 2011-2020 Patrick Volkerding, Sebeka, MN, USA # All rights reserved. @@ -54,7 +52,7 @@ shopt -s extglob # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) export ARCH=i586 ;; + i?86) export ARCH=i686 ;; arm*) export ARCH=arm ;; # Unless $ARCH is already set, use uname -m for all other archs: *) export ARCH=$( uname -m ) ;; @@ -108,6 +106,7 @@ case $ARCH in # The firmware we include by default is only for x86, but ADD_NETFIRMWARE=1 # we'll probably want to include some at some stage. For now supply -nf to this script. ADD_NANO=1 + ADD_BRICKTICK=1 ;; x86_64) ADD_NETMODS=1 @@ -124,8 +123,9 @@ case $ARCH in VERBOSE=1 ADD_NETFIRMWARE=1 # Include the network card firmware ADD_NANO=1 + ADD_BRICKTICK=1 ;; - i586) + i686) ADD_NETMODS=1 ADD_PCMCIAMODS=1 ADD_MANPAGES=1 @@ -136,10 +136,11 @@ case $ARCH in RECOMPILE=1 SPLIT_INITRD=0 USBBOOT=1 - EFIBOOT=1 + EFIBOOT=0 VERBOSE=1 ADD_NETFIRMWARE=1 # Include the network card firmware ADD_NANO=1 + ADD_BRICKTICK=1 ;; *) ADD_NETMODS=1 # add network modules @@ -155,6 +156,7 @@ case $ARCH in VERBOSE=1 # show a lot of additional output ADD_NETFIRMWARE=1 # Include the network card firmware ADD_NANO=1 + ADD_BRICKTICK=1 ;; esac @@ -164,7 +166,7 @@ case $ARCH in ARCHQUADLET="-gnueabihf" ;; aarch64) SLKCFLAGS="-O2" ARCHQUADLET="" ;; - i?86) SLKCFLAGS="-O2 -march=i586 -mtune=i686" + i?86) SLKCFLAGS="-O2 -march=i686 -mtune=i686" ARCHQUADLET="" ;; s390*) SLKCFLAGS="-O2" ARCHQUADLET="" ;; @@ -194,10 +196,8 @@ case $ARCH in i?86) # What kernel directories are in this installer? KERNELS[0]=huge.s - KERNELS[1]=hugesmp.s # The -extraversion (appended to the $KVER) for the KERNELS[*]: KEXTRAV[0]="" - KEXTRAV[1]="-smp" ;; x86_64) # What kernel directories are in this installer? @@ -235,6 +235,10 @@ while [ ! -z "$1" ]; do ADD_NETMODS=1 shift ;; + -nb|--no-bricktick) + ADD_BRICKTICK=0 + shift + ;; -nc|--no-compressmods) COMPRESS_MODS=0 shift @@ -543,7 +547,7 @@ rm -rf $TMP/extract-packages mkdir -p -m755 $TMP/extract-packages cd $TMP/extract-packages -# Unpack the real i586/current Slackware initrd.img (or a custom one specified +# Unpack the real i686/current Slackware initrd.img (or a custom one specified # with the '-I' parameter): xzcat -f${VERBOSE1} $INITRDIMG | cpio -di${VERBOSE1} @@ -581,9 +585,6 @@ rm -rf $TMP/extract-packages # Re-create essential symlinks ln -sf sbin/init init -( cd bin; ln -sf grep.bin grep ) -( cd bin; ln -sf grep.bin egrep ) -( cd bin; ln -sf grep.bin fgrep ) ( cd bin; ln -sf gzip zcat ) ( cd bin; ln -sf /usr/bin/compress compress ) ( cd usr/bin; ln -sf ../../bin/gzip zcat ) @@ -670,9 +671,9 @@ make $SILENTMAKE $NUMJOBS CFLAGS="$SLKCFLAGS" || exit 1 make $SILENTMAKE $NUMJOBS install || exit 1 cd _install -# Since Slackware 's installer uses the 'date' from coreutils, and 'zcat' -# script from gzip, we delete the busybox symlinks: -rm -f${VERBOSE1} bin/date bin/zcat +# Since Slackware's installer uses the 'date' and 'dd' from coreutils, +# and the 'zcat' script from gzip, we delete the busybox symlinks: +rm -f${VERBOSE1} bin/{date,dd,zcat} # Likewise, we will remove the 'fdisk' applet which overwrites our shell script: rm -f${VERBOSE1} sbin/fdisk @@ -759,6 +760,9 @@ make $SILENTMAKE DESTDIR=$PKG/$ARCH-installer-filesystem/ MULTI="1" install || e done ) +# Evidently dropbearmulti wants dbclient in /usr/bin: +( cd $PKG/$ARCH-installer-filesystem/usr/bin ; ln -sf ../../bin/dbclient . ) + } ############### Build nano ##################################################### @@ -825,6 +829,84 @@ fi } + +############### Build bricktick ################################################ + +build_bricktick() +{ +echo "--- Building bricktick ncurses game ---" +# Extract source: +cd $TMP +if [ -d $CWD/sources/bricktick ]; then + echo "--- Using _your_ bricktick sources (not those in the Slacktree) ---" + BRICKTICKPATH=$CWD/sources/bricktick +elif [ -d $SRCDIR/sources/bricktick ]; then + echo "--- Using _your_ bricktick sources (not those in the Slacktree) ---" + BRICKTICKPATH=$SRCDIR/sources/bricktick +else + # Use the bricktick sources from the Slackware tree. + BRICKTICKPATH=$SLACKROOT/source/installer/bricktick +fi +[ ! -d $BRICKTICKPATH ] && ( echo "No directory '$BRICKTICKPATH'" ; exit 1 ) +BRICKTICKPKG=$(ls -1 $BRICKTICKPATH/bricktick-*.tar.?z | head -1) +BRICKTICKVER=$(echo $BRICKTICKPKG | rev | cut -f 3- -d . | cut -f 1 -d - | rev) +tar x${VERBOSE2}f $BRICKTICKPKG + +echo "--- Compiling BRICKTICK version '$BRICKTICKVER' ---" +cd bricktick* || exit 1 +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +# Build: +make $NUMJOBS || make || exit 1 + +# Install into installer's filesystem: +mkdir -p $PKG/$ARCH-installer-filesystem/usr/bin +cp -a bricktick $PKG/$ARCH-installer-filesystem/usr/bin/bricktick +strip --strip-unneeded $PKG/$ARCH-installer-filesystem/usr/bin/bricktick + +} + +############### Build dnsmasq ################################################## + +build_dnsmasq() +{ +echo "--- Building dnsmasq ---" +# Extract source: +cd $TMP +if [ -d $CWD/sources/dnsmasq ]; then + DNSMASQPATH=$CWD/sources/dnsmasq +elif [ -d $SRCDIR/sources/dnsmasq ]; then + DNSMASQPATH=$SRCDIR/sources/dnsmasq +fi +[ ! -d $DNSMASQPATH ] && ( echo "No directory '$DNSMASQPATH'" ; exit 1 ) +DNSMASQPKG=$(ls -1 $DNSMASQPATH/dnsmasq-*.tar.?z | head -1) +DNSMASQVER=$(echo $DNSMASQPKG | rev | cut -f 3- -d . | cut -f 1 -d - | rev) +tar x${VERBOSE2}f $DNSMASQPKG + +echo "--- Compiling DNSMASQ version '$DNSMASQVER' ---" +cd dnsmasq* || exit 1 + +zcat $DNSMASQPATH/dnsmasq.leasedir.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 +zcat $DNSMASQPATH/dnsmasq.libidn2.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 +zcat $DNSMASQPATH/dnsmasq-2.80-SIOCGSTAMP.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 + +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +make $NUMJOBS all-i18n PREFIX=/usr MANDIR=/usr/man COPTS=" " || exit 1 + +# Install into installer's filesystem: +mkdir -p $PKG/$ARCH-installer-filesystem/usr/sbin +cp -a src/dnsmasq $PKG/$ARCH-installer-filesystem/usr/sbin/dnsmasq +strip --strip-unneeded $PKG/$ARCH-installer-filesystem/usr/sbin/dnsmasq +chown root:root $PKG/$ARCH-installer-filesystem/usr/sbin/dnsmasq +chmod 755 $PKG/$ARCH-installer-filesystem/usr/sbin/dnsmasq +mkdir -p $PKG/$ARCH-installer-filesystem/usr/man/man8 +cat man/dnsmasq.8 | gzip -9c > $PKG/$ARCH-installer-filesystem/usr/man/man8/dnsmasq.8.gz + +} + ############## Install binaries into installer filesystem ###################### # You can generate file-> package list in slackware-current @@ -881,6 +963,7 @@ a/hdparm \ a/hwdata \ a/inih \ a/jfsutils \ +a/kbd \ a/kmod \ a/lvm2 \ a/lzip \ @@ -897,6 +980,7 @@ a/procps-ng \ a/reiserfsprogs \ a/sed \ a/shadow \ +a/smartmontools \ a/sysfsutils \ a/syslinux \ a/tar \ @@ -908,10 +992,12 @@ a/util-linux \ a/xfsprogs \ a/xz \ a/zerofree \ +a/userspace-rcu \ ap/ddrescue \ ap/dmidecode \ ap/lsscsi \ ap/neofetch \ +ap/nvme-cli \ ap/terminus-font \ d/gcc \ d/gcc-g++ \ @@ -923,17 +1009,18 @@ l/libaio \ l/libcap \ l/libidn2 \ l/libnsl \ +l/libnvme \ l/libunistring \ l/libusb \ +l/lz4 \ l/lzo \ l/parted \ -l/pcre \ +l/pcre2 \ l/popt \ l/readline \ l/zlib \ l/zstd \ n/dhcpcd \ -n/dnsmasq \ n/iproute2 \ n/krb5 \ n/libgcrypt \ @@ -969,10 +1056,12 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_BIN} \ cp \ cut \ date \ + dd \ dialog \ dircolors \ findmnt \ gzip \ + grep egrep fgrep pgrep \ ipmask \ ls \ lsblk \ @@ -994,12 +1083,12 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_BIN} \ $(readlink -s setterm 1>/dev/null) || \ cp --remove-destination -fa${VERBOSE1} setterm \ $PKG/$ARCH-installer-filesystem/bin/ -cp --remove-destination -fa${VERBOSE1} grep $PKG/$ARCH-installer-filesystem/bin/grep.bin cd $TMP/extract-packages/usr/bin cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_USRBIN} \ bash \ ddrescue \ ldd \ + loadkeys \ lzip \ neofetch \ plzip \ @@ -1037,6 +1126,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \ cgdisk \ cryptsetup \ debugfs \ + depmod \ dmsetup \ dosfsck \ dumpe2fs \ @@ -1060,7 +1150,6 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \ logsave \ ldconfig \ lsmod \ - lspci \ lvm \ lvmdump \ mount.nfs \ @@ -1070,6 +1159,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \ mkfs.* \ mklost+found \ mkswap \ + modinfo \ modprobe \ mount \ mdadm \ @@ -1108,9 +1198,9 @@ echo "Syncing filesystems." sync echo "Unmounting filesystems:" # Try to unmount these bind mounts first to prevent them from blocking unmount of the target /: -umount /mnt/dev 2> /dev/null -umount /mnt/proc 2> /dev/null -umount /mnt/sys 2> /dev/null +umount -R /mnt/dev 2> /dev/null +umount -R /mnt/proc 2> /dev/null +umount -R /mnt/sys 2> /dev/null /bin/umount -v -a -t no,proc,sysfs,devtmpfs,fuse.gvfsd-fuse,tmpfs sync echo "Rebooting." @@ -1150,21 +1240,32 @@ cp -a pam.d $PKG/$ARCH-installer-filesystem/etc cd $TMP/extract-packages/usr/share/kbd/consolefonts mkdir -p $PKG/$ARCH-installer-filesystem/usr/share/kbd/consolefonts cp --remove-destination -fa${VERBOSE1} \ + ter-v18n.psf.gz \ ter-114v.psf.gz \ + ter-732b.psf.gz \ $PKG/$ARCH-installer-filesystem/usr/share/kbd/consolefonts +# Get the standard set of keymaps: +cd $TMP/extract-packages/usr/share/kbd/keymaps +mkdir -p $PKG/$ARCH-installer-filesystem/usr/share/kbd/keymaps +cp --remove-destination -fa${VERBOSE1} \ + i386 \ + include \ + $PKG/$ARCH-installer-filesystem/usr/share/kbd/keymaps + # Copy binaries from /usr/sbin into the installer's /usr/sbin/ cd $TMP/extract-packages/usr/sbin cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_USRSBIN} \ chpasswd \ - dnsmasq \ ntpdate \ + nvme \ parted \ partprobe \ partx \ dmidecode \ mount.cifs \ sm-notify \ + smartctl \ sparsify \ umount.cifs \ zerofree \ @@ -1248,8 +1349,11 @@ cp -fa${VERBOSE1} \ libmount.so* \ libnsl.so* \ libpam*.so* \ - libpcre.so* \ + libpcre2-8.so* \ libpopt*.so* \ + liburcu-common.so.* \ + liburcu.so.* \ + libreiserfscore.so* \ libsmartcols.so* \ libssl*so* \ libtirpc*so* \ @@ -1263,6 +1367,7 @@ cp -fa${VERBOSE1} \ cd $TMP/extract-packages/usr/lib${LIBDIRSUFFIX} cp -fa${VERBOSE1} \ libargon2.so* \ + libatomic.so* \ libcryptsetup*.so* \ libefiboot.so* \ libefivar.so* \ @@ -1270,8 +1375,12 @@ cp -fa${VERBOSE1} \ libhistory*.so* \ libidn2*.so* \ libjson-c.so* \ + libkbdfile.so* \ + libkeymap.so* \ liblz.so* \ + liblz4.so* \ liblzo*.so* \ + libnvme*.so* \ libparted*so* \ libreadline*.so* \ libstdc++*.so* \ @@ -1329,11 +1438,15 @@ cp -fa${VERBOSE1} \ chmod 755 $PKG/$ARCH-installer-filesystem/etc/rc.d/rc.rpc mkdir -p $PKG/$ARCH-installer-filesystem/var/state/rpcbind -# Copy /etc/default/{nfs,rpc}: +# NFS & RPC components: cd $TMP/extract-packages/etc/default cp -fa${VERBOSE1} \ nfs rpc \ $PKG/$ARCH-installer-filesystem/etc/default +cd $TMP/extract-packages/usr/libexec +cp -fa${VERBOSE1} \ + nfsrahead \ + $PKG/$ARCH-installer-filesystem/usr/libexec # Remove busybox symlinks for things that we have a real version of: for prunedir in $PKG/$ARCH-installer-filesystem/usr/bin $PKG/$ARCH-installer-filesystem/usr/sbin ; do @@ -1343,9 +1456,13 @@ for prunedir in $PKG/$ARCH-installer-filesystem/usr/bin $PKG/$ARCH-installer-fil rm -f $PKG/$ARCH-installer-filesystem/sbin/$(basename $removefile) done done -if [ -r rm -f $PKG/$ARCH-installer-filesystem/sbin/lspci -a ! -L $PKG/$ARCH-installer-filesystem/sbin/lspci -a -L $PKG/$ARCH-installer-filesystem/bin/lspci ]; then +if [ -r $PKG/$ARCH-installer-filesystem/sbin/lspci -a ! -L $PKG/$ARCH-installer-filesystem/sbin/lspci -a -L $PKG/$ARCH-installer-filesystem/bin/lspci ]; then rm -f $PKG/$ARCH-installer-filesystem/bin/lspci fi +# busybox's implementation of 'xzcat' provides different output when piped into 'dd'. +# Symlink 'xzcat' to the real 'xz' as we do within the OS: +cd $PKG/$ARCH-installer-filesystem/bin +ln -fs xz xzcat # Update to latest versions of files within /etc/ # /etc/ file Package Reason @@ -1530,7 +1647,7 @@ for ind in $(seq 0 $((${#KERNELS[*]} -1)) ); do cp -a fs.orig/{udf*,isofs*,cifs*,ext*,fat*,fscache,jfs*,lockd,nfs,nfs_common,jbd*,nls,reiserfs,xfs,binfmt*,mbcache*,exportfs*} fs/ ;; *86*) - cp -a fs.orig/{cifs*,fscache,lockd,nfs,nfs_common} fs/ + cp -a fs.orig/{cifs*,efivarfs,exfat,fscache,lockd,nfs,nfs_common,ntfs3} fs/ ;; *) cp -a fs.orig/cifs* fs/ @@ -1568,6 +1685,7 @@ for ind in $(seq 0 $((${#KERNELS[*]} -1)) ); do rm -rf${VERBOSE1} cdrom ide md scsi mkdir scsi mv scsi.orig/hv_storvsc.ko scsi + mv scsi.orig/sg.ko scsi rm -rf${VERBOSE1} scsi.orig mkdir md mv md.orig/dm-bufio.ko md @@ -1590,9 +1708,10 @@ for ind in $(seq 0 $((${#KERNELS[*]} -1)) ); do # Done with block directory # Grab a few modules from staging: mv staging staging.orig - mv staging.orig/hv staging - mv staging.orig/exfat staging - mv staging.orig/speakup staging + # These all seem to have been merged... + #mv staging.orig/hv staging + #mv staging.orig/exfat staging + #mv staging.orig/speakup staging rm -rf${VERBOSE1} staging.orig # Save the Hyper-V keyboard module: mkdir -p input.orig/serio @@ -1978,7 +2097,7 @@ fi if [ $SPLIT_INITRD -eq 0 ]; then # Determine the size of the installer: echo " Installer size (uncompressed): $( du -sh . )" - find . | cpio -o -H newc | xz -9fv -C crc32 > $CWD/initrd.img + find . | cpio -o -H newc | xz -9fvv -C crc32 > $CWD/initrd.img echo " New installer image is ${CWD}/initrd.img" cp -a $SLACKROOT/isolinux/isolinux.cfg $CWD/ fi @@ -2255,6 +2374,9 @@ if [ -d usr/man ]; then man1/lzip.1.bz2 \ man1/plzip.1.bz2 \ man1/neofetch.1.bz2 \ + man1/nvme.1.bz2 \ + man8/dmidecode.8.bz2 \ + man8/smartctl.8.bz2 \ ; do mkdir -p man/$(dirname $manpage) cp -a man.full/$manpage man/$manpage @@ -2318,11 +2440,19 @@ else unpack_oldinitrd fi + # Build a simplified version of dnsmasq for PXE installs: + build_dnsmasq + # Are we adding the nano editor? if [ $ADD_NANO -eq 1 ]; then build_nano fi + # Are we adding the bricktick game? + if [ $ADD_BRICKTICK -eq 1 ]; then + build_bricktick + fi + # Are we adding network modules? if [ $ADD_NETMODS -eq 1 ]; then add_netmods |