#!/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 2008, 2009, 2010, 2011, 2017 Eric Hameleers, Eindhoven, Netherlands # Copyright 2011-2020 Patrick Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ################################################################################ # # Script: build_installer.sh # Purpose: Build the Slackware installer from scratch (multiple architectures) # Author: Stuart Winter # Eric Hameleers # ################################################################################ # # Notes: [1] If you want to use your own _skeleton_ initrd (containing only # the directory layout plus all the scripts) you just make it # available as ./sources/initrd/skeleton_initrd.tar.gz # # The script will look for the directory 'sources' first in your # working directory, and next in the script's directory (whatever is # found in your working directory takes precedence). # ################################################################################ # Customized for Slint by Didier Spaier, Paris, France CWD=$(pwd) . $CWD/slint_functions.sh TMP=/tmp/buildslintinstaller rm -rf $TMP # Needed to find package names: shopt -s extglob # Make sure that loopback support is loaded, if it is modular. # Use traditional Q+D methodology... i.e. shove a stick in it # Timmy, by the time anyone notices we'll be dead modprobe loop 1> /dev/null 2> /dev/null # Where do we look for other stuff this script requires? SRCDIR=$(cd $(dirname $0); pwd) # where the script looks for support # Safe defaults: DUMPSKELETON=0 # set to '1' to just create a skeleton initrd tarball SHOWHELP=0 # Do not show help # Settings for Slint ADD_NETMODS=0 ADD_PCMCIAMODS=0 ADD_MANPAGES=0 COMPRESS_MODS=1 ADD_KMS=1 DISTRODIR=${DISTRODIR:-"slackware64"} # below this you find a,ap,d,..,y LIBDIRSUFFIX="64" RECOMPILE=1 VERBOSE=1 # Define the CFLAGS for x86_64 SLKCFLAGS="-O2 -fPIC" ARCHQUADLET="" # Parse the commandline parameters: while [ ! -z "$1" ]; do case $1 in -q|--quiet) VERBOSE=0 shift ;; -v|--verbose) VERBOSE=1 shift ;; -*) echo "Unsupported parameter '$1'!" exit 1 ;; *)# Do nothing shift ;; esac done ############### Some house keeping now that we have read the commandline ####### # If we only want help, do no pre-processing which may lead to error messages if [ "$($(which id) -u)" != "0" ]; then echo "You need to be root to run $(basename $0)." exit 1 fi if [ ! -d $SLACKROOT ]; then echo "*** I can't find the Slackware package tree $SLACKROOT!" exit 1 fi # Determine the kernel version: # In Slint we build for the running kernel KVER=$(uname -r) echo "--- Detected kernel version: '$KVER' ---" if [ $VERBOSE -eq 1 ]; then VERBOSE1="v" VERBOSE2="vv" VERBOSE3="vvv" VERBOSETXT="--verbose" SILENTMAKE="" else VERBOSE1="" VERBOSE2="" VERBOSE3="" VERBOSETXT="" SILENTMAKE="-s" fi ############### Create the Installer's filesystem ############################# create_installer_fs() { # Make the directories required for the filesystem: echo "--- Creating basic filesystem layout ---" mkdir -p -m755 $PKG/$ARCH-installer-filesystem cd $PKG/$ARCH-installer-filesystem mkdir -p -m755 bin mkdir -p -m755 dev mkdir -p -m755 etc/rc.d mkdir -p -m755 etc/dropbear mkdir -p -m755 floppy mkdir -p -m755 lib/modules [[ "${ARCH}" =~ (x86_64$|aarch64$) ]] && mkdir -p -m755 lib64 mkdir -p -m700 lost+found mkdir -p -m755 mnt mkdir -p -m755 proc mkdir -p -m755 root mkdir -p -m755 sbin mkdir -p -m755 sys mkdir -p -m755 tag mkdir -p -m1777 tmp mkdir -p -m755 usr/{bin,sbin,etc,lib/setup,libexec,share/tabset} mkdir -p -m755 usr/share/terminfo/{c,l,v,x,s} mkdir -p -m755 var/{mount,setup,run,lib} ln -sf /mnt/boot boot ln -sf /var/log/mount cdrom ln -sf /var/log/mount nfs ( cd etc; touch mtab ) ( cd etc; touch mdev.conf ) } ############### Unpack skeleton of a Slackware installer image ################# use_installer_source() { if [ ! -f $CWD/sources/initrd/skeleton_initrd.tar.gz ]; then if [ ! -f $SRCDIR/sources/initrd/skeleton_initrd.tar.gz ]; then echo "*** Could not find 'skeleton_initrd.tar.gz' in either:" echo "*** '$CWD/sources/initrd/' or '$SRCDIR/sources/initrd/'" return 1 else SKELFILE="$SRCDIR/sources/initrd/skeleton_initrd.tar.gz" fi else SKELFILE="$CWD/sources/initrd/skeleton_initrd.tar.gz" fi echo "--- Using _your_ skeleton installer (not the initrd in the Slacktree) ---" echo "--- ($SKELFILE) ---" cd $PKG/$ARCH-installer-filesystem tar -zx${VERBOSE1}f $SKELFILE } ############### Build busybox ################################################## build_busybox() { echo "--- Building a new busybox ---" # Extract source: cd $TMP if [ -d $CWD/sources/busybox ]; then echo "--- Using _your_ busybox sources (not those in the Slacktree) ---" BUSYBOXPATH=$CWD/sources/busybox elif [ -d $SRCDIR/sources/busybox ]; then echo "--- Using _your_ busybox sources (not those in the Slacktree) ---" BUSYBOXPATH=$SRCDIR/sources/busybox else # Use the busybox sources from the real Slackware tree: BUSYBOXPATH=$SLACKROOT/source/installer fi [ ! -d $BUSYBOXPATH ] && ( echo "No directory '$BUSYBOXPATH'" ; exit 1 ) BUSYBOXPKG=$(ls -1 $BUSYBOXPATH/busybox-*.tar.bz2 | head -1) BUSYBOXCFG=$(ls -1 $BUSYBOXPATH/busybox?dot?config | head -1) BUSYBOXVER=$(echo $BUSYBOXPKG | sed -e "s#.*/busybox-\(.*\).tar.bz2#\1#") echo "--- Compiling BUSYBOX version '$BUSYBOXVER' ---" tar x${VERBOSE2}f $BUSYBOXPKG cd busybox-* || exit 1 if $(ls $BUSYBOXPATH/busybox*.diff.gz 1>/dev/null 2>/dev/null) ; then for DIFF in $(ls $BUSYBOXPATH/busybox*.diff.gz) ; do zcat $DIFF | patch -p1 --verbose || exit 1 done fi chown -R root:root . # Copy config: install -m644 $BUSYBOXCFG .config # Build: make $SILENTMAKE $NUMJOBS CFLAGS="$SLKCFLAGS" || exit 1 # Install into package framework: 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 # Likewise, we will remove the 'fdisk' applet which overwrites our shell script: rm -f${VERBOSE1} sbin/fdisk # And we want to use our own 'cp': rm -f${VERBOSE1} bin/cp cp --remove-destination -fa${VERBOSE2} * $PKG/$ARCH-installer-filesystem/ # If we built bin/env, make a link in usr/bin as well: if [ -x $PKG/$ARCH-installer-filesystem/bin/env ]; then ( cd $PKG/$ARCH-installer-filesystem/usr/bin ; ln -sf ../../bin/env . ) fi } ############## Install binaries into installer filesystem ###################### # You can generate file-> package list in slackware-current # cd slackware-current/${DISTRODIR} # find . -name '*.t?z' | while read name ; do echo "****** $name ******" ; tar tvvf $name ; done > /tmp/newfest # import_binaries() { # Change into the installer's filesystem: cd $PKG/$ARCH-installer-filesystem echo "--- Importing binaries from Slackware packages ---" # Temporary extraction directory: rm -rf $TMP/extract-packages mkdir -p -m755 $TMP/extract-packages # This list of packages (Slackware v13.0+): # Added for Slint below: # l/fftw => /usr/lib64/libfftw3f.so.3 # l/libsmamplerate => /usr/lib64/libsamplerate.so.0 # l/lz4 => /usr/liblz4.so.1 # l/libcap-ng => lib64/libcap-ng.so.0 PKGLIST=" \ l/fftw \ l/libsamplerate \ l/lz4 \ l/libcap-ng \ a/bash \ a/btrfs-progs \ a/coreutils \ a/cryptsetup \ a/dialog \ a/dosfstools \ a/e2fsprogs \ a/efivar \ a/elogind \ a/etc \ a/f2fs-tools \ a/gptfdisk \ a/grep \ a/gzip \ a/hdparm \ a/hwdata \ a/inih \ a/jfsutils \ a/kmod \ a/lvm2 \ a/lzip \ a/lzlib \ a/mdadm \ a/ncompress \ a/openssl-solibs \ a/os-prober \ a/pam \ a/pciutils \ a/plzip \ a/pkgtools \ a/procps-ng \ a/reiserfsprogs \ a/sed \ a/shadow \ a/sysfsutils \ a/tar \ a/eudev \ a/hostname \ a/libgudev \ a/usbutils \ a/util-linux \ a/xfsprogs \ a/xz \ a/zerofree \ ap/ddrescue \ ap/dmidecode \ ap/lsscsi \ ap/neofetch \ ap/nvme-cli \ ap/terminus-font \ d/gcc \ d/gcc-g++ \ l/argon2 \ l/glibc \ l/json-c \ l/keyutils \ l/libaio \ l/libcap \ l/libidn2 \ l/libnsl \ l/libunistring \ l/libusb \ l/lzo \ l/parted \ l/pcre \ l/popt \ l/readline \ l/zlib \ l/zstd \ n/dhcpcd \ n/iproute2 \ n/krb5 \ n/libgcrypt \ n/libgpg-error \ n/libtirpc \ n/net-tools \ n/nfs-utils \ n/ntp \ n/rpcbind \ n/samba" # Prevent a harmless (but ugly) build-time error: mkdir -p $TMP/extract-packages/etc touch $TMP/extract-packages/etc/shells # Cruise through the required packages and extract them into # a temporary directory: for pkg in $PKGLIST ; do if [ -s $SLACKROOT/${DISTRODIR}/$pkg-+([^-])-+([^-])-+([^-]).t[gblx]z ]; then installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/$pkg-+([^-])-+([^-])-+([^-]).t[gblx]z else echo "*** Package: "$pkg" not found in ${SLACKROOT}/${DISTRODIR} ***" fi done # # Deal with the installer's /bin: # cd $TMP/extract-packages/bin cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_BIN} \ bash \ comm \ cp \ cut \ date \ dialog \ dircolors \ findmnt \ gzip \ ipmask \ ls \ lsblk \ paste \ printf \ pr \ ps \ mknod \ mount \ numfmt \ sed \ seq \ sort \ tar \ umount \ xz \ zgrep \ $PKG/$ARCH-installer-filesystem/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 \ lzip \ neofetch \ plzip \ rev \ uuidgen \ strings \ $PKG/$ARCH-installer-filesystem/usr/bin/ # Fix ldd shebang: sed -i "s|/usr/bin/bash|/bin/bash|g" $PKG/$ARCH-installer-filesystem/usr/bin/ldd $(readlink -s setterm 1>/dev/null) || \ cp --remove-destination -fa${VERBOSE1} setterm \ $PKG/$ARCH-installer-filesystem/usr/bin/ cp --remove-destination -fa${VERBOSE1} \ compress \ $PKG/$ARCH-installer-filesystem/usr/bin/ # Make sure that /bin/sh points to bash: ( cd $PKG/$ARCH-installer-filesystem/bin ln -${VERBOSE1}fs bash sh ) # # Deal with the installer's /sbin: # cd $TMP/extract-packages/sbin cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \ badblocks \ blkid \ btrfs* \ cgdisk \ cryptsetup \ debugfs \ dmsetup \ dosfsck \ dumpe2fs \ e2fsck \ fsck \ fsck.* \ filefrag \ fixparts \ hdparm \ insmod \ e2image \ e2label \ e4crypt \ gdisk \ getcap \ fsfreeze \ fstrim \ jfs_fsck \ jfs_mkfs \ kmod \ logsave \ ldconfig \ lsmod \ lspci \ lvm \ lvmdump \ mount.nfs \ mkdosfs \ mke2fs \ mkreiserfs \ mkfs.* \ mklost+found \ mkswap \ modprobe \ mount \ mdadm \ rdev \ reiserfsck \ rmmod \ resize2fs \ rpcbind \ rpc.statd \ setcap \ sfdisk \ sgdisk \ swaplabel \ tune2fs \ udev* \ umount \ xfs_repair \ wipefs \ zramctl \ $PKG/$ARCH-installer-filesystem/sbin/ # This had dmsetup* above, which unnecessarily copies dmsetup.static # This had lvm* above, which unnecessarily copies lvm.static cp --remove-destination -fa${VERBOSE1} fdisk \ $PKG/$ARCH-installer-filesystem/sbin/fdisk.bin # Hack reboot to call reboot -f: rm -f $PKG/$ARCH-installer-filesystem/sbin/reboot ( cd $PKG/$ARCH-installer-filesystem/bin ; ln -sf busybox reboot ) cat << EOF > $PKG/$ARCH-installer-filesystem/sbin/reboot #!/bin/sh echo "Sending all processes the SIGTERM signal." /sbin/killall5 -15 /bin/sleep 2 echo "Sending all processes the SIGKILL signal." /sbin/killall5 -9 /bin/sleep 2 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 /bin/umount -v -a -t no,proc,sysfs,devtmpfs,fuse.gvfsd-fuse,tmpfs sync echo "Rebooting." if [ -z "\$*" ]; then /bin/reboot -f else /bin/reboot \$* fi EOF chmod 755 $PKG/$ARCH-installer-filesystem/sbin/reboot # Copy binaries from /usr/bin into the installer's /usr/bin/ cd $TMP/extract-packages/usr/bin cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_USRBIN} \ chattr \ lsattr \ lsusb \ mcookie \ usb-devices \ $PKG/$ARCH-installer-filesystem/usr/bin/ # Copy PAM's security directory: cd $TMP/extract-packages/lib${LIBDIRSUFFIX} cp -a security $PKG/$ARCH-installer-filesystem/lib${LIBDIRSUFFIX} # Copy PAM's config files: cd $TMP/extract-packages/etc cp -a pam.d $PKG/$ARCH-installer-filesystem/etc ( cd $PKG/$ARCH-installer-filesystem/etc/pam.d for file in *.new ; do mv $file $(basename $file .new) done ) # Grab a couple of terminus fonts that we'll need to prevent # blindness from microscopic KMS terminal fonts: cd $TMP/extract-packages/usr/share/kbd/consolefonts mkdir -p $PKG/$ARCH-installer-filesystem/usr/share/kbd/consolefonts cp --remove-destination -fa${VERBOSE1} \ ter-114v.psf.gz \ ter-732b.psf.gz \ $PKG/$ARCH-installer-filesystem/usr/share/kbd/consolefonts # 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 \ ntpdate \ nvme \ parted \ partprobe \ partx \ dmidecode \ mount.cifs \ sm-notify \ sparsify \ umount.cifs \ zerofree \ $PKG/$ARCH-installer-filesystem/usr/sbin/ # The installer has wrappers for cfdisk/fdisk which run /dev/makedevs.sh # if it is there. If it is not there, udev is running and will handle # creating or removing block devices in /dev as needed: cd $TMP/extract-packages/sbin cp --remove-destination -fa${VERBOSE1} \ cfdisk \ $PKG/$ARCH-installer-filesystem/sbin/cfdisk.bin # And for LVM, there are tonnes of symlinks: cd $TMP/extract-packages/sbin find . -type l -lname lvm -printf "%p\n" | xargs -i cp -fa${VERBOSE1} {} $PKG/$ARCH-installer-filesystem/sbin/ # Fix lvmdump script: sed -i -e 's?/usr/bin/tr?tr?' $PKG/$ARCH-installer-filesystem/sbin/lvmdump # Grab the matching lvm.conf script: mkdir -p $PKG/$ARCH-installer-filesystem/etc/lvm cat $TMP/extract-packages/etc/lvm/lvm.conf \ > $PKG/$ARCH-installer-filesystem/etc/lvm/lvm.conf # Use a current group file (udev expects this) cat $TMP/extract-packages/etc/group > $PKG/$ARCH-installer-filesystem/etc/group ## Copy udev related files over (do not clobber an existing blacklist): #if [ -f $PKG/$ARCH-installer-filesystem/etc/modprobe.d/blacklist ]; then # mv $PKG/$ARCH-installer-filesystem/etc/modprobe.d/blacklist{,.new} #fi # Copy udev related files over cp -a $TMP/extract-packages/etc/modprobe.d $PKG/$ARCH-installer-filesystem/etc/ mkdir -p $PKG/$ARCH-installer-filesystem/lib cp -a $TMP/extract-packages/lib/modprobe.d $PKG/$ARCH-installer-filesystem/lib/ cp -a $TMP/extract-packages/etc/{modprobe.conf,modprobe.d,scsi_id.config,udev} \ $PKG/$ARCH-installer-filesystem/etc/ cp -a $TMP/extract-packages/etc/rc.d/rc.udev \ $PKG/$ARCH-installer-filesystem/etc/rc.d/ #if [ -f $PKG/$ARCH-installer-filesystem/etc/modprobe.d/blacklist.new ]; then # mv $PKG/$ARCH-installer-filesystem/etc/modprobe.d/blacklist{.new,} #fi # Copy package tools: cd $TMP/extract-packages/sbin cp --remove-destination -fa${VERBOSE1} \ installpkg \ pkgtool \ removepkg \ upgradepkg \ $PKG/$ARCH-installer-filesystem/sbin/ # Deal with /lib stuff from the packages: mkdir -p -m755 $PKG/$ARCH-installer-filesystem/lib mkdir -p -m755 $PKG/$ARCH-installer-filesystem/lib${LIBDIRSUFFIX} mkdir -p -m755 $PKG/$ARCH-installer-filesystem/usr/lib${LIBDIRSUFFIX} cp -fa${VERBOSE1} $TMP/extract-packages/lib/udev \ $PKG/$ARCH-installer-filesystem/lib/ cd $TMP/extract-packages/lib${LIBDIRSUFFIX} # Added for Slint below: # lincap-ng => libcap-ng.so* cp -fa${VERBOSE1} \ libcap-ng.so* \ e2initrd_helper \ libaio.so* \ libblkid*so* \ libcap*so* \ libcrypto*so* \ libdevmapper*so* \ libelogind*so* \ libf2fs.so* \ libfdisk.so* \ libgcrypt*.so* \ libgpg-error*.so* \ libgssapi_krb5.so* \ libinih.so* \ libINIReader.so* \ libk5crypto.so* \ libkeyutils.so* \ libkmod*so* \ libkrb5.so* \ libkrb5support.so* \ liblzma*so* \ libmount.so* \ libnsl.so* \ libpam*.so* \ libpcre.so* \ libpopt*.so* \ libsmartcols.so* \ libssl*so* \ libtirpc*so* \ libudev*so* \ libuuid*so* \ libvolume_id*so* \ libz*.so* \ $PKG/$ARCH-installer-filesystem/lib${LIBDIRSUFFIX}/ # Deal with /usr/lib stuff from the packages: # This list of packages (Slackware v13.0+): # Added for Slint below: # l/fftw => /usr/lib64/libfftw3f.so.3 # l/libsmamplerate => /usr/lib64/libsamplerate.so.0 # l/lz4 => l/usr/liblz4.so.1 cd $TMP/extract-packages/usr/lib${LIBDIRSUFFIX} cp -fa${VERBOSE1} \ libfftw3f.so* \ libsamplerate.so* \ liblz4.so* \ libargon2.so* \ libcryptsetup*.so* \ libefiboot.so* \ libefivar.so* \ libgcc*.so* \ libgcc_s.so* \ libhistory*.so* \ libidn2*.so* \ libjson-c.so* \ liblz.so* \ liblzo*.so* \ libparted*so* \ libreadline*.so* \ libstdc++*.so* \ libunistring*.so* \ libusb-1.0*.so* \ libzstd.so* \ $PKG/$ARCH-installer-filesystem/usr/lib${LIBDIRSUFFIX}/ # Stuff needed for os-prober: cd $TMP/extract-packages/usr/share cp -fa${VERBOSE1} \ os-prober \ $PKG/$ARCH-installer-filesystem/usr/share/ cd $TMP/extract-packages/usr/lib${LIBDIRSUFFIX} cp -fa${VERBOSE1} \ os-probes \ os-prober \ linux-boot-probes \ $PKG/$ARCH-installer-filesystem/usr/lib${LIBDIRSUFFIX}/ cd $TMP/extract-packages/usr/bin cp -fa${VERBOSE1} \ linux-boot-prober \ os-prober \ $PKG/$ARCH-installer-filesystem/usr/bin/ # Copy dhcpcd pieces: cd $TMP/extract-packages/ cp -fa${VERBOSE1} \ lib/dhcpcd \ $PKG/$ARCH-installer-filesystem/lib/ cp -fa${VERBOSE1} \ usr/lib${LIBDIRSUFFIX}/dhcpcd \ $PKG/$ARCH-installer-filesystem/usr/lib${LIBDIRSUFFIX}/ cp -fa${VERBOSE1} \ var/lib/dhcpcd \ $PKG/$ARCH-installer-filesystem/var/lib/ cp -fa${VERBOSE1} \ etc/dhcpcd.conf \ $PKG/$ARCH-installer-filesystem/etc/ cp -fa${VERBOSE1} \ sbin/dhcpcd \ $PKG/$ARCH-installer-filesystem/sbin/ # Add pci.ids and usb.ids now that we have lspci and lsusb onboard: cd $TMP/extract-packages/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 # Copy the rc script for rpcbind: cd $TMP/extract-packages/etc/rc.d cp -fa${VERBOSE1} \ rc.rpc \ $PKG/$ARCH-installer-filesystem/etc/rc.d/ 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}: cd $TMP/extract-packages/etc/default cp -fa${VERBOSE1} \ nfs rpc \ $PKG/$ARCH-installer-filesystem/etc/default # 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 cd $prunedir for removefile in $(find . -type f -maxdepth 1) ; do rm -f $PKG/$ARCH-installer-filesystem/bin/$(basename $removefile) rm -f $PKG/$ARCH-installer-filesystem/sbin/$(basename $removefile) done done #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 # Update to latest versions of files within /etc/ # /etc/ file Package Reason # ------------------------------------------------------------------------------------ # netconfig : libtirpc : Required by libtirpc (for rpc.statd/rpcbind) # services : etc : Always use the latest version to avoid problems with NFS. # dialogrc : dialog : Dialog config # mke2fs.conf : e2fsprogs: Required for ext4 # nfsmount.conf : nfs-utls : On ARM we set "vers=3" as the default which allows # easy NFS mounting within the installer. cd $TMP/extract-packages/etc/ cp -fa${VERBOSE1} \ services \ netconfig \ nfsmount.conf \ dialogrc \ mke2fs.conf \ $PKG/$ARCH-installer-filesystem/etc/ # For ARM: # Copy the configuration file for fw_(printenv/saveenv) utility. # This allows people to more easily fix up a duff u-boot config # from the installer because the config file contains some of the memory offsets # for the most popular devices [ -s $TMP/extract-packages/etc/fw_env.config* ] \ && install -${VERBOSE1}pm644 $TMP/extract-packages/etc/fw_env.config* \ $PKG/$ARCH-installer-filesystem/etc/fw_env.config # If man pages have been requested, copy the groff sources to process later # For now, these will be English only (sorry) if [ $ADD_MANPAGES -eq 1 ]; then if [ -d $TMP/extract-packages/usr/man ]; then mkdir -p $PKG/$ARCH-installer-filesystem/usr/man/ cd $TMP/extract-packages/usr/man cp --remove-destination -fa${VERBOSE1} man* \ $PKG/$ARCH-installer-filesystem/usr/man/ fi # In case the real man package has been installed (unlikely) if [ -f $TMP/extract-packages/lib${LIBDIRSUFFIX}/man.conf ]; then cp -a $TMP/extract-packages/lib${LIBDIRSUFFIX}/man.conf $PKG/$ARCH-installer-filesystem/usr/lib${LIBDIRSUFFIX} fi fi } ############### Install libraries into installer's filesystem ################## # We install the library packages and copy only the parts that we need. # # Rather than automate the process, for some packages we need to specifically # select individual library names. # In case you wonder why we don't copy these libraries during the extraction # in the code above, it's because this way we don't need to keep up to date with # any new library names or versions - we either take everything or be very # specific -- this is particularly relevant for glibc. import_libraries() { rm -rf $TMP/extract-packages mkdir -p $TMP/extract-packages # Change into the installer's filesystem: cd $PKG/$ARCH-installer-filesystem echo "--- Importing libraries from Slackware packages ---" # a/e2fsprogs: installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/e2fsprogs-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ rm -rf $TMP/extract-packages # a/aaa_glibc-solibs: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/aaa_glibc-solibs-*.t[gblx]z cp -fa${VERBOSE1} /lib${LIBDIRSUFFIX}/ld-linux*so* lib${LIBDIRSUFFIX}/ cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ # pt_chown has been removed from glibc as a possible security hole: #cp --remove-destination -fa${VERBOSE1} $TMP/extract-packages/usr/libexec/pt_chown usr/libexec rm -rf $TMP/extract-packages # l/ncurses: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/l/ncurses-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ cp -fa${VERBOSE1} $TMP/extract-packages/usr/share/terminfo/{c,l,v,s,x} usr/share/terminfo/ # Remove any terminal entries that are broken due to them being symlinks into directories that we haven't included: find usr/share/terminfo/ -xtype l -print0 | xargs -0 rm -f cp -fa${VERBOSE1} $TMP/extract-packages/usr/share/tabset/* usr/share/tabset/ rm -rf $TMP/extract-packages # Remove dangling symlinks (pointing into directories we did not copy): ( cd usr/share/terminfo for file in $(find . -type l) ; do if [ "$(readlink -e $file)" = "" ]; then rm -f${VERSOSE1} $file fi done ) # a/acl: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/acl-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ rm -rf $TMP/extract-packages # a/attr: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/attr-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ rm -rf $TMP/extract-packages # a/pciutils: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/pciutils-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ rm -rf $TMP/extract-packages # a/procps-ng: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/procps-ng-*.t[gblx]z cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ lib${LIBDIRSUFFIX}/ rm -rf $TMP/extract-packages # coreutils: mkdir -p $TMP/extract-packages installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/coreutils*txz cp -f $TMP/extract-packages/bin/pathchk usr/bin/ || exit 1 cp -f $TMP/extract-packages/bin/pathchk bin/ || exit 1 rm -rf $TMP/extract-packages # a/gpm: #mkdir -p $TMP/extract-packages #installpkg --terse -root $TMP/extract-packages $SLACKROOT/${DISTRODIR}/a/gpm-*.t[gblx]z #cp -fa${VERBOSE1} $TMP/extract-packages/lib${LIBDIRSUFFIX}/*so* \ # lib${LIBDIRSUFFIX}/ #rm -rf $TMP/extract-packages } ############### Time to call all our functions ################################# if [ $SHOWHELP -eq 1 ]; then basic_usage exit fi # Clean build environment: rm -rf $TMP $PKG mkdir -p $TMP $PKG rm -f $CWD/initrd*.img $CWD/usbboot.img rm -f $CWD/isolinux.cfg ${CWD}/pxelinux.cfg_default echo # Are we re-compiling busybox/dropbear and populating with binaries? create_installer_fs echo "now running use_installer_source" use_installer_source build_busybox || exit 1 import_binaries || exit 1 import_libraries || exit 1 rm -rf $DEST/usr/lib/setup add_packages localize_the_installer customize # axfer is not shipped in Slackware 15.0 and would need liffado, not shipped either # and we do not relly need axfer # This missing symlink in the Slint installer prevents ldd to work with this error message: # bash: /usr/bin/ldd: /usr/bin/bash: bad interpreter: No such file or directory (cd $DEST ln -sf bin/bash usr/bin/bash rm -f usr/bin/axfer ) create_initrd_Slint add_booting_equipment