summaryrefslogtreecommitdiffstats
path: root/source/installer
diff options
context:
space:
mode:
Diffstat (limited to 'source/installer')
-rw-r--r--source/installer/ChangeLog.txt220
-rwxr-xr-xsource/installer/build_installer.sh183
-rwxr-xr-xsource/installer/installer.SlackBuild8
-rwxr-xr-xsource/installer/repack_installer.SlackBuild8
-rwxr-xr-xsource/installer/sources/bricktick/fetch-bricktick.sh52
-rw-r--r--source/installer/sources/dnsmasq/dnsmasq-2.80-SIOCGSTAMP.patch60
-rw-r--r--source/installer/sources/dnsmasq/dnsmasq.leasedir.diff24
-rw-r--r--source/installer/sources/dnsmasq/dnsmasq.libidn2.diff13
-rw-r--r--source/installer/sources/initrd/etc/keymaps.tarbin573440 -> 0 bytes
l---------source/installer/sources/initrd/etc/mtab (renamed from source/installer/sources/initrd/etc/mounts)0
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.S51
-rwxr-xr-xsource/installer/sources/initrd/etc/rc.d/rc.pcmcia2
-rwxr-xr-xsource/installer/sources/initrd/sbin/mkbindmounts10
-rwxr-xr-xsource/installer/sources/initrd/sbin/probe73
-rwxr-xr-xsource/installer/sources/initrd/sbin/rescan-scsi-bus1248
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/INS-all-in-one199
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTEFI17
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTconfig4
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTkeymap183
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTmedia12
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTpasswd2
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/pxesetup4
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/setup56
23 files changed, 1228 insertions, 1201 deletions
diff --git a/source/installer/ChangeLog.txt b/source/installer/ChangeLog.txt
index 5282ea364..6b40c72d4 100644
--- a/source/installer/ChangeLog.txt
+++ b/source/installer/ChangeLog.txt
@@ -1,3 +1,223 @@
+Mon Mar 18 08:08:08 UTC 2024
+ Added console font 'ter-v18n' to accommodate the Raspberry Pi 400's screen.
+ Thanks to BrianL.
++--------------------------+
+Sun Mar 10 17:49:27 UTC 2024
+ mkbindmounts: also bind mount /sys/firmware/efi/efivars if it exists.
+ SeTconfig: also bind mount /sys/firmware/efi/efivars if it exists.
++--------------------------+
+Thu Feb 1 19:36:54 UTC 2024
+ Don't add elilo boot support to the 32-bit installer image. This had been
+ done previously, but began being siliently dropped when the 32-bit kernel
+ changed from i586 to i686. But it's just as well since UEFI cannot directly
+ boot a 32-bit kernel anyway. Legacy BIOS is the only option.
++--------------------------+
+Wed Jan 31 20:35:22 UTC 2024
+ Added libnvme.
++--------------------------+
+Tue Jan 2 09:03:56 UTC 2024
+ build_installer.sh: Switch /sbin/modinfo from BusyBox's implementation to
+ kmod's, as the busybox implementation doesn't work.
+ Switch /bin/grep to the GNU implementation for a richer feature set.
+ Use the /bin/{e,f}grep shell wrappers, aligned with the OS.
+ /etc/rc.d/rc.S: Call /bin/grep rather than /bin/grep.bin
++--------------------------+
+Mon Dec 11 20:24:00 UTC 2023
+ build_installer.sh: On x86, don't try to use a kernel with an -smp
+ LOCALVERSION as it's no longer built. The regularly-named kernels are now
+ the SMP/i686 versions.
+ repack_installer.SlackBuild: Change x86 $ARCH to i686 and drop -smp
+ LOCALVERSION.
++--------------------------+
+Fri Dec 1 09:49:03 GMT 2023
+ Busybox's version of 'xzcat' creates distinct output compared to the actual
+ 'xz' when combined with 'dd' through piping. This issue is fixed by creating
+ a symbolic link from /bin/xzcat to /bin/xz (the 'real' xz).
+ Thanks to Stuart Winter.
++--------------------------+
+Sat Nov 25 17:21:48 UTC 2023
+ Added /usr/libexec/nfsrahead from nfs-utils package to fix error:
+ udevd[452]: failed to execute '/usr/libexec/nfsrahead'
+ '/usr/libexec/nfsrahead 254:0': No such file or directory
+ Thanks to Brent Earl.
++--------------------------+
+Wed Nov 8 21:01:19 UTC 2023
+ Include the original keymaps from the kbd package, as well as the official
+ loadkeys binary and supporting libraries. Some keymaps seem to get broken
+ or mangled from being converted to a binary keymap and loaded with the
+ busybox loadkmap tool.
+ If a keymap is specified on the kernel command line, like: kbd=azerty
+ then after loading it, save the name to /tmp/Pkeymap so that setup knows
+ about it.
+ Construct the list of keymaps on the fly from the /usr/share/kbd/keymaps/i386
+ directory.
++--------------------------+
+Wed Sep 20 08:08:08 UTC 2023
+ Changes for AArch64 architecture:
+ /sbin/probe: Updated reserved file system labels for Hardware Models with
+ UEFI firmware.
+ In 'list_mmc' MMC discovery function, prevent duplication of multi-path
+ devices.
+ /usr/lib/setup/SeTEFI: The Slackware Installer image has its own EFI boot
+ partition named 'SLKins_efi' to support Hardware Models using UEFI firmware.
+ This partition must be filtered out here to avoid it being incorrectly
+ selected as the OS's EFI partition.
+ Thanks to Stuart Winter.
++--------------------------+
+Tue Aug 15 19:15:38 UTC 2023
+ Don't run rc.font unless a kernel command-line flag RCFONT is provided.
+ Legacy BIOS tends to get a correct sized font without it, as does recent
+ UEFI. Running it by default with a HiDPI screen can result in an
+ unreadably small font.
++--------------------------+
+Tue Aug 1 09:09:59 UTC 2023
+ Added /usr/lib(64)/libatomic.so for 'lsusb'
+ Thanks to William PC for the report.
++--------------------------+
+Sun Jul 9 18:25:37 UTC 2023
+ setup: mount /dev, /proc, and /sys with -rbind, and unmount them with -R.
+ mkbindmounts: usr -rbind instead of -bind.
+ reboot: use -R when unmounting /dev, /proc, and /sys.
+ These changes should fix "EFI variables are not supported on this system"
+ when chrooting into /mnt to do additional tasks such as setting up grub.
+ Thanks to downhomechunk.
++--------------------------+
+Sat Jul 1 03:15:09 UTC 2023
+ AArch64:
+ /sbin/probe: Added reserved file system labels for Hardware Models
+ with UEFI firmware:
+ SLKefi = FAT32 file system, /boot/efi mountpoint within the OS.
+ SLKefi_fw = ext4 file system within the Installer image containing UEFI
+ firmware. The firmware can be offered up for flashing to SPI from
+ within the post installation scripts.
+ Thanks to Stuart Winter.
++--------------------------+
+Fri Jun 30 19:34:16 UTC 2023
+ Make /etc/mtab a symlink to /proc/mounts. (I thought we did this before?)
+ Remove /etc/mounts symlink.
+ In rc.S, don't try to initialize /etc/mtab or fake mount /.
++--------------------------+
+Tue Jun 13 20:02:38 UTC 2023
+ Added liburcu and liburcu-common libraries for xfsprogs.
++--------------------------+
+Thu May 25 00:15:21 UTC 2023
+ Mount efivarfs.
++--------------------------+
+Wed Apr 5 19:09:55 UTC 2023
+ build_installer.sh: Switch /sbin/depmod from BusyBox's implementation to
+ kmod's, as the busybox implementation doesn't work.
+ Get rid of broken /sbin/lspci symlink.
++--------------------------+
+Tue Mar 21 21:05:06 UTC 2023
+ setup: if UEFI is detected, mount efivarfs.
++--------------------------+
+Mon Mar 20 22:18:55 UTC 2023
+ Keep efivarfs kernel module. Thanks to AlleyTrotter.
++--------------------------+
+Wed Mar 1 21:15:12 UTC 2023
+ Add libreiserfscore.so.0.0.0.
++--------------------------+
+Tue Jan 24 20:26:12 UTC 2023
+ build_installer.sh: when compressing the completed installer with xz, use
+ option -vv instead of -v, since the change of default verbosity level seems
+ to have caused just a single -v to be ignored.
++--------------------------+
+Thu Jan 19 20:44:24 UTC 2023
+ build_installer.sh: Switch /bin/dd from BusyBox's implementation to
+ Coreutils', which offers a richer feature set. For example, the command line
+ parameter 'status=progress' provides realtime visibility of critical metrics
+ (transfer speed, ETA, % complete). This helps when working with the storage,
+ where the installer is used as an preparation and test environment.
+ Thanks to Stuart Winter.
+ Added "bricktick", an ncurses based game (why not, it's only 31K)
++--------------------------+
+Wed Jan 18 20:30:13 UTC 2023
+ /usr/lib/setup/INS-all-in-one: Added.
+ This detects the AiO (All in One Offline) partition labeled 'SLKins_aio-pkgs'
+ that houses the Slackware source media (installable packages), and configures
+ the Installer to use it as the media source.
+ /usr/lib/setup/SeTmedia: Call INS-all-in-one first to discover the A-i-O media
+ partition. If unavailable, fails sanity check or the user opted not to use
+ the included media, the regular set of source media selection options are
+ presented.
+ /usr/lib/setup/setup: Post install: If the A-i-O partition is mounted, umount
+ and suggest to physically unplug the Slackware Installer USB stick.
+ This is skipped on ARM since the A-i-O partition resides on the same storage
+ as the OS' /boot partition, so cannot/should not be removed.
+ Fixed white space in license header.
+ /usr/lib/setup/SeTpasswd: Clear screen before setting 'root' user password to
+ fix a text overlap from the 'dialog' box when installing over SSH.
+ Thanks to Stuart Winter.
++--------------------------+
+Tue Jan 17 20:55:17 UTC 2023
+ pxesetup: after sorting the partition list, run it through 'uniq' to ensure
+ no duplicates are listed. Thanks to 'opty' in Libera.Chat ##slackware.
++--------------------------+
+Mon Jan 9 09:37:40 UTC 2023
+ /sbin/probe: Removed old mmc discovery code.
+ Filter devices that contain reserved file system labels for Slackware
+ ARM/AArch64 and the A-i-O (All in One Offline) Installer.
+ This prevents the installation media and Slackware ARM system partitions from
+ appearing as candidates for formatting/mounting during setup.
+ Reserved labels:
+ SLKins = Media (usually a USB stick) containing the Slackware install media.
+ SLKboot = Slackware OS /boot partition; only reserved only on ARM/AArch64.
+ SLKhwm_bw = Hardware Model Bootware - native Bootware firmware/assets.
+ SLKins_aio-pkgs = A-i-O Installer's partition containing Slackware packages.
+ Thanks to Stuart Winter.
++--------------------------+
+Thu Oct 13 12:29:18 UTC 2022
+ Moved libpcre2 from /usr/lib(64) to /lib(64). Thanks to Stuart Winter.
++--------------------------+
+Mon Sep 26 14:43:44 UTC 2022
+ /sbin/probe: Fix duplicated enumeration of mmc storage devices (e.g. SD cards).
+ Thanks to gsl on LQ for the report.
++--------------------------+
+Mon Sep 12 18:09:41 UTC 2022
+ Removed pcre, added pcre2. Needed for GNU grep.
+ Thanks to EdGr.
++--------------------------+
+Tue Sep 6 18:34:42 UTC 2022
+ rc.pcmcia: change fgrep to grep -F.
+ /sbin/probe: change egrep to grep -E.
++--------------------------+
+Fri Aug 19 08:08:08 UTC 2022
+ /etc/rc.d/rc.S: Added support for setting the Installer's root password
+ from a Kernel cmdline key value pair, instrootpw=yourpassword
+ This is intended for network installations where otherwise the root password
+ would be unset.
+ Note: this does not configure the OS root password.
+ Passwords should be set as follows within the Kernel cmdline:
+ instrootpw=yourpassword
+ MoZes.
++--------------------------+
+Wed Jun 29 19:13:25 UTC 2022
+ Added smartctl, smartctl.8, and dmidecode.8.
++--------------------------+
+Tue Jun 14 08:08:08 UTC 2022
+ Added liblz4 for fsck.f2fs. Thanks to Brent Earl.
++--------------------------+
+Mon Feb 7 19:03:07 UTC 2022
+ Add a /usr/bin/dbclient symlink. Thanks to alienBOB.
++--------------------------+
+Sat Feb 5 23:02:19 UTC 2022
+ Build a simplified version of dnsmasq that doesn't require libraries not
+ found on the installer. Unfortunately this bug broke PXE installation.
+ If you require PXE support for your installs, use this installer instead.
+ It will work on Slackware 15.0 as well.
+ Not entirely sure if this merits respinning the ISOs for 15.0... feel free
+ to make a thread on LQ and weigh in with any comments.
++--------------------------+
+Sat Jan 22 21:34:07 UTC 2022
+ Reverted to an older simpler version of rescan-scsi-bus that does what we
+ need it to on the installer. Apparently the one we upgraded to requires the
+ real version of "find" and has additional requirements resulting in it being
+ broken for almost a year. Since nobody noticed until now, I wonder to what
+ extent this functionality is still important on modern hardware, but we'll
+ fix it anyway just in case. Thanks to almope.
+ Added sg.ko kernel module (rescan-scsi-bus has always wanted this but never
+ previously got it, so we'll add it and hope it helps).
++--------------------------+
Tue Jan 18 11:42:59 UTC 2022
/usr/lib/setup/setup: If a Slackware USB stick was used as the package
source, prompt user to unplug the USB stick when the installation
diff --git a/source/installer/build_installer.sh b/source/installer/build_installer.sh
index c46d0bb1d..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,6 +992,7 @@ a/util-linux \
a/xfsprogs \
a/xz \
a/zerofree \
+a/userspace-rcu \
ap/ddrescue \
ap/dmidecode \
ap/lsscsi \
@@ -924,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 \
@@ -970,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 \
@@ -995,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 \
@@ -1038,6 +1126,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
cgdisk \
cryptsetup \
debugfs \
+ depmod \
dmsetup \
dosfsck \
dumpe2fs \
@@ -1061,7 +1150,6 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
logsave \
ldconfig \
lsmod \
- lspci \
lvm \
lvmdump \
mount.nfs \
@@ -1071,6 +1159,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_SBIN} \
mkfs.* \
mklost+found \
mkswap \
+ modinfo \
modprobe \
mount \
mdadm \
@@ -1109,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."
@@ -1151,15 +1240,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 +1265,7 @@ cp --remove-destination -fa${VERBOSE1} ${EXTRA_PKGS_USRSBIN} \
dmidecode \
mount.cifs \
sm-notify \
+ smartctl \
sparsify \
umount.cifs \
zerofree \
@@ -1251,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* \
@@ -1266,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* \
@@ -1273,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* \
@@ -1332,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
@@ -1346,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
@@ -1533,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*,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/
@@ -1571,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
@@ -1982,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
@@ -2260,6 +2375,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
@@ -2323,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
diff --git a/source/installer/installer.SlackBuild b/source/installer/installer.SlackBuild
index 955dcdb02..64f0fb2ce 100755
--- a/source/installer/installer.SlackBuild
+++ b/source/installer/installer.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2018, 2022 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,13 +22,13 @@
cd $(dirname $0) ; CWD=$(pwd)
-INSTALLERVERSION=${INSTALLERVERSION:-"15.0"}
+INSTALLERVERSION=${INSTALLERVERSION:-"15.1"}
TMP=${TMP:-/tmp}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i586
+ i?86) ARCH=i686
SLACKROOT=${SLACKROOT:-/root/slackware-current}
OUTPUT=${OUTPUT:-$TMP/output-ia32-$(basename $(uname -r) -smp)}
;;
@@ -36,7 +36,7 @@ if [ -z "$ARCH" ]; then
SLACKROOT=${SLACKROOT:-/root/slackware64-current}
OUTPUT=${OUTPUT:-$TMP/output-x86_64-$(uname -r)}
;;
- arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl
+ arm*) readelf /usr/bin/file -A | grep -E -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl
SLACKROOT=${SLACKROOT:-/root/slackware-current}
OUTPUT=${OUTPUT:-$TMP/output-arm-$(uname -r)}
;;
diff --git a/source/installer/repack_installer.SlackBuild b/source/installer/repack_installer.SlackBuild
index b8b2af91f..e14b2993f 100755
--- a/source/installer/repack_installer.SlackBuild
+++ b/source/installer/repack_installer.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2019 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2019, 2023 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -33,15 +33,15 @@ TMP=${TMP:-/tmp}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
- i?86) ARCH=i586
+ i?86) ARCH=i686
SLACKROOT=${SLACKROOT:-/root/slackware-current}
- OUTPUT=${OUTPUT:-$TMP/output-ia32-$(basename $(uname -r) -smp)}
+ OUTPUT=${OUTPUT:-$TMP/output-ia32-$(basename $(uname -r))}
;;
x86_64) ARCH=x86_64
SLACKROOT=${SLACKROOT:-/root/slackware64-current}
OUTPUT=${OUTPUT:-$TMP/output-x86_64-$(uname -r)}
;;
- arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl
+ arm*) readelf /usr/bin/file -A | grep -E -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl
SLACKROOT=${SLACKROOT:-/root/slackware-current}
OUTPUT=${OUTPUT:-$TMP/output-arm-$(uname -r)}
;;
diff --git a/source/installer/sources/bricktick/fetch-bricktick.sh b/source/installer/sources/bricktick/fetch-bricktick.sh
new file mode 100755
index 000000000..15a8e2b14
--- /dev/null
+++ b/source/installer/sources/bricktick/fetch-bricktick.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Copyright 2019, 2020 Patrick J. Volkerding, Sebeka, Minnesota, 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.
+
+
+PKGNAM=bricktick
+
+# Pull a stable branch + patches
+BRANCH=${1:-master}
+
+# Clear download area:
+rm -rf ${PKGNAM}
+
+# Clone repository:
+git clone https://github.com/Subsentient/${PKGNAM}
+
+# checkout $BRANCH:
+( cd ${PKGNAM}
+ git checkout $BRANCH || exit 1
+)
+
+HEADISAT="$( cd ${PKGNAM} && git log -1 --format=%h )"
+DATE="$( cd ${PKGNAM} && git log -1 --format=%cd --date=format:%Y%m%d )"
+LONGDATE="$( cd ${PKGNAM} && git log -1 --format=%cd --date=format:%c )"
+# Cleanup. We're not packing up the whole git repo.
+( cd ${PKGNAM} && find . -type d -name ".git*" -exec rm -rf {} \; 2> /dev/null )
+mv ${PKGNAM} ${PKGNAM}-${DATE}_${HEADISAT}
+tar cf ${PKGNAM}-${DATE}_${HEADISAT}.tar ${PKGNAM}-${DATE}_${HEADISAT}
+plzip -9 -f ${PKGNAM}-${DATE}_${HEADISAT}.tar
+rm -rf ${PKGNAM}-${DATE}_${HEADISAT}
+touch -d "$LONGDATE" ${PKGNAM}-${DATE}_${HEADISAT}.tar.lz
+echo
+echo "${PKGNAM} branch $BRANCH with HEAD at $HEADISAT packaged as ${PKGNAM}-${DATE}_${HEADISAT}.tar.lz"
+echo
diff --git a/source/installer/sources/dnsmasq/dnsmasq-2.80-SIOCGSTAMP.patch b/source/installer/sources/dnsmasq/dnsmasq-2.80-SIOCGSTAMP.patch
new file mode 100644
index 000000000..3a32bb82e
--- /dev/null
+++ b/source/installer/sources/dnsmasq/dnsmasq-2.80-SIOCGSTAMP.patch
@@ -0,0 +1,60 @@
+From 31e14f6e52677c675ee4683f9daab5bf21c07dd6 Mon Sep 17 00:00:00 2001
+From: Petr Mensik <pemensik@redhat.com>
+Date: Wed, 31 Jul 2019 20:35:35 +0200
+Subject: [PATCH] Recent kernel no longer supports SIOCGSTAMP
+
+Build without it defined by kernel headers. Do not try SO_TIMESTAMP
+until fixed properly.
+---
+ src/dhcp.c | 32 ++++++++++++++++++--------------
+ 1 file changed, 18 insertions(+), 14 deletions(-)
+
+diff --git a/src/dhcp.c b/src/dhcp.c
+index f8d323b..9afdccf 100644
+--- a/src/dhcp.c
++++ b/src/dhcp.c
+@@ -178,23 +178,27 @@ void dhcp_packet(time_t now, int pxe_fd)
+ (sz < (ssize_t)(sizeof(*mess) - sizeof(mess->options))))
+ return;
+
+- #if defined (HAVE_LINUX_NETWORK)
+- if (ioctl(fd, SIOCGSTAMP, &tv) == 0)
++#if defined (HAVE_LINUX_NETWORK)
++#ifdef SIOCGSTAMP
++ if (tv.tv_sec == 0 && ioctl(fd, SIOCGSTAMP, &tv) == 0)
+ recvtime = tv.tv_sec;
++#endif
+
+ if (msg.msg_controllen >= sizeof(struct cmsghdr))
+- for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
+- if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_PKTINFO)
+- {
+- union {
+- unsigned char *c;
+- struct in_pktinfo *p;
+- } p;
+- p.c = CMSG_DATA(cmptr);
+- iface_index = p.p->ipi_ifindex;
+- if (p.p->ipi_addr.s_addr != INADDR_BROADCAST)
+- unicast_dest = 1;
+- }
++ {
++ for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
++ if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_PKTINFO)
++ {
++ union {
++ unsigned char *c;
++ struct in_pktinfo *p;
++ } p;
++ p.c = CMSG_DATA(cmptr);
++ iface_index = p.p->ipi_ifindex;
++ if (p.p->ipi_addr.s_addr != INADDR_BROADCAST)
++ unicast_dest = 1;
++ }
++ }
+
+ #elif defined(HAVE_BSD_NETWORK)
+ if (msg.msg_controllen >= sizeof(struct cmsghdr))
+--
+2.20.1
+
diff --git a/source/installer/sources/dnsmasq/dnsmasq.leasedir.diff b/source/installer/sources/dnsmasq/dnsmasq.leasedir.diff
new file mode 100644
index 000000000..9fec6b439
--- /dev/null
+++ b/source/installer/sources/dnsmasq/dnsmasq.leasedir.diff
@@ -0,0 +1,24 @@
+diff -Nur dnsmasq-2.52.orig/dnsmasq.conf.example dnsmasq-2.52/dnsmasq.conf.example
+--- dnsmasq-2.52.orig/dnsmasq.conf.example 2009-11-25 06:55:16.000000000 -0600
++++ dnsmasq-2.52/dnsmasq.conf.example 2010-01-22 15:32:41.137807274 -0600
+@@ -415,7 +415,7 @@
+ # The DHCP server needs somewhere on disk to keep its lease database.
+ # This defaults to a sane location, but if you want to change it, use
+ # the line below.
+-#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
++#dhcp-leasefile=/var/state/dnsmasq/dnsmasq.leases
+
+ # Set the DHCP server to authoritative mode. In this mode it will barge in
+ # and take over the lease for any client which broadcasts on the network,
+diff -Nur dnsmasq-2.52.orig/src/config.h dnsmasq-2.52/src/config.h
+--- dnsmasq-2.52.orig/src/config.h 2010-01-21 08:22:06.000000000 -0600
++++ dnsmasq-2.52/src/config.h 2010-01-22 15:32:41.136833058 -0600
+@@ -47,7 +47,7 @@
+ # elif defined(__sun__) || defined (__sun)
+ # define LEASEFILE "/var/cache/dnsmasq.leases"
+ # else
+-# define LEASEFILE "/var/lib/misc/dnsmasq.leases"
++# define LEASEFILE "/var/state/dnsmasq/dnsmasq.leases"
+ # endif
+ #endif
+
diff --git a/source/installer/sources/dnsmasq/dnsmasq.libidn2.diff b/source/installer/sources/dnsmasq/dnsmasq.libidn2.diff
new file mode 100644
index 000000000..d99e556bc
--- /dev/null
+++ b/source/installer/sources/dnsmasq/dnsmasq.libidn2.diff
@@ -0,0 +1,13 @@
+--- ./Makefile.orig 2017-05-22 16:58:46.000000000 -0500
++++ ./Makefile 2017-07-07 13:28:14.124402827 -0500
+@@ -24,8 +24,8 @@
+ LOCALEDIR = $(PREFIX)/share/locale
+ BUILDDIR = $(SRC)
+ DESTDIR =
+-CFLAGS = -Wall -W -O2
+-LDFLAGS =
++CFLAGS = -Wall -W -O2 -DHAVE_LIBIDN2
++LDFLAGS = -lidn2
+ COPTS =
+ RPM_OPT_FLAGS =
+ LIBS =
diff --git a/source/installer/sources/initrd/etc/keymaps.tar b/source/installer/sources/initrd/etc/keymaps.tar
deleted file mode 100644
index 2ae6004b7..000000000
--- a/source/installer/sources/initrd/etc/keymaps.tar
+++ /dev/null
Binary files differ
diff --git a/source/installer/sources/initrd/etc/mounts b/source/installer/sources/initrd/etc/mtab
index 4c0a0948b..4c0a0948b 120000
--- a/source/installer/sources/initrd/etc/mounts
+++ b/source/installer/sources/initrd/etc/mtab
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.S b/source/installer/sources/initrd/etc/rc.d/rc.S
index fcd5fea2c..0e69d7349 100755
--- a/source/installer/sources/initrd/etc/rc.d/rc.S
+++ b/source/installer/sources/initrd/etc/rc.d/rc.S
@@ -1,18 +1,29 @@
#!/bin/sh
# rc.S: Basic system initialization.
-# Any /etc/mtab that exists here is old, so we start with a new one:
-/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab
-
-# Add (fake) entry for / to /etc/mtab:
-/sbin/mount -f -w /dev/initramfs / -t tmpfs 1> /dev/null
-
# Mount /proc:
/sbin/mount -v proc /proc -t proc 1> /dev/null
# Mount sysfs next:
/sbin/mount -v sysfs /sys -t sysfs 1> /dev/null
+# The efivarfs filesystem is used for reading and writing EFI variables, such
+# as the boot menu entries. By default efivarfs will be mounted read-write on
+# the /sys/firmware/efi/efivars directory.
+if [ -d /sys/firmware/efi/efivars ]; then
+ mount -o rw -t efivarfs none /sys/firmware/efi/efivars
+fi
+
+# Set a root password for the Slackware Installer if set as a Kernel cmdline:
+# This is intended for network installations where otherwise the root password
+# would be unset.
+# Note: this does not configure the OS root password.
+# Passwords should be set as follows within the Kernel cmdline:
+# instrootpw=yourpassword
+if grep -qoP 'instrootpw=\K\S+' /proc/cmdline ; then
+ /bin/echo "root:$( grep -oP 'instrootpw=\K\S+' /proc/cmdline )" | /bin/busybox chpasswd
+fi
+
# Activate swap:
/sbin/swapon -a 1> /dev/null
@@ -171,8 +182,14 @@ rm -f /tmp/foo
echo "Activating LVM volumes:"
vgchange -ay
-if [ -x /etc/rc.d/rc.font ]; then
- /bin/sh /etc/rc.d/rc.font
+# In testing here the results of running rc.font with HiDPI screens has been
+# rather unpredicable, sometimes resulting in an unreadably small font rather
+# than increasing the size. Let's skip it unless RCFONT is passed as a kernel
+# command-line flag:
+if cat /proc/cmdline | grep -wq RCFONT ; then
+ if [ -x /etc/rc.d/rc.font ]; then
+ /bin/sh /etc/rc.d/rc.font
+ fi
fi
# Don't automatically blank the screen, or it will go black during the install
@@ -233,11 +250,23 @@ if ! cat /proc/cmdline | grep -q 'kbd=' 2> /dev/null ; then
else
for ARG in `cat /proc/cmdline` ; do
if [ "`echo $ARG | cut -f1 -d=`" = "kbd" ]; then
- BMAP="`echo $ARG | cut -f2 -d=`.bmap"
+ # A keymap was specified on the kernel command line such as: kbd=azerty
+ MAPSELECT="$(echo $ARG | cut -f2 -d=)"
+ # If it ends in .gz, strip that off:
+ if [ "$(echo $MAPSELECT | rev | cut -f 1 -d . | rev)" = "gz" ]; then
+ MAPSELECT=$(basename $MAPSELECT .gz)
+ fi
+ # If it doesn't end in .map, add that:
+ if [ ! "$(echo $MAPSELECT | rev | cut -f 1 -d . | rev)" = "map" ]; then
+ MAPSELECT=${MAPSELECT}.map
+ fi
+ # Load the keymap:
+ loadkeys -q $MAPSELECT
+ # Let the setup script know about this:
+ echo $MAPSELECT > /tmp/Pkeymap
+ unset MAPSELECT
fi
done
- tar xzOf /etc/keymaps.tar.gz $BMAP | loadkmap
- unset BMAP
fi
clear
diff --git a/source/installer/sources/initrd/etc/rc.d/rc.pcmcia b/source/installer/sources/initrd/etc/rc.d/rc.pcmcia
index 1f21be84e..46621da97 100755
--- a/source/installer/sources/initrd/etc/rc.d/rc.pcmcia
+++ b/source/installer/sources/initrd/etc/rc.d/rc.pcmcia
@@ -14,7 +14,7 @@ DRIVER_OPTS=
case "$1" in
start)
echo "Starting PCMCIA services:"
- fgrep -q pcmcia /proc/devices
+ grep -F -q pcmcia /proc/devices
if [ $? -ne 0 ] ; then
if [ "$DRIVER" = "probe" ]; then
echo " <Probing for PCIC: edit /etc/rc.d/rc.pcmcia>"
diff --git a/source/installer/sources/initrd/sbin/mkbindmounts b/source/installer/sources/initrd/sbin/mkbindmounts
index 40a9d7313..897889847 100755
--- a/source/installer/sources/initrd/sbin/mkbindmounts
+++ b/source/installer/sources/initrd/sbin/mkbindmounts
@@ -5,6 +5,10 @@
# reinstall boot loaders).
mkdir -p /mnt/{dev,proc,sys}
-mount -o bind /dev /mnt/dev
-mount -o bind /proc /mnt/proc
-mount -o bind /sys /mnt/sys
+mount -o rbind /dev /mnt/dev
+mount -o rbind /proc /mnt/proc
+mount -o rbind /sys /mnt/sys
+# Needed for EFI boot menu operations:
+if [ -d /sys/firmware/efi/efivars ]; then
+ mount -o rbind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
+fi
diff --git a/source/installer/sources/initrd/sbin/probe b/source/installer/sources/initrd/sbin/probe
index 3b481432f..a0c25ac10 100755
--- a/source/installer/sources/initrd/sbin/probe
+++ b/source/installer/sources/initrd/sbin/probe
@@ -140,24 +140,14 @@ list_amiraid() {
fi
}
-#list_mmc() {
-# # find drive
-# DRV=`expr $2 / 8`
-# NUM=`expr $2 % 8`
-# if [ "$NUM" = "0" ]; then
-# fdisk -l /dev/mmcblk$DRV >> $TMP/SeTfdisk
-# #output_gpt_partitions /dev/mmcblk$DRV >> $TMP/SeTfdisk
-# else
-# return
-# fi
-#}
list_mmc() {
local device
# Filter out any partitions on the block device, as we'll use
# fdisk to capture those:
- lsblk -o name,type -ripnd /dev/mmcblk* | egrep 'disk$' | awk '{print $1}' | while read device ; do
- fdisk -l $device >> $TMP/SeTfdisk
- done
+ grep -qE 'mmcblk[0-9]' /proc/partitions && {
+ lsblk -o name,type -Mripnd /dev/mmcblk* | grep -E 'disk$' | awk '{print $1}' | while read device ; do
+ fdisk -l $device >> $TMP/SeTfdisk
+ done ;}
}
list_nvme() {
@@ -324,6 +314,9 @@ list_lvm
# List CRYPT volumes:
list_crypt
+# List MMC (e.g. SD cards) partitions:
+list_mmc
+
## This is obsolete, since fdisk handles GPT now.
## List GPT partitions:
#cat /proc/partitions | while read line ; do
@@ -412,8 +405,6 @@ if cat /proc/partitions | grep -E '/|[0-9]' 1>/dev/null 2>/dev/null ; then # new
list_cciss $(( $MAJOR - 104 )) $MINOR
elif [ "$MAJOR" = "114" ]; then
list_ataraid $MAJOR $MINOR
- elif [ "$MAJOR" = "179" ]; then
- list_mmc $MAJOR $MINOR
elif [ "$MAJOR" = "259" ]; then
if echo $line | grep -q p; then
list_nvme $DEVNAME
@@ -443,4 +434,54 @@ sed -i -e "s/Linux filesystem/Linux/g" $TMP/SeTfdisk
sed -i -e "s/EFI System/EFI System Partition/g" $TMP/SeTfdisk
sed -i -e "s,EFI (FAT-12/16/32),EFI System Partition,g" $TMP/SeTfdisk
+# Filter out reserved file system labels for Slackware ARM/AArch64 and the
+# Slackware A-i-O (All in One Offline) Installer file systems.
+# This prevents them from being offered as candidates for formatting/mounting
+# during the installation.
+#
+# Labels:
+#
+# Used within the OS:
+# -------------------
+# SLKhwm_bw = Hardware Model Bootware - native Bootware for the RPi
+# SLKefi = FAT32 file system, /boot/efi mountpoint within the OS for Hardware Models
+# that use UEFI firmware.
+#
+# SLKins = Media (usually a USB stick) containing the Slackware install media
+# This FS label isn't required to locate the media, but it's helpful
+# as a way to exclude the media from the list of candidates.
+# This label is included within the Installation Guide for the USB
+# media installation option.
+#
+# Used only within the Slackware Installer environment
+# ----------------------------------------------------
+# SLKins_aio-pkgs =
+# The label of the partition on the All-In-One Installer that contains the
+# Slackware packages.
+# SLKins_efi = FAT32 file system for the Installer EFI partition, for Hardware Models
+# that use UEFI firmware.
+# The contents of this are deployed by 'grub-install', which is called from
+# the Hardware Model's 'sdcards.build' plugin.
+# This is not used within the installed OS.
+# SLKins_boot = ext4 file system containing the GRUB configuration to boot the
+# Slackware Installer, for Hardware Models using UEFI firmware.
+#
+# 'SLKroot' is used to identify the OS root file system on ARM, but we don't
+# filter it out because it's *supposed* to appear as a candidate within the
+# menu. Whilst we don't ship any images that contain a file system with this label,
+# the user might be reinstalling, thus would never be presented with the partition.
+#
+# SLKboot = Slackware OS /boot partition, but is only reserved only on ARM/AArch64:
+[[ "$( uname -m )" =~ a(rm*|arch64) ]] && aexc="boot|"
+
+awk '/^\/dev\// {print $1}' /var/log/setup/tmp/SeTfdisk | while read device; do
+ # The wrapping of e2label is because whilst it handles other file system types,
+ # it includes verbosity about the filesystem type; where as for ext filesystems
+ # it outputs only the label.
+ { ( e2label ${device} 2>/dev/null | tail -n1 | rev \
+ | awk '{print $1}' | rev | tr -d "'" | \
+ grep -Eq "^SLK(${aexc}ins|ins_aio-pkgs|ins_efi|ins_boot|efi|hwm_bw)$" ) && sed -i '\|^'"${device}\s"'|d' $TMP/SeTfdisk ;}
+done
+
+# Dump the discovered storage:
cat $TMP/SeTfdisk
diff --git a/source/installer/sources/initrd/sbin/rescan-scsi-bus b/source/installer/sources/initrd/sbin/rescan-scsi-bus
index 077cadba1..4be8f01e1 100755
--- a/source/installer/sources/initrd/sbin/rescan-scsi-bus
+++ b/source/installer/sources/initrd/sbin/rescan-scsi-bus
@@ -1,10 +1,10 @@
#!/bin/bash
-# Script to rescan SCSI bus, using the scsi add-single-device mechanism.
+# Skript to rescan SCSI bus, using the
+# scsi add-single-device mechanism
# (c) 1998--2010 Kurt Garloff <kurt@garloff.de>, GNU GPL v2 or v3
-# (c) 2006--2018 Hannes Reinecke, GNU GPL v2 or later
-# $Id: rescan-scsi-bus.sh,v 1.57 2012/03/31 14:08:48 garloff Exp $
+# (c) 2006--2008 Hannes Reinecke, GNU GPL v2 or later
+# $Id: rescan-scsi-bus.sh,v 1.56 2012/01/14 22:23:53 garloff Exp $
-VERSION="20180615"
SCAN_WILD_CARD=4294967295
setcolor ()
@@ -16,19 +16,12 @@ setcolor ()
norm="\e[0;0m"
}
-unsetcolor ()
+unsetcolor ()
{
red=""; green=""
yellow=""; norm=""
}
-echo_debug()
-{
- if [ "$debug" -eq 1 ] ; then
- echo "$1"
- fi
-}
-
# Output some text and return cursor to previous position
# (only works for simple strings)
# Stores length of string in LN and returns it
@@ -38,43 +31,44 @@ print_and_scroll_back ()
LN=${#STRG}
BK=""
declare -i cntr=0
- while [ $cntr -lt "$LN" ] ; do BK="$BK\e[D"; let cntr+=1; done
+ while test $cntr -lt $LN; do BK="$BK\e[D"; let cntr+=1; done
echo -en "$STRG$BK"
- return "$LN"
+ return $LN
}
-# Overwrite a text of length $LN with whitespace
+# Overwrite a text of length $1 (fallback to $LN) with whitespace
white_out ()
{
BK=""; WH=""
+ if test -n "$1"; then LN=$1; fi
declare -i cntr=0
- while [ $cntr -lt "$LN" ] ; do BK="$BK\e[D"; WH="$WH "; let cntr+=1; done
+ while test $cntr -lt $LN; do BK="$BK\e[D"; WH="$WH "; let cntr+=1; done
echo -en "$WH$BK"
}
# Return hosts. sysfs must be mounted
findhosts_26 ()
{
- hosts=
- for hostdir in /sys/class/scsi_host/host* ; do
- [ -e "$hostdir" ] || continue
+ hosts=`find /sys/class/scsi_host/host* -maxdepth 4 -type d -o -type l 2> /dev/null | awk -F'/' '{print $5}' | sed -e 's~host~~' | sort -nu`
+ scsi_host_data=`echo "$hosts" | sed -e 's~^~/sys/class/scsi_host/host~'`
+ for hostdir in $scsi_host_data; do
hostno=${hostdir#/sys/class/scsi_host/host}
- if [ -f "$hostdir/isp_name" ] ; then
+ if [ -f $hostdir/isp_name ] ; then
hostname="qla2xxx"
- elif [ -f "$hostdir/lpfc_drvr_version" ] ; then
+ elif [ -f $hostdir/lpfc_drvr_version ] ; then
hostname="lpfc"
else
- hostname=$(cat "$hostdir/proc_name")
+ hostname=`cat $hostdir/proc_name`
fi
- hosts="$hosts $hostno"
- echo_debug "Host adapter $hostno ($hostname) found."
- done
+ #hosts="$hosts $hostno"
+ echo "Host adapter $hostno ($hostname) found."
+ done
if [ -z "$hosts" ] ; then
echo "No SCSI host adapters found in sysfs"
exit 1;
fi
# Not necessary just use double quotes around variable to preserve new lines
- #hosts=$(echo $hosts | tr ' ' '\n')
+ #hosts=`echo $hosts | tr ' ' '\n'`
}
# Return hosts. /proc/scsi/HOSTADAPTER/? must exist
@@ -83,15 +77,15 @@ findhosts ()
hosts=
for driverdir in /proc/scsi/*; do
driver=${driverdir#/proc/scsi/}
- if [ "$driver" = scsi ] || [ "$driver" = sg ] || [ "$driver" = dummy ] || [ "$driver" = device_info ] ; then continue; fi
+ if test $driver = scsi -o $driver = sg -o $driver = dummy -o $driver = device_info; then continue; fi
for hostdir in $driverdir/*; do
name=${hostdir#/proc/scsi/*/}
- if [ "$name" = add_map ] || [ "$name" = map ] || [ "$name" = mod_parm ] ; then continue; fi
+ if test $name = add_map -o $name = map -o $name = mod_parm; then continue; fi
num=$name
driverinfo=$driver
- if [ -r "$hostdir/status" ] ; then
- num=$(printf '%d\n' "$(sed -n 's/SCSI host number://p' "$hostdir/status")")
- driverinfo="$driver:$name"
+ if test -r $hostdir/status; then
+ num=$(printf '%d\n' `sed -n 's/SCSI host number://p' $hostdir/status`)
+ driverinfo="$driver:$name"
fi
hosts="$hosts $num"
echo "Host adapter $num ($driverinfo) found."
@@ -104,28 +98,28 @@ printtype ()
local type=$1
case "$type" in
- 0) echo "Direct-Access" ;;
+ 0) echo "Direct-Access " ;;
1) echo "Sequential-Access" ;;
- 2) echo "Printer" ;;
- 3) echo "Processor" ;;
- 4) echo "WORM" ;;
- 5) echo "CD-ROM" ;;
- 6) echo "Scanner" ;;
- 7) echo "Optical-Device" ;;
- 8) echo "Medium-Changer" ;;
- 9) echo "Communications" ;;
- 10) echo "Unknown" ;;
- 11) echo "Unknown" ;;
- 12) echo "RAID" ;;
- 13) echo "Enclosure" ;;
+ 2) echo "Printer " ;;
+ 3) echo "Processor " ;;
+ 4) echo "WORM " ;;
+ 5) echo "CD-ROM " ;;
+ 6) echo "Scanner " ;;
+ 7) echo "Optical Device " ;;
+ 8) echo "Medium Changer " ;;
+ 9) echo "Communications " ;;
+ 10) echo "Unknown " ;;
+ 11) echo "Unknown " ;;
+ 12) echo "RAID " ;;
+ 13) echo "Enclosure " ;;
14) echo "Direct-Access-RBC" ;;
- *) echo "Unknown" ;;
+ *) echo "Unknown " ;;
esac
}
print02i()
{
- if [ "$1" = "*" ] ; then
+ if [ "$1" = "*" ] ; then
echo "00"
else
printf "%02i" "$1"
@@ -133,36 +127,32 @@ print02i()
}
# Get /proc/scsi/scsi info for device $host:$channel:$id:$lun
-# Optional parameter: Number of lines after first (default = 2),
+# Optional parameter: Number of lines after first (default = 2),
# result in SCSISTR, return code 1 means empty.
procscsiscsi ()
-{
- if [ -z "$1" ] ; then
- LN=2
- else
- LN=$1
- fi
- CHANNEL=$(print02i "$channel")
- ID=$(print02i "$id")
- LUN=$(print02i "$lun")
+{
+ if test -z "$1"; then LN=2; else LN=$1; fi
+ CHANNEL=`print02i "$channel"`
+ ID=`print02i "$id"`
+ LUN=`print02i "$lun"`
if [ -d /sys/class/scsi_device ]; then
SCSIPATH="/sys/class/scsi_device/${host}:${channel}:${id}:${lun}"
if [ -d "$SCSIPATH" ] ; then
SCSISTR="Host: scsi${host} Channel: $CHANNEL Id: $ID Lun: $LUN"
if [ "$LN" -gt 0 ] ; then
- IVEND=$(cat "${SCSIPATH}/device/vendor")
- IPROD=$(cat "${SCSIPATH}/device/model")
- IPREV=$(cat "${SCSIPATH}/device/rev")
- SCSIDEV=$(printf ' Vendor: %-08s Model: %-16s Rev: %-4s' "$IVEND" "$IPROD" "$IPREV")
- SCSISTR="$SCSISTR
+ IVEND=$(cat ${SCSIPATH}/device/vendor)
+ IPROD=$(cat ${SCSIPATH}/device/model)
+ IPREV=$(cat ${SCSIPATH}/device/rev)
+ SCSIDEV=$(printf ' Vendor: %-08s Model: %-16s Rev: %-4s' "$IVEND" "$IPROD" "$IPREV")
+ SCSISTR="$SCSISTR
$SCSIDEV"
fi
if [ "$LN" -gt 1 ] ; then
- ILVL=$(cat "${SCSIPATH}/device/scsi_level")
- type=$(cat "${SCSIPATH}/device/type")
- ITYPE=$(printtype "$type")
- SCSITMP=$(printf ' Type: %-17s ANSI SCSI revision: %02d' "$ITYPE" "$((ILVL - 1))")
- SCSISTR="$SCSISTR
+ ILVL=$(cat ${SCSIPATH}/device/scsi_level)
+ type=$(cat ${SCSIPATH}/device/type)
+ ITYPE=$(printtype $type)
+ SCSITMP=$(printf ' Type: %-16s ANSI SCSI revision: %02d' "$ITYPE" "$((ILVL - 1))")
+ SCSISTR="$SCSISTR
$SCSITMP"
fi
else
@@ -170,39 +160,33 @@ $SCSITMP"
fi
else
grepstr="scsi$host Channel: $CHANNEL Id: $ID Lun: $LUN"
- SCSISTR=$(grep -A "$LN" -e "$grepstr" /proc/scsi/scsi)
- fi
- if [ -z "$SCSISTR" ] ; then
- return 1
- else
- return 0
+ SCSISTR=`cat /proc/scsi/scsi | grep -A$LN -e"$grepstr"`
fi
+ if test -z "$SCSISTR"; then return 1; else return 0; fi
}
# Find sg device with 2.6 sysfs support
sgdevice26 ()
{
- local gendev
-
- gendev=/sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/generic
- if [ -e "$gendev" ] ; then
- SGDEV=$(basename "$(readlink "$gendev")")
+ if test -e /sys/class/scsi_device/$host\:$channel\:$id\:$lun/device/generic; then
+ SGDEV=`readlink /sys/class/scsi_device/$host\:$channel\:$id\:$lun/device/generic`
+ SGDEV=`basename $SGDEV`
else
for SGDEV in /sys/class/scsi_generic/sg*; do
- DEV=$(readlink "$SGDEV/device")
- if [ "${DEV##*/}" = "$host:$channel:$id:$lun" ] ; then
- SGDEV=$(basename "$SGDEV"); return
+ DEV=`readlink $SGDEV/device`
+ if test "${DEV##*/}" = "$host:$channel:$id:$lun"; then
+ SGDEV=`basename $SGDEV`; return
fi
done
SGDEV=""
- fi
+ fi
}
# Find sg device with 2.4 report-devs extensions
sgdevice24 ()
{
if procscsiscsi 3; then
- SGDEV=$(echo "$SCSISTR" | grep 'Attached drivers:' | sed 's/^ *Attached drivers: \(sg[0-9]*\).*/\1/')
+ SGDEV=`echo "$SCSISTR" | grep 'Attached drivers:' | sed 's/^ *Attached drivers: \(sg[0-9]*\).*/\1/'`
fi
}
@@ -211,17 +195,17 @@ sgdevice24 ()
sgdevice ()
{
SGDEV=
- if [ -d /sys/class/scsi_device ] ; then
+ if test -d /sys/class/scsi_device; then
sgdevice26
- else
- DRV=$(grep 'Attached drivers:' /proc/scsi/scsi 2>/dev/null)
+ else
+ DRV=`grep 'Attached drivers:' /proc/scsi/scsi 2>/dev/null`
repdevstat=$((1-$?))
if [ $repdevstat = 0 ]; then
echo "scsi report-devs 1" >/proc/scsi/scsi
- DRV=$(grep 'Attached drivers:' /proc/scsi/scsi 2>/dev/null)
- [ $? -eq 1 ] && return
+ DRV=`grep 'Attached drivers:' /proc/scsi/scsi 2>/dev/null`
+ if [ $? = 1 ]; then return; fi
fi
- if ! echo "$DRV" | grep -q 'drivers: sg'; then
+ if ! `echo $DRV | grep 'drivers: sg' >/dev/null`; then
modprobe sg
fi
sgdevice24
@@ -231,129 +215,70 @@ sgdevice ()
fi
}
-# Whether or not the RMB (removable) bit has been set in the INQUIRY response.
-# Uses ${host}, ${channel}, ${id} and ${lun}. Assumes that sg_device() has
-# already been called. How to test this function: copy/paste this function
-# in a shell and run
-# (cd /sys/class/scsi_device && for d in *; do set ${d//:/ }; echo -n "$d $(</sys/class/scsi_device/${d}/device/block/*/removable) <> "; SGDEV=bsg/$d host=$1 channel=$2 id=$3 lun=$4 is_removable; done)
-is_removable ()
-{
- local b p
-
- p=/sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/inquiry
- # Extract the second byte of the INQUIRY response and check bit 7 (mask 0x80).
- b=$(hexdump -n1 -e '/1 "%02X"' "$p" 2>/dev/null)
- if [ -n "$b" ]; then
- echo $(((0x$b & 0x80) != 0))
- else
- sg_inq /dev/$SGDEV 2>/dev/null | sed -n 's/^.*RMB=\([0-9]*\).*$/\1/p'
- fi
-}
-
# Test if SCSI device is still responding to commands
-# Return values:
-# 0 device is present
-# 1 device has changed
-# 2 device has been removed
testonline ()
{
- local ctr RC RMB
-
: testonline
- ctr=0
RC=0
- # Set default values
- IPTYPE=31
- IPQUAL=3
- [ ! -x /usr/bin/sg_turs ] && return 0
+ if test ! -x /usr/bin/sg_turs; then return 0; fi
sgdevice
- [ -z "$SGDEV" ] && return 0
+ if test -z "$SGDEV"; then return 0; fi
sg_turs /dev/$SGDEV >/dev/null 2>&1
RC=$?
-
- # Handle in progress of becoming ready and unit attention
- while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
- if [ $RC = 2 ] && [ "$RMB" != "1" ] ; then
- echo -n "."
- let LN+=1
- sleep 1
- else
- sleep 0.02
- fi
+ # Handle in progress of becoming ready and unit attention -- wait at max 11s
+ declare -i ctr=0
+ if test $RC = 2 -o $RC = 6; then
+ RMB=`sg_inq /dev/$SGDEV | grep 'RMB=' | sed 's/^.*RMB=\(.\).*$/\1/'`
+ print_and_scroll_back "$host:$channel:$id:$lun $SGDEV ($RMB) "
+ fi
+ while test $RC = 2 -o $RC = 6 && test $ctr -le 8; do
+ if test $RC = 2 -a "$RMB" != "1"; then echo -n "."; let $LN+=1; sleep 1
+ else usleep 20000; fi
let ctr+=1
sg_turs /dev/$SGDEV >/dev/null 2>&1
RC=$?
- # Check for removable device; TEST UNIT READY obviously will
- # fail for a removable device with no medium
- RMB=$(is_removable)
- print_and_scroll_back "$host:$channel:$id:$lun $SGDEV ($RMB) "
- [ $RC = 2 ] && [ "$RMB" = "1" ] && break
done
- if [ $ctr != 0 ] ; then
- white_out
- fi
+ if test $ctr != 0; then white_out; fi
# echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n"
- [ $RC = 1 ] && return $RC
+ if test $RC = 1; then return $RC; fi
# Reset RC (might be !=0 for passive paths)
RC=0
# OK, device online, compare INQUIRY string
- INQ=$(sg_inq "$sg_len_arg" /dev/$SGDEV 2>/dev/null)
- if [ -z "$INQ" ] ; then
- echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}INQUIRY failed${norm} \n\n\n"
- return 2
- fi
- IVEND=$(echo "$INQ" | grep 'Vendor identification:' | sed 's/^[^:]*: \(.*\)$/\1/')
- IPROD=$(echo "$INQ" | grep 'Product identification:' | sed 's/^[^:]*: \(.*\)$/\1/')
- IPREV=$(echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/')
- STR=$(printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV")
- IPTYPE=$(echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p')
- IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p')
+ INQ=`sg_inq $sg_len_arg /dev/$SGDEV 2>/dev/null`
+ IVEND=`echo "$INQ" | grep 'Vendor identification:' | sed 's/^[^:]*: \(.*\)$/\1/'`
+ IPROD=`echo "$INQ" | grep 'Product identification:' | sed 's/^[^:]*: \(.*\)$/\1/'`
+ IPREV=`echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/'`
+ STR=`printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV"`
+ IPTYPE=`echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p'`
+ IPQUAL=`echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p'`
if [ "$IPQUAL" != 0 ] ; then
- [ -z "$IPQUAL" ] && IPQUAL=3
- [ -z "$IPTYPE" ] && IPTYPE=31
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}LU not available (PQual $IPQUAL)${norm} \n\n\n"
return 2
fi
TYPE=$(printtype $IPTYPE)
- if ! procscsiscsi ; then
- echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV removed.\n\n\n"
- return 2
- fi
- TMPSTR=$(echo "$SCSISTR" | grep 'Vendor:')
- if [ "$ignore_rev" -eq 0 ] ; then
- if [ "$TMPSTR" != "$STR" ]; then
- echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm} \n\n\n"
- return 1
- fi
- else
- # Ignore disk revision change
- local old_str_no_rev=
- local new_str_no_rev=
-
- old_str_no_rev=${TMPSTR%Rev:*}
- new_str_no_rev=${STR%Rev:*}
- if [ "$old_str_no_rev" != "$new_str_no_rev" ]; then
- echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm} \n\n\n"
- return 1
- fi
+ procscsiscsi
+ TMPSTR=`echo "$SCSISTR" | grep 'Vendor:'`
+ if [ "$TMPSTR" != "$STR" ]; then
+ echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm} \n\n\n"
+ return 1
fi
- TMPSTR=$(echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p' | sed 's/ *$//g')
- if [ "$TMPSTR" != "$TYPE" ] ; then
+ TMPSTR=`echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p'`
+ if [ $TMPSTR != $TYPE ] ; then
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${TMPSTR} \nto: $TYPE ${norm} \n\n\n"
return 1
fi
return $RC
}
-# Test if SCSI device $host $channel $id $lun exists
+# Test if SCSI device $host $channen $id $lun exists
# Outputs description from /proc/scsi/scsi (unless arg passed)
# Returns SCSISTR (empty if no dev)
testexist ()
{
: testexist
SCSISTR=
- if procscsiscsi && [ -z "$1" ] ; then
+ if procscsiscsi && test -z "$1"; then
echo "$SCSISTR" | head -n1
echo "$SCSISTR" | tail -n2 | pr -o4 -l1
fi
@@ -368,55 +293,47 @@ chanlist ()
local tmpchan
for dev in /sys/class/scsi_device/${host}:* ; do
- [ -d "$dev" ] || continue;
+ [ -d $dev ] || continue;
hcil=${dev##*/}
cil=${hcil#*:}
chan=${cil%%:*}
for tmpchan in $channelsearch ; do
- if [ "$chan" -eq "$tmpchan" ] ; then
- chan=
+ if test "$chan" -eq $tmpchan ; then
+ chan=
fi
done
- if [ -n "$chan" ] ; then
+ if test -n "$chan" ; then
channelsearch="$channelsearch $chan"
fi
done
- if [ -z "$channelsearch" ] ; then
- channelsearch="0"
- fi
+ if test -z "$channelsearch"; then channelsearch="0"; fi
}
# Returns the list of existing targets per host
idlist ()
{
+ local hcil
+ local cil
+ local il
+ local target
local tmpid
- local newid
- local oldid
- oldlist=$(find /sys/class/scsi_device -name "${host}:${channel}:*" -printf "%f\n")
- # Rescan LUN 0 to check if we found new targets
- echo "${channel} - -" > "/sys/class/scsi_host/host${host}/scan"
- newlist=$(find /sys/class/scsi_device -name "${host}:${channel}:*" -printf "%f\n")
- for newid in $newlist ; do
- oldid=$newid
- for tmpid in $oldlist ; do
- if [ "$newid" = "$tmpid" ] ; then
- oldid=
- break
+ for dev in /sys/class/scsi_device/${host}:${channel}:* ; do
+ [ -d $dev ] || continue;
+ hcil=${dev##*/}
+ cil=${hcil#*:}
+ il=${cil#*:}
+ target=${il%%:*}
+ for tmpid in $idsearch ; do
+ if test "$target" -eq $tmpid ; then
+ target=
+ break
fi
done
- if [ -n "$oldid" ] ; then
- if [ -d /sys/class/scsi_device/$oldid ] ; then
- hcil=${oldid}
- printf "\r${green}NEW: %s" "$norm"
- testexist
- if [ "$SCSISTR" ] ; then
- incrfound "$hcil"
- fi
- fi
+ if test -n "$target" ; then
+ idsearch="$idsearch $target"
fi
done
- idsearch=$(find /sys/bus/scsi/devices -name "target${host}:${channel}:*" -printf "%f\n" | cut -f 3 -d :)
}
# Returns the list of existing LUNs from device $host $channel $id $lun
@@ -424,25 +341,19 @@ idlist ()
getluns()
{
sgdevice
- [ -z "$SGDEV" ] && return 1
- if [ ! -x /usr/bin/sg_luns ] ; then
- echo 0
- return 1
- fi
- LLUN=$(sg_luns /dev/$SGDEV 2>/dev/null | sed -n 's/ \(.*\)/\1/p')
- # Added -z $LLUN condition because $? gets the RC from sed, not sg_luns
- if [ $? -ne 0 ] || [ -z "$LLUN" ] ; then
- echo 0
- return 1
- fi
+ if test -z "$SGDEV"; then return 1; fi
+ if test ! -x /usr/bin/sg_luns; then echo 0; return 1; fi
+ LLUN=`sg_luns /dev/$SGDEV 2>/dev/null | sed -n 's/ \(.*\)/\1/p'`
+ if test $? != 0; then echo 0; return 1; fi
+ #echo "$LLUN" | sed -n 's/.*lun=\(.*\)/\1/p'
for lun in $LLUN ; do
# Swap LUN number
- l0=0x$lun
- l1=$(( (l0 >> 48) & 0xffff ))
- l2=$(( (l0 >> 32) & 0xffff ))
- l3=$(( (l0 >> 16) & 0xffff ))
- l4=$(( l0 & 0xffff ))
- l0=$(( ( ( (l4 * 0xffff) + l3 ) * 0xffff + l2 ) * 0xffff + l1 ))
+ l0=$(printf '%u' 0x$lun)
+ l1=$(( ($l0 >> 48) & 0xffff ))
+ l2=$(( ($l0 >> 32) & 0xffff ))
+ l3=$(( ($l0 >> 16) & 0xffff ))
+ l4=$(( $l0 & 0xffff ))
+ l0=$(( ( ( ($l4 * 0xffff) + $l3 ) * 0xffff + $l2 ) * 0xffff + $l1 ))
printf "%u\n" $l0
done
return 0
@@ -451,134 +362,92 @@ getluns()
# Wait for udev to settle (create device nodes etc.)
udevadm_settle()
{
- local tmo=60
- if [ -x /sbin/udevadm ] ; then
+ if test -x /sbin/udevadm; then
print_and_scroll_back " Calling udevadm settle (can take a while) "
- # Loop for up to 60 seconds if sd devices still are settling..
- # This allows us to continue if udev events are stuck on multipaths in recovery mode
- while [ $tmo -gt 0 ] ; do
- if ! /sbin/udevadm settle --timeout=1 | egrep -q sd[a-z]+ ; then
- break;
- fi
- let tmo=$tmo-1
- done
+ /sbin/udevadm settle
white_out
- elif [ -x /sbin/udevsettle ] ; then
+ elif test -x /sbin/udevsettle; then
print_and_scroll_back " Calling udevsettle (can take a while) "
/sbin/udevsettle
white_out
else
- sleep 0.02
+ usleep 20000
fi
}
# Perform scan on a single lun $host $channel $id $lun
dolunscan()
{
- local remappedlun0=
- local devpath
SCSISTR=
devnr="$host $channel $id $lun"
echo -e " Scanning for device $devnr ... "
- printf "${yellow}OLD: %s" "$norm"
+ printf "${yellow}OLD: $norm"
testexist
- # Device exists: Test whether it's still online
- # (testonline returns 2 if it's gone and 1 if it has changed)
- devpath="/sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device"
- if [ "$SCSISTR" ] ; then
- testonline
- RC=$?
- # Well known lun transition case. Only for Direct-Access devs (type 0)
- # If block directory exists && and PQUAL != 0, we unmapped lun0 and just have a well-known lun
- # If block directory doesn't exist && PQUAL == 0, we mapped a real lun0
- if [ "$lun" -eq 0 ] && [ $IPTYPE -eq 0 ] ; then
- if [ $RC = 2 ] ; then
- if [ -e "$devpath" ] ; then
- if [ -d "$devpath/block" ] ; then
- remappedlun0=2 # Transition from real lun 0 to well-known
- else
- RC=0 # Set this so the system leaves the existing well known lun alone. This is a lun 0 with no block directory
- fi
- fi
- elif [ $RC = 0 ] && [ $IPTYPE -eq 0 ] ; then
- if [ -e "$devpath" ] ; then
- if [ ! -d "$devpath/block" ] ; then
- remappedlun0=1 # Transition from well-known to real lun 0
- fi
- fi
- fi
- fi
- fi
-
# Special case: lun 0 just got added (for reportlunscan),
# so make sure we correctly treat it as new
- if [ "$lun" = "0" ] && [ "$1" = "1" ] && [ -z "$remappedlun0" ] ; then
+ if test "$lun" = "0" -a "$1"; then
SCSISTR=""
printf "\r\e[A\e[A\e[A"
fi
-
- : f "$remove" s $SCSISTR
- if [ "$remove" ] && [ "$SCSISTR" -o "$remappedlun0" = "1" ] ; then
- if [ $RC != 0 ] || [ ! -z "$forceremove" ] || [ -n "$remappedlun0" ] ; then
- if [ "$remappedlun0" != "1" ] ; then
- echo -en "\r\e[A\e[A\e[A${red}REM: "
- echo "$SCSISTR" | head -n1
- echo -e "${norm}\e[B\e[B"
- fi
- if [ -e "$devpath" ] ; then
- # have to preemptively do this so we can figure out the mpath device
- # Don't do this if we're deleting a well known lun to replace it
- if [ "$remappedlun0" != "1" ] ; then
- incrrmvd "$host:$channel:$id:$lun"
- fi
- echo 1 > "$devpath/delete"
- sleep 0.02
+ : f $remove s $SCSISTR
+ if test "$remove" -a "$SCSISTR"; then
+ # Device exists: Test whether it's still online
+ # (testonline returns 1 if it's gone or has changed)
+ testonline
+ RC=$?
+ if test $RC != 0 -o ! -z "$forceremove"; then
+ echo -en "\r\e[A\e[A\e[A${red}REM: "
+ echo "$SCSISTR" | head -n1
+ echo -e "${norm}\e[B\e[B"
+ if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then
+ echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/delete
+ # FIXME: Can we skip udevadm settle for removal?
+ #udevadm_settle
+ usleep 20000
else
echo "scsi remove-single-device $devnr" > /proc/scsi/scsi
- if [ $RC -eq 1 ] || [ "$lun" -eq 0 ] ; then
+ if test $RC -eq 1 -o $lun -eq 0 ; then
# Try readding, should fail if device is gone
echo "scsi add-single-device $devnr" > /proc/scsi/scsi
- fi
+ fi
fi
fi
- if [ $RC = 0 ] || [ "$forcerescan" ] ; then
- if [ -e "$devpath" ] ; then
- echo 1 > "$devpath/rescan"
+ if test $RC = 0 -o "$forcerescan" ; then
+ if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then
+ echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/rescan
+ udevadm_settle
fi
fi
- printf "\r\e[A\e[A\e[A${yellow}OLD: %s" "$norm"
+ printf "\r\e[A\e[A\e[A${yellow}OLD: $norm"
testexist
- if [ -z "$SCSISTR" ] && [ $RC != 1 ] && [ "$remappedlun0" != "1" ] ; then
- printf "\r${red}DEL: %s\r\n\n" "$norm"
- # In the event we're replacing with a well known node, we need to let it continue, to create the replacement node
- [ "$remappedlun0" != "2" ] && return 2
+ if test -z "$SCSISTR"; then
+ printf "\r${red}DEL: $norm\r\n\n"
+ let rmvd+=1;
+ return 1
fi
fi
- if [ -z "$SCSISTR" ] || [ -n "$remappedlun0" ] ; then
- if [ "$remappedlun0" != "2" ] ; then
- # Device does not exist, try to add
- printf "\r${green}NEW: %s" "$norm"
- fi
- if [ -e "/sys/class/scsi_host/host${host}/scan" ] ; then
- echo "$channel $id $lun" > "/sys/class/scsi_host/host${host}/scan" 2> /dev/null
+ if test -z "$SCSISTR"; then
+ # Device does not exist, try to add
+ printf "\r${green}NEW: $norm"
+ if test -e /sys/class/scsi_host/host${host}/scan; then
+ echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
+ udevadm_settle
else
echo "scsi add-single-device $devnr" > /proc/scsi/scsi
fi
testexist
- if [ -z "$SCSISTR" ] ; then
+ if test -z "$SCSISTR"; then
# Device not present
printf "\r\e[A";
- # Optimization: if lun==0, stop here (only if in non-remove mode)
- if [ "$lun" = 0 ] && [ -z "$remove" ] && [ "$optscan" = 1 ] ; then
- return 1;
- fi
- else
- if [ "$remappedlun0" != "2" ] ; then
- incrfound "$host:$channel:$id:$lun"
- fi
+ ## COMMENTED OUT as the "break" below is broken.
+ ## Optimization: if lun==0, stop here (only if in non-remove mode)
+ #if test $lun = 0 -a -z "$remove" -a $optscan = 1; then
+ # break;
+ #fi
+ else
+ let found+=1;
fi
fi
- return 0;
}
# Perform report lun scan on $host $channel $id using REPORT_LUNS
@@ -589,20 +458,20 @@ doreportlun()
devnr="$host $channel $id $lun"
echo -en " Scanning for device $devnr ...\r"
lun0added=
- #printf "${yellow}OLD: %s" "$norm"
+ #printf "${yellow}OLD: $norm"
# Phase one: If LUN0 does not exist, try to add
testexist -q
- if [ -z "$SCSISTR" ] ; then
+ if test -z "$SCSISTR"; then
# Device does not exist, try to add
- #printf "\r${green}NEW: %s" "$norm"
- if [ -e "/sys/class/scsi_host/host${host}/scan" ] ; then
- echo "$channel $id $lun" > "/sys/class/scsi_host/host${host}/scan" 2> /dev/null
+ #printf "\r${green}NEW: $norm"
+ if test -e /sys/class/scsi_host/host${host}/scan; then
+ echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
udevadm_settle
else
echo "scsi add-single-device $devnr" > /proc/scsi/scsi
fi
testexist -q
- if [ -n "$SCSISTR" ] ; then
+ if test -n "$SCSISTR"; then
lun0added=1
#testonline
else
@@ -611,34 +480,35 @@ doreportlun()
# Find alternative LUN to send getluns to
for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do
[ -d "$dev" ] || continue
- lun=${dev##*:}
+ lun=${dev##*:}
break
done
fi
fi
- targetluns=$(getluns)
+ targetluns=`getluns`
REPLUNSTAT=$?
lunremove=
#echo "getluns reports " $targetluns
- olddev=$(find /sys/class/scsi_device/ -name "$host:$channel:$id:*" 2>/dev/null | sort -t: -k4 -n)
+ olddev=`find /sys/class/scsi_device/ -name $host:$channel:$id:* 2>/dev/null`
+ oldluns=`echo "$olddev" | awk -F'/' '{print $5}' | awk -F':' '{print $4}'`
oldtargets="$targetluns"
# OK -- if we don't have a LUN to send a REPORT_LUNS to, we could
# fall back to wildcard scanning. Same thing if the device does not
# support REPORT_LUNS
- # TODO: We might be better off to ALWAYS use wildcard scanning if
+ # TODO: We might be better off to ALWAYS use wildcard scanning if
# it works
- if [ "$REPLUNSTAT" = "1" ] ; then
- if [ -e "/sys/class/scsi_host/host${host}/scan" ] ; then
- echo "$channel $id -" > "/sys/class/scsi_host/host${host}/scan" 2> /dev/null
+ if test "$REPLUNSTAT" = "1"; then
+ if test -e /sys/class/scsi_host/host${host}/scan; then
+ echo "$channel $id -" > /sys/class/scsi_host/host${host}/scan 2> /dev/null
udevadm_settle
else
echo "scsi add-single-device $host $channel $id $SCAN_WILD_CARD" > /proc/scsi/scsi
fi
- targetluns=$(find /sys/class/scsi_device/ -name "$host:$channel:$id:*" -printf "%f\n" | cut -d : -f 4)
- let found+=$(echo "$targetluns" | wc -l)
- let found-=$(echo "$olddev" | wc -l)
+ targetluns=`find /sys/class/scsi_device/ -name $host:$channel:$id:* 2>/dev/null | awk -F'/' '{print $5}' | awk -F':' '{print $4}' | sort -n`
+ let found+=`echo "$targetluns" | wc -l`
+ let found-=`echo "$olddev" | wc -l`
fi
- [ -z "$targetluns" ] && targetluns="$oldtargets"
+ if test -z "$targetluns"; then targetluns="$oldtargets"; fi
# Check existing luns
for dev in $olddev; do
[ -d "$dev" ] || continue
@@ -647,687 +517,216 @@ doreportlun()
inlist=
# OK, is existing $lun (still) in reported list
for tmplun in $targetluns; do
- if [ "$tmplun" = "$lun" ] ; then
- inlist=1
- dolunscan $lun0added
- [ $? -eq 1 ] && break
+ if test $tmplun -eq $lun ; then
+ inlist=1
+ dolunscan $lun0added
else
- newsearch="$newsearch $tmplun"
+ newsearch="$newsearch $tmplun"
fi
done
- # OK, we have now done a lunscan on $lun and
+ # OK, we have now done a lunscan on $lun and
# $newsearch is the old $targetluns without $lun
if [ -z "$inlist" ]; then
# Stale lun
lunremove="$lunremove $lun"
fi
- # $lun removed from $lunsearch
- targetluns=${newsearch# }
+ # $lun removed from $lunsearch (echo for whitespace cleanup)
+ targetluns=`echo $newsearch`
done
# Add new ones and check stale ones
for lun in $targetluns $lunremove; do
dolunscan $lun0added
- [ $? -eq 1 ] && break
done
}
# Perform search (scan $host)
dosearch ()
{
- if [ -z "$channelsearch" ] ; then
+ if test -z "$channelsearch" ; then
chanlist
fi
for channel in $channelsearch; do
- if [ -z "$idsearch" ] ; then
- if [ -z "$lunsearch" ] ; then
- idlist
- else
- idsearch=$(find /sys/bus/scsi/devices -name "target${host}:${channel}:*" -printf "%f\n" | cut -f 3 -d :)
- fi
+ if test -z "$idsearch" ; then
+ idlist
fi
for id in $idsearch; do
- if [ -z "$lunsearch" ] ; then
- doreportlun
+ if test -z "$lunsearch" ; then
+ doreportlun
else
- for lun in $lunsearch; do
+ for lun in $lunsearch; do
dolunscan
- [ $? -eq 1 ] && break
done
fi
done
done
}
-
+
expandlist ()
{
list=$1
result=""
first=${list%%,*}
rest=${list#*,}
- while [ ! -z "$first" ] ; do
+ while test ! -z "$first"; do
beg=${first%%-*};
- if [ "$beg" = "$first" ] ; then
+ if test "$beg" = "$first"; then
result="$result $beg";
else
end=${first#*-}
- result="$result $(seq $beg $end)"
+ result="$result `seq $beg $end`"
fi
- [ "$rest" = "$first" ] && rest=""
+ test "$rest" = "$first" && rest=""
first=${rest%%,*}
rest=${rest#*,}
done
- echo "$result"
-}
-
-searchexisting()
-{
- local tmpch;
- local tmpid
- local match=0
- local targets=
-
- targets=$(find /sys/bus/scsi/devices -name "target${host}:*" -printf "%f\n" | cut -d : -f 2-3)
- # Nothing came back on this host, so we should skip it
- [ -z "$targets" ] && return
-
- local target=;
- for target in $targets ; do
- channel=${target%:*}
- id=${target#*:}
- if [ -n "$channelsearch" ] ; then
- for tmpch in $channelsearch ; do
- [ $tmpch -eq "$channel" ] && match=1
- done
- else
- match=1
- fi
-
- [ $match -eq 0 ] && continue
- match=0
-
- if [ "$filter_ids" -eq 1 ] ; then
- for tmpid in $idsearch ; do
- if [ "$tmpid" = "$id" ] ; then
- match=1
- fi
- done
- else
- match=1
- fi
-
- [ $match -eq 0 ] && continue
-
- if [ -z "$lunsearch" ] ; then
- doreportlun
- else
- for lun in $lunsearch ; do
- dolunscan
- [ $? -eq 1 ] && break
- done
- fi
- done
-}
-
-# Go through all of the existing devices and figure out any that have been remapped
-findremapped()
-{
- local hctl=;
- local devs=
- local sddev=
- local id_serial=
- local id_serial_old=
- local remapped=
- mpaths=""
- local tmpfile=
-
- tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null)
- if [ -z "$tmpfile" ] ; then
- tmpfile="/tmp/rescan-scsi-bus.$$"
- rm -f $tmpfile
- fi
-
- # Get all of the ID_SERIAL attributes, after finding their sd node
- devs=$(ls /sys/class/scsi_device/)
- for hctl in $devs ; do
- if [ -d "/sys/class/scsi_device/$hctl/device/block" ] ; then
- sddev=$(ls "/sys/class/scsi_device/$hctl/device/block")
- id_serial_old=$(udevadm info -q all -n "$sddev" | grep "ID_SERIAL=" | cut -d"=" -f2)
- [ -z "$id_serial_old" ] && id_serial_old="none"
- echo "$hctl $sddev $id_serial_old" >> $tmpfile
- fi
- done
-
- # Trigger udev to update the info
- echo -n "Triggering udev to update device information... "
- /sbin/udevadm trigger
- udevadm_settle 2>&1 /dev/null
- echo "Done"
-
- # See what changed and reload the respective multipath device if applicable
- while read -r hctl sddev id_serial_old ; do
- remapped=0
- id_serial=$(udevadm info -q all -n "$sddev" | grep "ID_SERIAL=" | cut -d"=" -f2)
- [ -z "$id_serial" ] && id_serial="none"
- if [ "$id_serial_old" != "$id_serial" ] ; then
- remapped=1
- fi
- # If udev events updated the disks already, but the multipath device isn't update
- # check for old devices to make sure we found remapped luns
- if [ -n "$mp_enable" ] && [ $remapped -eq 0 ]; then
- findmultipath "$sddev" $id_serial
- if [ $? -eq 1 ] ; then
- remapped=1
- fi
- fi
-
- # if uuid is 1, it's unmapped, so we don't want to treat it as a remap
- # if remapped flag is 0, just skip the rest of the logic
- if [ "$id_serial" = "1" ] || [ $remapped -eq 0 ] ; then
- continue
- fi
- printf "${yellow}REMAPPED: %s" "$norm"
- host=$(echo "$hctl" | cut -d":" -f1)
- channel=$(echo "$hctl" | cut -d":" -f2)
- id=$(echo "$hctl" | cut -d":" -f3)
- lun=$(echo "$hctl" | cut -d":" -f4)
- procscsiscsi
- echo "$SCSISTR"
- incrchgd "$hctl"
- done < $tmpfile
- rm -f $tmpfile
-
- if [ -n "$mp_enable" ] && [ -n "$mpaths" ] ; then
- echo "Updating multipath device mappings"
- flushmpaths
- $MULTIPATH | grep "create:" 2> /dev/null
- fi
-}
-
-incrfound()
-{
- local hctl="$1"
- if [ -n "$hctl" ] ; then
- let found+=1
- FOUNDDEVS="$FOUNDDEVS\t[$hctl]\n"
- else
- return
- fi
-}
-
-incrchgd()
-{
- local hctl="$1"
- if [ -n "$hctl" ] ; then
- if ! echo "$CHGDEVS" | grep -q "\[$hctl\]"; then
- let updated+=1
- CHGDEVS="$CHGDEVS\t[$hctl]\n"
- fi
- else
- return
- fi
-
- if [ -n "$mp_enable" ] ; then
- local sdev
-
- sdev=$(findsddev "$hctl")
- if [ -n "$sdev" ] ; then
- findmultipath "$sdev"
- fi
- fi
-}
-
-incrrmvd()
-{
- local hctl="$1"
- if [ -n "$hctl" ] ; then
- let rmvd+=1;
- RMVDDEVS="$RMVDDEVS\t[$hctl]\n"
- else
- return
- fi
-
- if [ -n "$mp_enable" ] ; then
- local sdev
-
- sdev=$(findsddev "$hctl")
- if [ -n "$sdev" ] ; then
- findmultipath "$sdev"
- fi
- fi
-}
-
-findsddev()
-{
- local hctl="$1"
- local sddev=
- local blkpath
-
- blkpath="/sys/class/scsi_device/$hctl/device/block"
- if [ -e "$blkpath" ] ; then
- sddev=$(ls "$blkpath")
- echo "$sddev"
- fi
-}
-
-addmpathtolist()
-{
- local mp="$1"
- local mp2=
-
- for mp2 in $mpaths ; do
- # The multipath device is already in the list
- if [ "$mp2" = "$mp" ] ; then
- return
- fi
- done
- mpaths="$mpaths $mp"
-}
-
-findmultipath()
-{
- local dev="$1"
- local find_mismatch="$2"
- local mp=
- local mp2=
- local found_dup=0
- local maj_min=
-
- # Need a sdev, and executable multipath and dmsetup command here
- if [ -z "$dev" ] || [ ! -x "$DMSETUP" ] || [ ! -x "$MULTIPATH" ] ; then
- return 1
- fi
-
- maj_min=$(cat "/sys/block/$dev/dev")
- for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do
- [ "$mp" = "No" ] && break;
- if "$DMSETUP" status "$mp" | grep -q " $maj_min "; then
- # With two arguments, look up current uuid from sysfs
- # if it doesn't match what was passed, this multipath
- # device is not updated, so this is a remapped LUN
- if [ -n "$find_mismatch" ] ; then
- mp2=$($MULTIPATH -l "$mp" | egrep -o "dm-[0-9]+")
- mp2=$(cut -f2 -d- "/sys/block/$mp2/dm/uuid")
- if [ "$find_mismatch" != "$mp2" ] ; then
- addmpathtolist "$mp"
- found_dup=1
- fi
- continue
- fi
- # Normal mode: Find the first multipath with the sdev
- # and add it to the list
- addmpathtolist "$mp"
- return
- fi
- done
-
- # Return 1 to signal that a duplicate was found to the calling function
- if [ $found_dup -eq 1 ] ; then
- return 1
- else
- return 0
- fi
+ echo $result
}
-reloadmpaths()
-{
- local mpath
- if [ ! -x "$MULTIPATH" ] ; then
- echo "no -x multipath"
- return
- fi
-
- # Pass 1 as the argument to reload all mpaths
- if [ "$1" = "1" ] ; then
- echo "Reloading all multipath devices"
- $MULTIPATH -r > /dev/null 2>&1
- return
- fi
-
- # Reload the multipath devices
- for mpath in $mpaths ; do
- echo -n "Reloading multipath device $mpath... "
- if $MULTIPATH -r "$mpath" > /dev/null 2>&1 ; then
- echo "Done"
- else
- echo "Fail"
- fi
- done
-}
-
-resizempaths()
-{
- local mpath
-
- for mpath in $mpaths ; do
- echo -n "Resizing multipath map $mpath ..."
- multipathd -k"resize map $mpath"
- let updated+=1
- done
-}
-
-flushmpaths()
-{
- local mpath
- local remove=""
- local i
- local flush_retries=5
-
- if [ -n "$1" ] ; then
- for mpath in $($DMSETUP ls --target=multipath | cut -f 1) ; do
- [ "$mpath" = "No" ] && break
- num=$($DMSETUP status "$mpath" | awk 'BEGIN{RS=" ";active=0}/[0-9]+:[0-9]+/{dev=1}/A/{if (dev == 1) active++; dev=0} END{ print active }')
- if [ "$num" -eq 0 ] ; then
- remove="$remove $mpath"
- fi
- done
- else
- remove="$mpaths"
- fi
-
- for mpath in $remove ; do
- i=0
- echo -n "Flushing multipath device $mpath... "
- while [ $i -lt $flush_retries ] ; do
- $DMSETUP message "$mpath" 0 fail_if_no_path > /dev/null 2>&1
- if $MULTIPATH -f "$mpath" > /dev/null 2>&1 ; then
- echo "Done ($i retries)"
- break
- elif [ $i -eq $flush_retries ] ; then
- echo "Fail"
- fi
- sleep 0.02
- let i=$i+1
- done
- done
-}
-
-
-# Find resized luns
-findresized()
-{
- local devs=
- local size=
- local new_size=
- local sysfs_path=
- local sddev=
- local i=
- local m=
- local mpathsize=
- declare -a mpathsizes
-
- if [ -z "$lunsearch" ] ; then
- devs=$(ls /sys/class/scsi_device/)
- else
- for lun in $lunsearch ; do
- devs="$devs $(cd /sys/class/scsi_device/ && ls -d *:${lun})"
- done
- fi
-
- for hctl in $devs ; do
- sysfs_path="/sys/class/scsi_device/$hctl/device"
- if [ -d "$sysfs_path/block" ] ; then
- sddev=$(ls "$sysfs_path/block")
- size=$(cat "$sysfs_path/block/$sddev/size")
-
- echo 1 > "$sysfs_path/rescan"
- new_size=$(cat "$sysfs_path/block/$sddev/size")
-
- if [ "$size" != "$new_size" ] && [ "$size" != "0" ] && [ "$new_size" != "0" ] ; then
- printf "${yellow}RESIZED: %s" "$norm"
- host=$(echo "$hctl" | cut -d":" -f1)
- channel=$(echo "$hctl" | cut -d":" -f2)
- id=$(echo "$hctl" | cut -d":" -f3)
- lun=$(echo "$hctl" | cut -d":" -f4)
-
- procscsiscsi
- echo "$SCSISTR"
- incrchgd "$hctl"
- fi
- fi
- done
-
- if [ -n "$mp_enable" ] && [ -n "$mpaths" ] ; then
- i=0
- for m in $mpaths ; do
- mpathsizes[$i]="$($MULTIPATH -l "$m" | egrep -o [0-9]+.[0-9]+[KMGT])"
- let i=$i+1
- done
- resizempaths
- i=0
- for m in $mpaths ; do
- mpathsize="$($MULTIPATH -l "$m" | egrep -o [0-9\.]+[KMGT])"
- echo "$m ${mpathsizes[$i]} => $mpathsize"
- let i=$i+1
- done
- fi
-}
-
-FOUNDDEVS=""
-CHGDEVS=""
-RMVDDEVS=""
-
# main
-if [ "@$1" = @--help ] || [ "@$1" = @-h ] || [ "@$1" = "@-?" ] ; then
+if test @$1 = @--help -o @$1 = @-h -o @$1 = @-?; then
echo "Usage: rescan-scsi-bus.sh [options] [host [host ...]]"
echo "Options:"
- echo " -a scan all targets, not just currently existing [default: disabled]"
- echo " -c enables scanning of channels 0 1 [default: 0 / all detected ones]"
- echo " -d enable debug [default: 0]"
- echo " -f flush failed multipath devices [default: disabled]"
- echo " -h help: print this usage message then exit"
- echo " -i issue a FibreChannel LIP reset [default: disabled]"
- echo " -I SECS issue a FibreChannel LIP reset and wait for SECS seconds [default: disabled]"
echo " -l activates scanning for LUNs 0--7 [default: 0]"
echo " -L NUM activates scanning for LUNs 0--NUM [default: 0]"
- echo " -m update multipath devices [default: disabled]"
- echo " -r enables removing of devices [default: disabled]"
- echo " -s look for resized disks and reload associated multipath devices, if applicable"
- echo " -u look for existing disks that have been remapped"
- echo " -V print version date then exit"
echo " -w scan for target device IDs 0--15 [default: 0--7]"
- echo "--alltargets: same as -a"
- echo "--attachpq3: Tell kernel to attach sg to LUN 0 that reports PQ=3"
- echo "--channels=LIST: Scan only channel(s) in LIST"
+ echo " -c enables scanning of channels 0 1 [default: 0 / all detected ones]"
+ echo " -r enables removing of devices [default: disabled]"
+ echo " -i issue a FibreChannel LIP reset [default: disabled]"
+ echo "--remove: same as -r"
+ echo "--issue-lip: same as -i"
+ echo "--forcerescan: Rescan existing devices"
+ echo "--forceremove: Remove and readd every device (DANGEROUS)"
+ echo "--nooptscan: don't stop looking for LUNs is 0 is not found"
echo "--color: use coloured prefixes OLD/NEW/DEL"
- echo "--flush: same as -f"
- echo "--forceremove: Remove stale devices (DANGEROUS)"
- echo "--forcerescan: Remove and readd existing devices (DANGEROUS)"
- echo "--help: print this usage message then exit"
echo "--hosts=LIST: Scan only host(s) in LIST"
+ echo "--channels=LIST: Scan only channel(s) in LIST"
echo "--ids=LIST: Scan only target ID(s) in LIST"
- echo "--ignore-rev: Ignore the revision change"
- echo "--issue-lip: same as -i"
- echo "--issue-lip-wait=SECS: same as -I"
- echo "--largelun: Tell kernel to support LUNs > 7 even on SCSI2 devs"
- echo "--luns=LIST: Scan only lun(s) in LIST"
- echo "--multipath: same as -m"
- echo "--nooptscan: don't stop looking for LUNs if 0 is not found"
- echo "--remove: same as -r"
+ echo "--luns=LIST: Scan only lun(s) in LIST"
+ echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]"
+ echo "--attachpq3: Tell kernel to attach sg to LUN 0 that reports PQ=3"
echo "--reportlun2: Tell kernel to try REPORT_LUN even on SCSI2 devices"
- echo "--resize: same as -s"
+ echo "--largelun: Tell kernel to support LUNs > 7 even on SCSI2 devs"
echo "--sparselun: Tell kernel to support sparse LUN numbering"
- echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]"
- echo "--update: same as -u"
- echo "--version: same as -V"
- echo "--wide: same as -w"
- echo ""
- echo "Host numbers may thus be specified either directly on cmd line (deprecated)"
- echo "or with the --hosts=LIST parameter (recommended)."
+ echo " Host numbers may thus be specified either directly on cmd line (deprecated) or"
+ echo " or with the --hosts=LIST parameter (recommended)."
echo "LIST: A[-B][,C[-D]]... is a comma separated list of single values and ranges"
- echo "(No spaces allowed.)"
- exit 0
-fi
-
-if [ "@$1" = @--version ] || [ "@$1" = @-V ] ; then
- echo ${VERSION}
+ echo " (No spaces allowed.)"
exit 0
fi
-if [ ! -d /sys/class/scsi_host/ ] && [ ! -d /proc/scsi/ ] ; then
+if test ! -d /sys/class/scsi_host/ -a ! -d /proc/scsi/; then
echo "Error: SCSI subsystem not active"
exit 1
-fi
+fi
# Make sure sg is there
modprobe sg >/dev/null 2>&1
-if [ -x /usr/bin/sg_inq ] ; then
- sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3)
- if [ -n "$sg_version" ] ; then
- sg_ver_maj=${sg_version:0:1}
- sg_version=${sg_version##?.}
- let sg_version+=$((100 * sg_ver_maj))
- fi
- sg_version=${sg_version##0.}
- #echo "\"$sg_version\""
- if [ -z "$sg_version" ] || [ "$sg_version" -lt 70 ] ; then
- sg_len_arg="-36"
- else
- sg_len_arg="--len=36"
- fi
-else
- echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils"
- echo " or rescan-scsi-bus.sh might not fully work."
-fi
+if test -x /usr/bin/sg_inq; then
+ sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3)
+ sg_version=${sg_version##0.}
+ #echo "\"$sg_version\""
+ #if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then
+ #sg_len_arg="-36"
+ #else
+ sg_len_arg="--len=36"
+ #fi
+#else
+# # Slackware note: it may not "fully work", but it works well enough for
+# # what we need here in the installer. If that turns out not to be the
+# # case, let volkerdi know on the Slackware Linux Questions forum.
+# echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils"
+# echo " or rescan-scsi-bus.sh might not fully work."
+fi
# defaults
unsetcolor
-debug=0
lunsearch=
-opt_idsearch=$(seq 0 7)
-filter_ids=0
+opt_idsearch=`seq 0 7`
opt_channelsearch=
remove=
-updated=0
-update=0
-resize=0
forceremove=
optscan=1
sync=1
-existing_targets=1
-mp_enable=
-lipreset=-1
declare -i scan_flags=0
-ignore_rev=0
+if test -d /sys/class/scsi_host; then
+ findhosts_26
+else
+ findhosts
+fi
# Scan options
opt="$1"
-while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
+while test ! -z "$opt" -a -z "${opt##-*}"; do
opt=${opt#-}
case "$opt" in
- a) existing_targets=;; #Scan ALL targets when specified
+ l) lunsearch=`seq 0 7` ;;
+ L) lunsearch=`seq 0 $2`; shift ;;
+ w) opt_idsearch=`seq 0 15` ;;
c) opt_channelsearch="0 1" ;;
- d) debug=1 ;;
- f) flush=1 ;;
- i) lipreset=0 ;;
- I) shift; lipreset=$opt ;;
- l) lunsearch=$(seq 0 7) ;;
- L) lunsearch=$(seq 0 "$2"); shift ;;
- m) mp_enable=1 ;;
r) remove=1 ;;
- s) resize=1; mp_enable=1 ;;
- u) update=1 ;;
- w) opt_idsearch=$(seq 0 15) ;;
- -alltargets) existing_targets=;;
- -attachpq3) scan_flags=$((scan_flags|0x1000000)) ;;
- -channels=*) arg=${opt#-channels=};opt_channelsearch=$(expandlist "$arg") ;;
- -color) setcolor ;;
- -flush) flush=1 ;;
- -forceremove) remove=1; forceremove=1 ;;
+ i) lipreset=1 ;;
+ -remove) remove=1 ;;
-forcerescan) remove=1; forcerescan=1 ;;
- -hosts=*) arg=${opt#-hosts=}; hosts=$(expandlist "$arg") ;;
- -ids=*) arg=${opt#-ids=}; opt_idsearch=$(expandlist "$arg") ; filter_ids=1;;
- -ignore-rev) ignore_rev=1;;
- -issue-lip) lipreset=0 ;;
- -issue-lip-wait) lipreset=${opt#-issue-lip-wait=};;
- -largelun) scan_flags=$((scan_flags|0x200)) ;;
- -luns=*) arg=${opt#-luns=}; lunsearch=$(expandlist "$arg") ;;
- -multipath) mp_enable=1 ;;
+ -forceremove) remove=1; forceremove=1 ;;
+ -hosts=*) arg=${opt#-hosts=}; hosts=`expandlist $arg` ;;
+ -channels=*) arg=${opt#-channels=};opt_channelsearch=`expandlist $arg` ;;
+ -ids=*) arg=${opt#-ids=}; opt_idsearch=`expandlist $arg` ;;
+ -luns=*) arg=${opt#-luns=}; lunsearch=`expandlist $arg` ;;
+ -color) setcolor ;;
-nooptscan) optscan=0 ;;
+ -issue-lip) lipreset=1 ;;
+ -sync) sync=2 ;;
-nosync) sync=0 ;;
- -remove) remove=1 ;;
- -reportlun2) scan_flags=$((scan_flags|0x20000)) ;;
- -resize) resize=1;;
+ -attachpq3) scan_flags=$(($scan_flags|0x1000000)) ;;
+ -reportlun2) scan_flags=$(($scan_flags|0x20000)) ;;
+ -largelun) scan_flags=$(($scan_flags|0x200)) ;;
-sparselun) scan_flags=$((scan_flags|0x40)) ;;
- -sync) sync=2 ;;
- -update) update=1;;
- -wide) opt_idsearch=$(seq 0 15) ;;
*) echo "Unknown option -$opt !" ;;
esac
shift
opt="$1"
-done
+done
-if [ -z "$hosts" ] ; then
- if [ -d /sys/class/scsi_host ] ; then
- findhosts_26
- else
- findhosts
- fi
+# Hosts given ?
+if test "@$1" != "@"; then
+ hosts=$*
fi
-if [ -d /sys/class/scsi_host ] && [ ! -w /sys/class/scsi_host ]; then
+if [ -d /sys/class/scsi_host -a ! -w /sys/class/scsi_host ]; then
echo "You need to run scsi-rescan-bus.sh as root"
exit 2
-fi
-[ "$sync" = 1 ] && [ "$remove" = 1 ] && sync=2
-if [ "$sync" = 2 ] ; then
- echo "Syncing file systems"
- sync
-fi
-if [ -w /sys/module/scsi_mod/parameters/default_dev_flags ] && [ $scan_flags != 0 ] ; then
- OLD_SCANFLAGS=$(cat /sys/module/scsi_mod/parameters/default_dev_flags)
- NEW_SCANFLAGS=$((OLD_SCANFLAGS|scan_flags))
- if [ "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS" ] ; then
+fi
+if test "$sync" = 1 -a "$remove" = 1; then sync=2; fi
+if test "$sync" = 2; then echo "Syncing file systems"; sync; fi
+if test -w /sys/module/scsi_mod/parameters/default_dev_flags -a $scan_flags != 0; then
+ OLD_SCANFLAGS=`cat /sys/module/scsi_mod/parameters/default_dev_flags`
+ NEW_SCANFLAGS=$(($OLD_SCANFLAGS|$scan_flags))
+ if test "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS"; then
echo -n "Temporarily setting kernel scanning flags from "
- printf "0x%08x to 0x%08x\n" "$OLD_SCANFLAGS" "$NEW_SCANFLAGS"
+ printf "0x%08x to 0x%08x\n" $OLD_SCANFLAGS $NEW_SCANFLAGS
echo $NEW_SCANFLAGS > /sys/module/scsi_mod/parameters/default_dev_flags
else
unset OLD_SCANFLAGS
fi
-fi
-DMSETUP=$(which dmsetup)
-[ -z "$DMSETUP" ] && flush= && mp_enable=
-MULTIPATH=$(which multipath 2> /dev/null)
-[ -z "$MULTIPATH" ] && flush= && mp_enable=
-
-echo -n "Scanning SCSI subsystem for new devices"
-[ -z "$flush" ] || echo -n ", flush failed multipath devices,"
-[ -z "$remove" ] || echo -n " and remove devices that have disappeared"
-echo
+fi
+echo "Scanning SCSI subsystem for new devices"
+test -z "$remove" || echo " and remove devices that have disappeared"
declare -i found=0
-declare -i updated=0
declare -i rmvd=0
-
-if [ -n "$flush" ] ; then
- if [ -x "$MULTIPATH" ] ; then
- flushmpaths 1
- fi
-fi
-
-# Update existing mappings
-if [ $update -eq 1 ] ; then
- echo "Searching for remapped LUNs"
- findremapped
- # If you've changed the mapping, there's a chance it's a different size
- mpaths=""
- findresized
-# Search for resized LUNs
-elif [ $resize -eq 1 ] ; then
- echo "Searching for resized LUNs"
- findresized
-# Normal rescan mode
-else
- for host in $hosts; do
+for host in $hosts; do
echo -n "Scanning host $host "
- if [ -e "/sys/class/fc_host/host$host" ] ; then
+ if test -e /sys/class/fc_host/host$host ; then
# It's pointless to do a target scan on FC
- issue_lip=/sys/class/fc_host/host$host/issue_lip
- if [ -e "$issue_lip" ] && [ "$lipreset" -ge 0 ] ; then
- echo 1 > "$issue_lip" 2> /dev/null;
+ if test -n "$lipreset" ; then
+ echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
udevadm_settle
- [ "$lipreset" -gt 0 ] && sleep "$lipreset"
fi
+ # We used to always trigger a rescan for FC to update channels and targets
+ # Commented out -- as discussed with Hannes we should rely
+ # on the main loop doing the scan, no need to do it here.
+ #echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null;
+ #udevadm_settle
channelsearch=
idsearch=
else
@@ -1337,57 +736,22 @@ else
[ -n "$channelsearch" ] && echo -n "channels $channelsearch "
echo -n "for "
if [ -n "$idsearch" ] ; then
- echo -n " SCSI target IDs $idsearch" | tr '\n' ' '
+ echo -n " SCSI target IDs " $idsearch
else
echo -n " all SCSI target IDs"
fi
if [ -n "$lunsearch" ] ; then
- echo ", LUNs $lunsearch"
+ echo ", LUNs " $lunsearch
else
echo ", all LUNs"
fi
-
- if [ -n "$existing_targets" ] ; then
- searchexisting
- else
- dosearch
- fi
- done
- if [ -n "$OLD_SCANFLAGS" ] ; then
- echo "$OLD_SCANFLAGS" > /sys/module/scsi_mod/parameters/default_dev_flags
- fi
-fi
-
-let rmvd_found=$rmvd+$found
-if [ -n "$mp_enable" ] && [ $rmvd_found -gt 0 ] ; then
- echo "Attempting to update multipath devices..."
- if [ $rmvd -gt 0 ] ; then
- udevadm_settle
- echo "Removing multipath mappings for removed devices if all paths are now failed... "
- flushmpaths 1
- fi
- if [ $found -gt 0 ] ; then
- /sbin/udevadm trigger --sysname-match=sd*
- udevadm_settle
- if [ -x "$MULTIPATH" ] ; then
- echo "Trying to discover new multipath mappings for newly discovered devices... "
- $MULTIPATH | grep "create:" 2> /dev/null
- fi
- fi
-fi
-
-echo "$found new or changed device(s) found. "
-if [ ! -z "$FOUNDDEVS" ] ; then
- printf "%s" "$FOUNDDEVS"
-fi
-echo "$updated remapped or resized device(s) found."
-if [ ! -z "$CHGDEVS" ] ; then
- printf "%s" "$CHGDEVS"
+ dosearch
+done
+if test -n "$OLD_SCANFLAGS"; then
+ echo $OLD_SCANFLAGS > /sys/module/scsi_mod/parameters/default_dev_flags
fi
+echo "$found new device(s) found. "
echo "$rmvd device(s) removed. "
-if [ ! -z "$RMVDDEVS" ] ; then
- printf "%s" "$RMVDDEVS"
-fi
# Local Variables:
# sh-basic-offset: 2
diff --git a/source/installer/sources/initrd/usr/lib/setup/INS-all-in-one b/source/installer/sources/initrd/usr/lib/setup/INS-all-in-one
new file mode 100755
index 000000000..c6463626f
--- /dev/null
+++ b/source/installer/sources/initrd/usr/lib/setup/INS-all-in-one
@@ -0,0 +1,199 @@
+#!/bin/bash
+####################################################################################
+# File.......: /usr/lib/setup/INS-all-in-one
+# Called from: Forked from /usr/lib/setup/SeTmedia
+# Purpose....: Detect a partition labeled 'SLKins_aio-pkgs' and configure the
+# Installer to use it as the media source.
+# Version....: 1.00
+# Date.......: 22-Nov-2022
+# Author.....: Stuart Winter <mozes@slackware.com>
+###################################################################################
+# Change log
+# v1.00, 22-Nov-2022
+# * Initial version
+###################################################################################
+#
+# Copyright 2022 Stuart Winter, Earth, Milky Way, "".
+# 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.
+
+# Exit codes
+# 0 = Success (Install media dialog screen can exit cleanly)
+# 1 = General failure. (Install media dialog needs to present the list of options)
+# 2 = No media label found on any removable block device.
+# 3 = Sanity checks failed.
+# 4 = User chose not to use the bundled media, although the media passed sanity check.
+# 10 = User configured not to use All-In-One feature.
+
+# Check if the user has bypassed the all-in-one Installer functionality.
+# This may be if they have the all-in-one Installer on the USB stick but want
+# to install from another medium, and don't fancy re-deploying the standard USB
+# Installer image to the USB stick.
+[ -f /.no-allinone ] && exit 10
+
+# Settings:
+SLKINSMNT=/slack-all-in-one
+TMP=/var/log/setup/tmp
+[ ! -d $TMP ] && mkdir -pm755 $TMP
+
+###################################################################################
+################### Functions #####################################################
+###################################################################################
+
+# This code was copied in part from usr/lib/setup/INSUSB:
+# Detect a device with a partition label 'SLKins_aio-pkgs'
+# The MMC block devices aren't identified as 'removeable' so we don't filter on
+# that attribute since this is the standard storage subsystem we use on ARM.
+#lsblk -o name,label -ripn | grep -E 'SLKins_aio-pkgs$'
+function media_scan(){
+ local rdevice founddev
+ for rdevice in $( ls --indicator-style none /sys/block | grep -Ev "loop|ram|^dm-|^sr|^md" ); do
+ # Is it labeled 'SLKins_aio-pkgs'? If so we'll take the first one we find:
+ founddev="$( lsblk -o name,label -ripn /dev/${rdevice} 2>/dev/null | grep -E 'SLKins_aio-pkgs$' | awk '{print $1}' )"
+ [ ! -z "${founddev}" ] && break
+ done
+ # Report back if we found one:
+ [ ! -z "${founddev}" ] && { echo "${founddev}" ; return 0 ;} || return 1
+}
+
+# Mount the specified block device under the known mount point:
+function media_mount() {
+ mount -o noatime -m "$1" $SLKINSMNT 2>/dev/null
+ return $? ;}
+
+# umount the media:
+function media_umount() {
+ umount $SLKINSMNT 2>/dev/null
+ return $? ;}
+
+# Check if the Slackware media partition is already mounted:
+function media_ismounted() {
+ findmnt -DRM ${SLKINSMNT} > /dev/null 2>&1
+ return $?
+}
+
+# Sanity check the media:
+# The directory layout is: '/slackware/<slackware-tree-name>'
+# This is to enable users to add non-Slackware related assets to the partition upon installation
+# of the OS, if they wish.
+function media_sanity_check() {
+ local slacktree=$( media_report_slacktree )
+ [ -z "$slacktree" ] && return 1
+ # Is the tree available? We'll check the 'A' series directory is present:
+ [ ! -d $SLKINSMNT/slackware/$slacktree/a ] && return 1
+ # Enough sanity checking, it's probably good!
+ return 0
+}
+
+# Report the path to the configured Slackware media:
+# Output is relative - e.g. doesn's include the mount point and parent 'slackware' directory.
+function media_report_slacktree() {
+ # The Slackware tree we're using is configured in this file.
+ # This is placed by the script that creates the All-in-One Installer image.
+ [ ! -f $SLKINSMNT/slackware/.slktree ] && return 1
+ # Output content of the file which is a relative path: e.g. "slackwareaarch64-current/slackware"
+ grep -Ev '^$' $SLKINSMNT/slackware/.slktree
+}
+
+# Inform the user that the All-in-One Installer is ready to go.
+function offer_msg_ready() {
+ local blockdev="$1" mntpnt="$2"
+# --msgbox "\nThe Slackware package directory has been found on $blockdev and is mounted on $mntpnt ready for use.\n
+ dialog \
+ --backtitle "Slackware Installer" \
+ --title "INSTALLATION MEDIA SOURCE FOUND" --ok-button "OK" \
+ --msgbox "\nThis edition of the Slackware Installer has the installation media bundled, and is ready to use.\n
+ " 8 79
+ clear
+}
+
+# Inform the user that the All-in-One Installer was detected but failed sanity check.
+function offer_msg_failsanity() {
+ local blockdev="$1" mntpnt="$2"
+ dialog \
+ --backtitle "Slackware Installer" \
+ --title "INSTALLATION MEDIA SOURCE" --ok-button "OK" \
+ --msgbox "\nThis edition of the Slackware Installer contains the installation media.\n\n
+The media has been located on $blockdev but has failed the tests.\n\n
+You will now be presented with the option to choose a different installation media source.\n" 12 79
+ clear
+}
+
+# Offer the option to use the bundled media or pick the option manually:
+# Y=return 0, N=1
+function offer_chooseaio() {
+ dialog \
+ --backtitle "Slackware Installer" \
+ --title "INSTALLATION MEDIA SOURCE" --yesno \
+ "\nThis edition of the Slackware Installer contains the installation media.\n\n
+Would you like to use this as the media source?\n\n
+Answering 'No' provides a list of alternate installation media selection options.\n\n
+Recommendation: Yes" 15 77
+ return $?
+}
+
+# Configure the Slackware Installer to find the installation media on the All-in-One partition:
+function installer_configure() {
+ # An example of the entry in this file: /slack-all-in-one/slackware/slackwareaarch64-current/slackware
+ echo "$SLKINSMNT/slackware/$( media_report_slacktree )" > $TMP/SeTDS # is $SLKINSMNT/slackware/[contents of file '.slktree']
+ echo "-source_mounted" > $TMP/SeTmount
+ echo "/dev/null" > $TMP/SeTsource
+}
+
+###################################################################################
+
+# Try to locate the All-in-One Installer partition:
+mediablockdev=$( media_scan )
+
+# If we didn't find a block device with our label, bail out to enable the user to select
+# one from the list presented by /usr/lib/setup/SeTmedia:
+[ -z "${mediablockdev}" ] && exit 2
+
+# If the media is already mounted and the sanity check passes, inform the user.
+# This is to facilitate that the user may bounce through the main 'setup' menu and select
+# the installation media chooser (/usr/lib/setup/SeTmedia) more than once.
+# No, we're not going to offer them the option to pick a different installation source media:
+# it might break something. They can reboot.
+if media_ismounted && media_sanity_check; then
+ offer_msg_ready $mediablockdev $SLKINSMNT
+ exit 0
+fi
+
+# It's not mounted, but we found a label on a removable block device. Let's mount it,
+# configure the Installer to find the package source media, and inform the user that it's
+# ready to roll:
+if media_mount $mediablockdev && media_sanity_check; then
+ # Give the user the choice to use it. At this point we know it's validated so is a viable option.
+ # If the user chooses 'no', we umount the media and are returned to the '/usr/lib/setup/SeTmedia'
+ # process to pick an option.
+ offer_chooseaio || { media_umount ; clear ; exit 4 ;}
+ installer_configure
+ #offer_msg_ready $mediablockdev $SLKINSMNT
+ exit 0
+ else
+ # umount the media. If it fails, no problem - we can ignore it. The Installer won't be configured
+ # to use it unless the sanity check passed, so anything mounted isn't used nor is in the way.
+ media_umount
+ # Inform the user that they get to pick from the list of source media installation options:
+ offer_msg_failsanity $mediablockdev
+ exit 3
+fi
+
+clear
+exit 0
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTEFI b/source/installer/sources/initrd/usr/lib/setup/SeTEFI
index fdf545849..2e1f38eef 100755
--- a/source/installer/sources/initrd/usr/lib/setup/SeTEFI
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTEFI
@@ -1,4 +1,8 @@
#!/bin/sh
+
+# Script: /usr/lib/setup/SeTEFI
+# Called from: /usr/lib/setup/setup
+
TMP=/var/log/setup/tmp
T_PX="`cat $TMP/SeTT_PX`"
if [ ! -d $TMP ]; then
@@ -16,14 +20,21 @@ rm -f $TMP/SeTefipartitions
touch $TMP/SeTefipartitions
# Scan for EFI partitions:
-# The UEFI specification states that an EFI System partition should have
+# The UEFI specification states that an EFI System partition should have
# a GUID of C12A7328-F81F-11D2-BA4B-00A0C93EC93B for a GPT disk layout.
# In case of a MBR disk layout instead, an ESP should have an OS type of
# 0xEF. lsblk writes these values in the same field: PARTTYPE.
+#
+# AArch64 note: Any file systems labeled 'SLKins_efi' are filtered out
+# because on the AArch64 platform, the Slackware Installer image has its
+# own EFI boot partition to support Hardware Models using UEFI firmware.
+# This partition must be filtered out here to avoid it being incorrectly
+# selected as the OS's EFI partition.
ESPGUID=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
OSTYPE=0xEF
-lsblk -l -o parttype,name | \
-grep -i -F -e "$ESPGUID" -e "$OSTYPE" | \
+lsblk -Ml -o parttype,name,label | \
+grep -v 'SLKins_efi$' | \
+grep -iFe "$ESPGUID" -e "$OSTYPE" | \
sed "s,[^ ]*[ ]*,/dev/," > $TMP/SeTefipartitions
if [ ! -s $TMP/SeTefipartitions ]; then # No EFI partitions
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTconfig b/source/installer/sources/initrd/usr/lib/setup/SeTconfig
index 6731019bb..b51e991dc 100755
--- a/source/installer/sources/initrd/usr/lib/setup/SeTconfig
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTconfig
@@ -43,6 +43,10 @@ if [ ! "$T_PX" = "/" ]; then
mount --bind /proc $T_PX/proc 1> /dev/null 2> /dev/null
mount --bind /sys $T_PX/sys 1> /dev/null 2> /dev/null
mount --bind /dev $T_PX/dev 1> /dev/null 2> /dev/null
+ # Needed for EFI boot menu operations:
+ if [ -d /sys/firmware/efi/efivars ]; then
+ mount --bind /sys/firmware/efi/efivars $T_PX/sys/firmware/efi/efivars 1> /dev/null 2> /dev/null
+ fi
fi
# These will be left connected rather than unmounting them to
# make it easier to set up LVM/LUKS.
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTkeymap b/source/installer/sources/initrd/usr/lib/setup/SeTkeymap
index e8ac96396..ce1e6d778 100755
--- a/source/installer/sources/initrd/usr/lib/setup/SeTkeymap
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTkeymap
@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright 1993, 1999, 2002 Patrick Volkerding, Moorhead, MN.
-# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2023 Patrick J. Volkerding, Sebeka, MN, USA
# Use and redistribution covered by the same terms as the "setup" script.
TMP=/var/log/setup/tmp
RDIR=/dev/tty4
@@ -8,183 +8,30 @@ if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
while [ 0 ]; do
+
+# Construct the list of available keymaps:
+MAPLIST="$(cd /usr/share/kbd/keymaps/i386 ; find azerty bepo carpalx colemak dvorak fgGIod neo olpc qwerty qwertz | grep / | grep .map.gz$ | rev | cut -f 2- -d . | rev | less | sort | less | sed "s|^|\"|g" | sed "s|$|\" \"\" |g" | tr -d "\n")"
+
+cat << EOF > $TMP/select_keymap.sh
dialog --title "KEYBOARD MAP SELECTION" --menu "You may select one \
of the following keyboard maps. If you do not select a keyboard \
map, 'us.map' (the US keyboard map) is the default. Use the UP/DOWN \
arrow keys and PageUp/PageDown to scroll \
through the whole list of choices." \
22 55 11 \
-"qwerty/us.map" "" \
-"qwerty/uk.map" "" \
-"azerty/azerty.map" "" \
-"azerty/be-latin1.map" "" \
-"azerty/fr-latin0.map" "" \
-"azerty/fr-latin1.map" "" \
-"azerty/fr-latin9.map" "" \
-"azerty/fr-old.map" "" \
-"azerty/fr-pc.map" "" \
-"azerty/fr.map" "" \
-"azerty/wangbe.map" "" \
-"azerty/wangbe2.map" "" \
-"colemak/en-latin9.map" "" \
-"dvorak/ANSI-dvorak.map" "" \
-"dvorak/dvorak-fr.map" "" \
-"dvorak/dvorak-l.map" "" \
-"dvorak/dvorak-r.map" "" \
-"dvorak/dvorak.map" "" \
-"dvorak/no-dvorak.map" "" \
-"fgGIod/tr_f-latin5.map" "" \
-"fgGIod/trf-fgGIod.map" "" \
-"olpc/es-olpc.map" "" \
-"olpc/pt-olpc.map" "" \
-"qwerty/bashkir.map" "" \
-"qwerty/bg-cp1251.map" "" \
-"qwerty/bg-cp855.map" "" \
-"qwerty/bg_bds-cp1251.map" "" \
-"qwerty/bg_bds-utf8.map" "" \
-"qwerty/bg_pho-cp1251.map" "" \
-"qwerty/bg_pho-utf8.map" "" \
-"qwerty/br-abnt.map" "" \
-"qwerty/br-abnt2.map" "" \
-"qwerty/br-latin1-abnt2.map" "" \
-"qwerty/br-latin1-us.map" "" \
-"qwerty/by-cp1251.map" "" \
-"qwerty/by.map" "" \
-"qwerty/bywin-cp1251.map" "" \
-"qwerty/cf.map" "" \
-"qwerty/cz-cp1250.map" "" \
-"qwerty/cz-lat2-prog.map" "" \
-"qwerty/cz-lat2.map" "" \
-"qwerty/cz-qwerty.map" "" \
-"qwerty/defkeymap.map" "" \
-"qwerty/defkeymap_V1.0.map" "" \
-"qwerty/dk-latin1.map" "" \
-"qwerty/dk.map" "" \
-"qwerty/emacs.map" "" \
-"qwerty/emacs2.map" "" \
-"qwerty/es-cp850.map" "" \
-"qwerty/es.map" "" \
-"qwerty/et-nodeadkeys.map" "" \
-"qwerty/et.map" "" \
-"qwerty/fi-latin1.map" "" \
-"qwerty/fi-latin9.map" "" \
-"qwerty/fi-old.map" "" \
-"qwerty/fi.map" "" \
-"qwerty/gr-pc.map" "" \
-"qwerty/gr.map" "" \
-"qwerty/hu101.map" "" \
-"qwerty/il-heb.map" "" \
-"qwerty/il-phonetic.map" "" \
-"qwerty/il.map" "" \
-"qwerty/is-latin1-us.map" "" \
-"qwerty/is-latin1.map" "" \
-"qwerty/it-ibm.map" "" \
-"qwerty/it.map" "" \
-"qwerty/it2.map" "" \
-"qwerty/jp106.map" "" \
-"qwerty/kazakh.map" "" \
-"qwerty/ky_alt_sh-UTF-8.map" "" \
-"qwerty/kyrgyz.map" "" \
-"qwerty/la-latin1.map" "" \
-"qwerty/lt.baltic.map" "" \
-"qwerty/lt.l4.map" "" \
-"qwerty/lt.map" "" \
-"qwerty/mk-cp1251.map" "" \
-"qwerty/mk-utf.map" "" \
-"qwerty/mk.map" "" \
-"qwerty/mk0.map" "" \
-"qwerty/nl.map" "" \
-"qwerty/nl2.map" "" \
-"qwerty/no-latin1.map" "" \
-"qwerty/no.map" "" \
-"qwerty/pc110.map" "" \
-"qwerty/pl.map" "" \
-"qwerty/pl1.map" "" \
-"qwerty/pl2.map" "" \
-"qwerty/pl3.map" "" \
-"qwerty/pl4.map" "" \
-"qwerty/pt-latin1.map" "" \
-"qwerty/pt-latin9.map" "" \
-"qwerty/pt.map" "" \
-"qwerty/ro.map" "" \
-"qwerty/ro_std.map" "" \
-"qwerty/ru-cp1251.map" "" \
-"qwerty/ru-ms.map" "" \
-"qwerty/ru-yawerty.map" "" \
-"qwerty/ru.map" "" \
-"qwerty/ru1.map" "" \
-"qwerty/ru2.map" "" \
-"qwerty/ru3.map" "" \
-"qwerty/ru4.map" "" \
-"qwerty/ru_win.map" "" \
-"qwerty/ruwin_alt-CP1251.map" "" \
-"qwerty/ruwin_alt-KOI8-R.map" "" \
-"qwerty/ruwin_alt-UTF-8.map" "" \
-"qwerty/ruwin_cplk-CP1251.map" "" \
-"qwerty/ruwin_cplk-KOI8-R.map" "" \
-"qwerty/ruwin_cplk-UTF-8.map" "" \
-"qwerty/ruwin_ct_sh-CP1251.map" "" \
-"qwerty/ruwin_ct_sh-KOI8-R.map" "" \
-"qwerty/ruwin_ct_sh-UTF-8.map" "" \
-"qwerty/ruwin_ctrl-CP1251.map" "" \
-"qwerty/ruwin_ctrl-KOI8-R.map" "" \
-"qwerty/ruwin_ctrl-UTF-8.map" "" \
-"qwerty/se-fi-ir209.map" "" \
-"qwerty/se-fi-lat6.map" "" \
-"qwerty/se-ir209.map" "" \
-"qwerty/se-lat6.map" "" \
-"qwerty/se-latin1.map" "" \
-"qwerty/sk-prog-qwerty.map" "" \
-"qwerty/sk-qwerty.map" "" \
-"qwerty/speakup-jfw.map" "" \
-"qwerty/speakupmap.map" "" \
-"qwerty/sr-cy.map" "" \
-"qwerty/sv-latin1.map" "" \
-"qwerty/tj_alt-UTF8.map" "" \
-"qwerty/tr_q-latin5.map" "" \
-"qwerty/tralt.map" "" \
-"qwerty/trf.map" "" \
-"qwerty/trq.map" "" \
-"qwerty/ttwin_alt-UTF-8.map" "" \
-"qwerty/ttwin_cplk-UTF-8.map" "" \
-"qwerty/ttwin_ct_sh-UTF-8.map" "" \
-"qwerty/ttwin_ctrl-UTF-8.map" "" \
-"qwerty/ua-cp1251.map" "" \
-"qwerty/ua-utf-ws.map" "" \
-"qwerty/ua-utf.map" "" \
-"qwerty/ua-ws.map" "" \
-"qwerty/ua.map" "" \
-"qwerty/uk.map" "" \
-"qwerty/us-acentos.map" "" \
-"qwerty/us.map" "" \
-"qwertz/croat.map" "" \
-"qwertz/cz-us-qwertz.map" "" \
-"qwertz/cz.map" "" \
-"qwertz/de-latin1-nodeadkeys.map" "" \
-"qwertz/de-latin1.map" "" \
-"qwertz/de-mobii.map" "" \
-"qwertz/de.map" "" \
-"qwertz/de_CH-latin1.map" "" \
-"qwertz/de_alt_UTF-8.map" "" \
-"qwertz/fr_CH-latin1.map" "" \
-"qwertz/fr_CH.map" "" \
-"qwertz/hu.map" "" \
-"qwertz/sg-latin1-lk450.map" "" \
-"qwertz/sg-latin1.map" "" \
-"qwertz/sg.map" "" \
-"qwertz/sk-prog-qwertz.map" "" \
-"qwertz/sk-qwertz.map" "" \
-"qwertz/slovene.map" "" \
+"qwerty/us.map" "" "qwerty/uk.map" "" $MAPLIST \
2> $TMP/SeTkeymap
+EOF
+ sh $TMP/select_keymap.sh
if [ ! $? = 0 ]; then
- rm -f $TMP/SeTkeymap
+ rm -f $TMP/SeTkeymap $TMP/select_keymap.sh
exit
fi
- MAPNAME="`cat $TMP/SeTkeymap`"
- MAPNAME="`basename $MAPNAME`"
+ rm -f $TMP/select_keymap.sh
+ MAPNAME="$(cat $TMP/SeTkeymap)"
+ MAPNAME="$(basename $MAPNAME)"
echo $MAPNAME > $TMP/SeTkeymap
- BMAP="`basename $MAPNAME .map`.bmap"
- tar xzOf /etc/keymaps.tar.gz $BMAP > /dev/null && tar xzOf /etc/keymaps.tar.gz $BMAP | loadkmap
+ loadkeys -q $MAPNAME
while [ 0 ]; do
# Match the dialog colors a little while doing the keyboard test:
@@ -214,7 +61,7 @@ EOF
rm -f $TMP/$MAPNAME
rm -f $TMP/SeTkeymap $TMP/Pkeymap
# Clear bad selection:
- tar xzOf /etc/keymaps.tar.gz us.bmap > /dev/null && tar xzOf /etc/keymaps.tar.gz us.bmap | loadkmap
+ loadkeys -q us.map
continue;
fi
done
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTmedia b/source/installer/sources/initrd/usr/lib/setup/SeTmedia
index 65e05f4db..d42658c99 100755
--- a/source/installer/sources/initrd/usr/lib/setup/SeTmedia
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTmedia
@@ -1,9 +1,19 @@
-#!/bin/sh
+#!/bin/bash
TMP=/var/log/setup/tmp
if [ ! -d $TMP ]; then
mkdir -p $TMP
fi
+# Call the A-i-O (All-in-One Offline Installer) media handler.
+# This is for Slackware Installer images that contain a partition
+# labeled 'SLKins_aio' which holds the Slackware packages.
+# If a partition exists, passes the sanity checks and the user
+# wants to use the bundled media, we exit.
+# Otherwise, if the user creates a file named '/.no-allinone', the
+# the sanity checks fail or the user doesn't want to use the
+# media, we offer the set of options to select the source media.
+INS-all-in-one && exit 0
+
dialog --backtitle "Select Slackware installation source." \
--title "SOURCE MEDIA SELECTION" --menu \
"Please select the media from which to install Slackware Linux:" \
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTpasswd b/source/installer/sources/initrd/usr/lib/setup/SeTpasswd
index 967ffd2ed..16133c423 100755
--- a/source/installer/sources/initrd/usr/lib/setup/SeTpasswd
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTpasswd
@@ -13,9 +13,11 @@ time the machine is rebooted. This is especially important if you're \
using a network enabled kernel and the machine is on an Internet \
connected LAN. Would you like to set a root password?" 10 68
if [ $? = 0 ] ; then
+ clear
echo
echo
echo
+ echo "Setting password for 'root' user"
chroot $T_PX /usr/bin/passwd root
echo
echo -n "Press [enter] to continue:"
diff --git a/source/installer/sources/initrd/usr/lib/setup/pxesetup b/source/installer/sources/initrd/usr/lib/setup/pxesetup
index fb7831a39..7241b5c8c 100755
--- a/source/installer/sources/initrd/usr/lib/setup/pxesetup
+++ b/source/installer/sources/initrd/usr/lib/setup/pxesetup
@@ -40,12 +40,12 @@ export COLOR=on
# before the boot - perhaps the Slackware tree is on a local partition:
vgchange -ay 1> /dev/null 2> /dev/null
if probe -l 2> /dev/null | grep -E 'Linux$' 1> /dev/null 2> /dev/null ; then
- 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
fi
while [ 0 ]; do
- dialog --title "Slackware PXE Setup (version 13.37)" \
+ dialog --title "Slackware PXE Setup (version 15.1)" \
--menu \
"Welcome to Slackware PXE Setup.\n\
Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\
diff --git a/source/installer/sources/initrd/usr/lib/setup/setup b/source/installer/sources/initrd/usr/lib/setup/setup
index 5fc8a0e4b..6eb96dc3a 100755
--- a/source/installer/sources/initrd/usr/lib/setup/setup
+++ b/source/installer/sources/initrd/usr/lib/setup/setup
@@ -1,25 +1,25 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright 1993, 1994, 1999 Patrick Volkerding, Moorhead, Minnesota USA
# Copyright 2001, 2003, 2004 Slackware Linux, Inc., Concord, CA
-# Copyright 2006, 2007, 2018, 2021, 2022 Patrick Volkerding, Sebeka, Minnesota USA
+# Copyright 2006, 2007, 2018, 2021, 2022, 2023 Patrick Volkerding, Sebeka, Minnesota USA
# All rights reserved.
#
-# Redistribution and use of this script, with or without modification, is
+# 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
+# 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,
+# 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
+# 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.
#
# As always, bug reports, suggestions, etc: volkerdi@slackware.com
@@ -61,6 +61,10 @@ To do this, you'll need to leave 'setup', and make the partitions using \
information, read the 'setup' help file from the next menu." 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
dialog --title "NO EFI SYSTEM PARTITION DETECTED" \
--msgbox "This machine appears to be using EFI/UEFI, but no EFI System \
@@ -76,11 +80,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
@@ -100,7 +104,7 @@ mkdir /var/log/mount 2> /dev/null
while [ 0 ]; do
- dialog --title "Slackware Linux Setup (version 15.0)" \
+ dialog --title "Slackware Linux Setup (version 15.1)" \
--menu \
"Welcome to Slackware Linux Setup.\n\
Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\
@@ -336,9 +340,9 @@ to choose packages individually." 4 60
if [ "$MAINSELECT" = "CONFIGURE" ]; then
# 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
@@ -388,7 +392,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
@@ -436,6 +440,24 @@ if [ -f ${T_PX}/etc/fstab ]; then
"\nYou may now physically unplug the Slackware Installation Media USB stick from the USB port.\n" 8 60
}
+ # Prompt the user to unplug the bootable USB stick containing
+ # A-i-O (All in One Offline) partition.
+ mountpoint -q /slack-all-in-one && {
+ # Try to umount the A-i-O partition, but ignore any errors (errors would typically be
+ # occur if the user has a shell open within the USB stick's mount point), since
+ # we'll be shutting down soon anyway.
+ sync
+ umount /slack-all-in-one > /dev/null 2>&1
+ # Don't suggest disconnection if it's on ARM, because the A-i-O partition
+ # is on the same SD card that is converted from being the Installer to the
+ # OS's /boot partition.
+ [[ ! "$( uname -m )" =~ a(rm*|arch64) ]] && {
+ dialog \
+ --title "Unplug Slackware Installation USB Stick" \
+ --msgbox \
+ "\nYou may now physically unplug the Slackware Installation USB stick from the USB port.\n" 8 60 ;}
+ }
+
# Offer to reboot or drop to shell or power off.
exec 3>&1
installerexittype=$( dialog \