summaryrefslogtreecommitdiffstats
path: root/source/installer/build_installer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'source/installer/build_installer.sh')
-rwxr-xr-xsource/installer/build_installer.sh205
1 files changed, 174 insertions, 31 deletions
diff --git a/source/installer/build_installer.sh b/source/installer/build_installer.sh
index 42bb23539..9eb4de3b1 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
@@ -864,6 +946,7 @@ case $ARCH in
esac
PKGLIST="${EXTRA_PKGS} \
a/bash \
+a/bcachefs-tools \
a/btrfs-progs \
a/coreutils \
a/cryptsetup \
@@ -881,6 +964,7 @@ a/hdparm \
a/hwdata \
a/inih \
a/jfsutils \
+a/kbd \
a/kmod \
a/lvm2 \
a/lzip \
@@ -897,6 +981,7 @@ a/procps-ng \
a/reiserfsprogs \
a/sed \
a/shadow \
+a/smartmontools \
a/sysfsutils \
a/syslinux \
a/tar \
@@ -908,6 +993,7 @@ a/util-linux \
a/xfsprogs \
a/xz \
a/zerofree \
+a/userspace-rcu \
ap/ddrescue \
ap/dmidecode \
ap/lsscsi \
@@ -924,17 +1010,20 @@ l/libaio \
l/libcap \
l/libidn2 \
l/libnsl \
+l/libnvme \
+l/libsodium \
l/libunistring \
l/libusb \
+l/lz4 \
l/lzo \
l/parted \
-l/pcre \
+l/pcre2 \
l/popt \
l/readline \
+l/sg3_utils \
l/zlib \
l/zstd \
n/dhcpcd \
-n/dnsmasq \
n/iproute2 \
n/krb5 \
n/libgcrypt \
@@ -970,10 +1059,12 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_BIN} \
cp \
cut \
date \
+ dd \
dialog \
dircolors \
findmnt \
gzip \
+ grep egrep fgrep pgrep \
ipmask \
ls \
lsblk \
@@ -995,17 +1086,20 @@ 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 \
rev \
uuidgen \
+ rescan-scsi-bus.sh \
+ sg_inq \
+ sg_turs \
syslinux-nomtools \
strings \
$PKG/$ARCH-installer-filesystem/usr/bin/
@@ -1033,11 +1127,13 @@ cp --remove-destination -fa${VERBOSE1} \
cd $TMP/extract-packages/sbin
cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
badblocks \
+ *bcachefs* \
blkid \
btrfs* \
cgdisk \
cryptsetup \
debugfs \
+ depmod \
dmsetup \
dosfsck \
dumpe2fs \
@@ -1061,7 +1157,6 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
logsave \
ldconfig \
lsmod \
- lspci \
lvm \
lvmdump \
mount.nfs \
@@ -1071,6 +1166,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
mkfs.* \
mklost+found \
mkswap \
+ modinfo \
modprobe \
mount \
mdadm \
@@ -1109,9 +1205,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."
@@ -1151,15 +1247,23 @@ 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 \
@@ -1168,6 +1272,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_USRSBIN} \
dmidecode \
mount.cifs \
sm-notify \
+ smartctl \
sparsify \
umount.cifs \
zerofree \
@@ -1251,8 +1356,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* \
@@ -1266,6 +1374,7 @@ cp -fa${VERBOSE1} \
cd $TMP/extract-packages/usr/lib${LIBDIRSUFFIX}
cp -fa${VERBOSE1} \
libargon2.so* \
+ libatomic.so* \
libcryptsetup*.so* \
libefiboot.so* \
libefivar.so* \
@@ -1273,10 +1382,16 @@ 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* \
+ libsgutils2*.so* \
+ libsodium.so* \
libstdc++*.so* \
libunistring*.so* \
libusb-1.0*.so* \
@@ -1320,9 +1435,13 @@ cp -fa${VERBOSE1} \
# Add pci.ids and usb.ids now that we have lspci and lsusb onboard:
cd $TMP/extract-packages/usr/share/hwdata
+# Remove any previous data files that exist if you're working with
+# an existing initrd image:
+rm -rf $PKG/$ARCH-installer-filesystem/usr/share/hwdata
mkdir -p -m755 $PKG/$ARCH-installer-filesystem/usr/share/hwdata
cp -fa${VERBOSE1} pci.ids usb.ids \
$PKG/$ARCH-installer-filesystem/usr/share/hwdata
+gzip -f9${VERBOSE1} $PKG/$ARCH-installer-filesystem/usr/share/hwdata/*
# Copy the rc script for rpcbind:
cd $TMP/extract-packages/etc/rc.d
@@ -1332,11 +1451,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
@@ -1346,9 +1469,18 @@ 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
- 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
+
+# Busybox's implementation of 'lspci' doesn't consult the hardware data within
+# /usr/share/hwdata. Replace it with pciutils' version:
+cp --remove-destination \
+ -fa${VERBOSE1} \
+ $TMP/extract-packages/usr/bin/lspci \
+ $PKG/$ARCH-installer-filesystem/bin/
# Update to latest versions of files within /etc/
# /etc/ file Package Reason
@@ -1533,7 +1665,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*,exfat,fscache,lockd,nfs,nfs_common,ntfs3} fs/
+ cp -a fs.orig/{cifs*,efivarfs,exfat,fscache,lockd,nfs,nfs_common,ntfs3} fs/
;;
*)
cp -a fs.orig/cifs* fs/
@@ -1983,7 +2115,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
@@ -2145,6 +2277,7 @@ if [ -d usr/man ]; then
# man page format... perhaps handy for future documentation, or
# README_LVM, etc. ?
for manpage in \
+ man8/bcachefs.8.bz2 \
man8/cfdisk.8.bz2 \
man8/fdisk.8.bz2 \
man8/gdisk.8.bz2 \
@@ -2261,6 +2394,8 @@ if [ -d usr/man ]; then
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
@@ -2324,11 +2459,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