Add various patches for compatibility and improvements across multiple projects
- Introduced BSD tooling compatibility patch for Linux kernel, modifying header dependency handling and export checks in KVM. - Updated MLIR project to ensure generated headers are correctly located and dependencies are managed for various tools. - Enhanced ncurses configuration to support wide-character handling, ensuring proper header generation and compatibility. - Modified GNU parallel to use POSIX compliant shell, ensuring broader compatibility across different environments. - Fixed capability name handling in procps-ng by replacing echo with printf for better formatting. - Adjusted util-linux build system to support byacc alongside bison, improving parser generation and flexibility.
This commit is contained in:
@@ -0,0 +1,997 @@
|
||||
diff --git a/configure b/configure
|
||||
index 142d72b..b7a3d07 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
# We don't support srcdir != builddir
|
||||
echo \#buildapi-variable-no-builddir > /dev/null
|
||||
@@ -23,9 +23,9 @@ CC="${CC:-cc}"
|
||||
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
|
||||
|
||||
# set configprofile based on ID and ID_LIKE from os-release
|
||||
-if [[ -f /etc/os-release ]]; then
|
||||
+if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
-elif [[ -f /usr/lib/os-release ]]; then
|
||||
+elif [ -f /usr/lib/os-release ]; then
|
||||
. /usr/lib/os-release
|
||||
fi
|
||||
|
||||
@@ -51,19 +51,20 @@ read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
- local rematch='^[^=]*=(.*)$'
|
||||
- if [[ $2 =~ $rematch ]]; then
|
||||
- read -r "$1" <<< "${BASH_REMATCH[1]}"
|
||||
+ if [ "${2#*=}" != "$2" ]; then
|
||||
+ value=${2#*=}
|
||||
else
|
||||
- read -r "$1" <<< "$3"
|
||||
+ value=$3
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
+ eval "$1=\$value"
|
||||
return 1
|
||||
fi
|
||||
+ eval "$1=\$value"
|
||||
return 0
|
||||
}
|
||||
|
||||
-while (($# > 0)); do
|
||||
+while [ "$#" -gt 0 ]; do
|
||||
case "${1%%=*}" in
|
||||
--prefix) read_arg prefix "$@" || shift ;;
|
||||
--libdir) read_arg libdir "$@" || shift ;;
|
||||
@@ -98,7 +99,7 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if ! ${CC} -c -o /dev/null /dev/null &> /dev/null; then
|
||||
+if ! ${CC} -c -o /dev/null /dev/null > /dev/null 2>&1; then
|
||||
echo "dracut needs a C compiler (${CC} not found)." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -200,7 +201,7 @@ ret=$?
|
||||
rm -f weakdep_test.c a.out
|
||||
|
||||
if test $ret -eq 0; then
|
||||
- KMOD_CFLAGS_EXTRA+=" -DCONFIG_WEAKDEP"
|
||||
+ KMOD_CFLAGS_EXTRA="${KMOD_CFLAGS_EXTRA-} -DCONFIG_WEAKDEP"
|
||||
fi
|
||||
|
||||
cat > Makefile.inc.$$ << EOF
|
||||
@@ -225,16 +226,16 @@ SYSTEMD_LIBS ?= $(${PKG_CONFIG} --silence-errors --libs "libsystemd >= 257")
|
||||
EOF
|
||||
|
||||
{
|
||||
- [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
|
||||
- [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
|
||||
- [[ $includedir ]] && echo "includedir ?= ${includedir}"
|
||||
- [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
|
||||
- [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
|
||||
- [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
|
||||
- [[ $infodir ]] && echo "infodir ?= ${infodir}"
|
||||
- [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
|
||||
- [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
|
||||
- [[ $configprofile ]] && echo "configprofile ?= ${configprofile}"
|
||||
+ [ -n "$programprefix" ] && echo "programprefix ?= ${programprefix}"
|
||||
+ [ -n "$execprefix" ] && echo "execprefix ?= ${execprefix}"
|
||||
+ [ -n "$includedir" ] && echo "includedir ?= ${includedir}"
|
||||
+ [ -n "$libexecdir" ] && echo "libexecdir ?= ${libexecdir}"
|
||||
+ [ -n "$localstatedir" ] && echo "localstatedir ?= ${localstatedir}"
|
||||
+ [ -n "$sharedstatedir" ] && echo "sharedstatedir ?= ${sharedstatedir}"
|
||||
+ [ -n "$infodir" ] && echo "infodir ?= ${infodir}"
|
||||
+ [ -n "$systemdsystemunitdir" ] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
|
||||
+ [ -n "$bashcompletiondir" ] && echo "bashcompletiondir ?= ${bashcompletiondir}"
|
||||
+ [ -n "$configprofile" ] && echo "configprofile ?= ${configprofile}"
|
||||
} >> Makefile.inc.$$
|
||||
|
||||
mv Makefile.inc.$$ Makefile.inc
|
||||
diff --git a/dracut-catimages.sh b/dracut-catimages.sh
|
||||
index 608fb49..754894c 100755
|
||||
--- a/dracut-catimages.sh
|
||||
+++ b/dracut-catimages.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash --norc
|
||||
+#!/bin/sh
|
||||
#
|
||||
# Copyright 2009 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
@@ -17,7 +17,7 @@
|
||||
#
|
||||
|
||||
dinfo() {
|
||||
- [[ $beverbose ]] && echo "$@" >&2
|
||||
+ [ -n "$beverbose" ] && echo "$@" >&2
|
||||
}
|
||||
|
||||
derror() {
|
||||
@@ -47,7 +47,7 @@ EOF
|
||||
imagedir=/var/lib/dracut/images
|
||||
overlay=/var/lib/dracut/overlay
|
||||
|
||||
-while (($# > 0)); do
|
||||
+while [ "$#" -gt 0 ]; do
|
||||
case $1 in
|
||||
-f | --force) force=yes ;;
|
||||
-i | --imagedir)
|
||||
@@ -83,7 +83,7 @@ done
|
||||
outfile=$1
|
||||
shift
|
||||
|
||||
-if [[ -z $outfile ]]; then
|
||||
+if [ -z "$outfile" ]; then
|
||||
derror "No output file specified."
|
||||
usage
|
||||
exit 1
|
||||
@@ -92,32 +92,32 @@ fi
|
||||
baseimage=$1
|
||||
shift
|
||||
|
||||
-if [[ -z $baseimage ]]; then
|
||||
+if [ -z "$baseimage" ]; then
|
||||
derror "No base image specified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ -f $outfile && ! $force ]]; then
|
||||
+if [ -f "$outfile" ] && [ -z "$force" ]; then
|
||||
derror "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ ! $no_imagedir && ! -d $imagedir ]]; then
|
||||
+if [ -z "$no_imagedir" ] && [ ! -d "$imagedir" ]; then
|
||||
derror "Image directory $imagedir is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ ! $no_overlay && ! -d $overlay ]]; then
|
||||
+if [ -z "$no_overlay" ] && [ ! -d "$overlay" ]; then
|
||||
derror "Overlay $overlay is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ ! $no_overlay ]]; then
|
||||
- if [[ ! $no_imagedir ]]; then
|
||||
+if [ -z "$no_overlay" ]; then
|
||||
+ if [ -z "$no_imagedir" ]; then
|
||||
ofile="$imagedir/90-overlay.img"
|
||||
dinfo "Creating image $ofile from directory $overlay"
|
||||
- type pigz &> /dev/null && gzip=pigz || gzip=gzip
|
||||
+ command -v pigz > /dev/null 2>&1 && gzip=pigz || gzip=gzip
|
||||
(
|
||||
cd "$overlay" || return 1
|
||||
find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
|
||||
@@ -127,18 +127,18 @@ if [[ ! $no_overlay ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
-if [[ ! $no_imagedir ]]; then
|
||||
+dinfo "Using base image $baseimage"
|
||||
+cat -- "$baseimage" > "$outfile"
|
||||
+
|
||||
+if [ -z "$no_imagedir" ]; then
|
||||
for i in "$imagedir/"*.img; do
|
||||
- [[ -f $i ]] && images+=("$i")
|
||||
+ [ -f "$i" ] || continue
|
||||
+ dinfo "Appending $i"
|
||||
+ cat -- "$i" >> "$outfile"
|
||||
done
|
||||
fi
|
||||
|
||||
-images+=("$@")
|
||||
-
|
||||
-dinfo "Using base image $baseimage"
|
||||
-cat -- "$baseimage" > "$outfile"
|
||||
-
|
||||
-for i in "${images[@]}"; do
|
||||
+for i in "$@"; do
|
||||
dinfo "Appending $i"
|
||||
cat -- "$i" >> "$outfile"
|
||||
done
|
||||
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
|
||||
index 828edca..1e82422 100755
|
||||
--- a/dracut-initramfs-restore.sh
|
||||
+++ b/dracut-initramfs-restore.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -13,19 +13,18 @@ trap 'echo "Received SIGTERM signal, ignoring!" >&2' TERM
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
-[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
+[ -n "$dracutbasedir" ] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
-[[ -x $SKIP ]] || SKIP="cat"
|
||||
+[ -x "$SKIP" ] || SKIP="cat"
|
||||
|
||||
find_initrd_for_kernel_version() {
|
||||
- local kernel_version="$1"
|
||||
- local base_path files initrd machine_id
|
||||
+ kernel_version=$1
|
||||
|
||||
- if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
|
||||
+ if [ -d /efi/Default ] || [ -d /boot/Default ] || [ -d /boot/efi/Default ]; then
|
||||
machine_id="Default"
|
||||
- elif [[ -s /etc/machine-id ]]; then
|
||||
+ elif [ -s /etc/machine-id ]; then
|
||||
read -r machine_id < /etc/machine-id
|
||||
- [[ $machine_id == "uninitialized" ]] && machine_id="Default"
|
||||
+ [ "$machine_id" = "uninitialized" ] && machine_id="Default"
|
||||
else
|
||||
machine_id="Default"
|
||||
fi
|
||||
@@ -40,27 +39,26 @@ find_initrd_for_kernel_version() {
|
||||
done
|
||||
fi
|
||||
|
||||
- if [[ -f /lib/modules/${kernel_version}/initrd ]]; then
|
||||
+ if [ -f "/lib/modules/${kernel_version}/initrd" ]; then
|
||||
echo "/lib/modules/${kernel_version}/initrd"
|
||||
- elif [[ -f /boot/initramfs-${kernel_version}.img ]]; then
|
||||
+ elif [ -f "/boot/initramfs-${kernel_version}.img" ]; then
|
||||
echo "/boot/initramfs-${kernel_version}.img"
|
||||
else
|
||||
- files=(/boot/initr*"${kernel_version}"*)
|
||||
- if [ "${#files[@]}" -ge 1 ] && [ -e "${files[0]}" ]; then
|
||||
- echo "${files[0]}"
|
||||
- fi
|
||||
+ for initrd in /boot/initr*"${kernel_version}"*; do
|
||||
+ [ -e "$initrd" ] && echo "$initrd" && return
|
||||
+ done
|
||||
fi
|
||||
}
|
||||
|
||||
-mount -o ro /boot &> /dev/null || true
|
||||
+mount -o ro /boot > /dev/null 2>&1 || true
|
||||
|
||||
IMG=$(find_initrd_for_kernel_version "$KERNEL_VERSION")
|
||||
if [ -z "$IMG" ]; then
|
||||
- if [[ -f /boot/initramfs-linux.img ]]; then
|
||||
+ if [ -f /boot/initramfs-linux.img ]; then
|
||||
IMG="/boot/initramfs-linux.img"
|
||||
- elif [[ -f /boot/initrd.img ]]; then
|
||||
+ elif [ -f /boot/initrd.img ]; then
|
||||
IMG="/boot/initrd.img"
|
||||
- elif [[ -f /initrd.img ]]; then
|
||||
+ elif [ -f /initrd.img ]; then
|
||||
IMG="/initrd.img"
|
||||
else
|
||||
echo "No initramfs image found to restore!"
|
||||
@@ -85,13 +83,13 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ -f squashfs-root.img ]]; then
|
||||
+if [ -f squashfs-root.img ]; then
|
||||
if ! unsquashfs -no-xattrs -f -d . squashfs-root.img > /dev/null; then
|
||||
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
|
||||
rm -f -- /run/initramfs/shutdown
|
||||
exit 1
|
||||
fi
|
||||
-elif [[ -f erofs-root.img ]]; then
|
||||
+elif [ -f erofs-root.img ]; then
|
||||
if ! fsck.erofs --extract=. --overwrite erofs-root.img > /dev/null; then
|
||||
echo "Squash module is enabled for this initramfs but failed to unpack erofs-root.img" >&2
|
||||
rm -f -- /run/initramfs/shutdown
|
||||
@@ -102,7 +100,7 @@ fi
|
||||
if grep -qs -w selinux /sys/kernel/security/lsm \
|
||||
&& [ -e /etc/selinux/config ] && [ -x /usr/sbin/setfiles ]; then
|
||||
. /etc/selinux/config
|
||||
- if [[ $SELINUX != "disabled" && -n $SELINUXTYPE ]]; then
|
||||
+ if [ "$SELINUX" != "disabled" ] && [ -n "$SELINUXTYPE" ]; then
|
||||
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
|
||||
fi
|
||||
fi
|
||||
diff --git a/install.d/50-dracut.install b/install.d/50-dracut.install
|
||||
index 14f8772..6865ac8 100755
|
||||
--- a/install.d/50-dracut.install
|
||||
+++ b/install.d/50-dracut.install
|
||||
@@ -1,4 +1,6 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
+
|
||||
+set -f
|
||||
|
||||
COMMAND="${1:?}"
|
||||
KERNEL_VERSION="${2:?}"
|
||||
@@ -7,16 +9,16 @@ BOOT_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
# If the initrd was provided on the kernel command line, we shouldn't generate our own.
|
||||
-if [[ "$COMMAND" != "add" || "$#" -gt 4 ]]; then
|
||||
+if [ "$COMMAND" != "add" ] || [ "$#" -gt 4 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Do not attempt to create initramfs if the supplied image is already a UKI
|
||||
-if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||
+if [ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-if [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" = "dracut" ]]; then
|
||||
+if [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" = "dracut" ]; then
|
||||
# We are the initrd generator
|
||||
IMAGE="initrd"
|
||||
UEFI_OPTS="--no-uefi"
|
||||
@@ -24,16 +26,16 @@ else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then
|
||||
+if [ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]; then
|
||||
# We are chosen to generate the UKI as well as initrd
|
||||
IMAGE="uki.efi"
|
||||
UEFI_OPTS="--uefi"
|
||||
fi
|
||||
|
||||
-if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then
|
||||
+if [ -f "${KERNEL_IMAGE%/*}/$IMAGE" ]; then
|
||||
# we found an initrd or uki.efi at the same place as the kernel
|
||||
# use this and don't generate a new one
|
||||
- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \
|
||||
+ [ "$KERNEL_INSTALL_VERBOSE" = 1 ] && echo \
|
||||
"There is an $IMAGE image at the same place as the kernel, skipping generating a new one"
|
||||
cp --reflink=auto "${KERNEL_IMAGE%/*}/$IMAGE" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
|
||||
&& chown root:root "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" \
|
||||
@@ -42,38 +44,39 @@ if [[ -f ${KERNEL_IMAGE%/*}/$IMAGE ]]; then
|
||||
fi
|
||||
|
||||
if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
|
||||
- if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||
- fi
|
||||
-elif [[ -f /etc/kernel/cmdline ]]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
-elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
+ cmdline="$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||
+elif [ -f /etc/kernel/cmdline ]; then
|
||||
+ cmdline=/etc/kernel/cmdline
|
||||
+elif [ -f /usr/lib/kernel/cmdline ]; then
|
||||
+ cmdline=/usr/lib/kernel/cmdline
|
||||
else
|
||||
- declare -a BOOT_OPTIONS
|
||||
+ cmdline=/proc/cmdline
|
||||
+fi
|
||||
|
||||
- read -r -d '' -a line < /proc/cmdline
|
||||
- for i in "${line[@]}"; do
|
||||
- [[ ${i#initrd=*} != "$i" ]] && continue
|
||||
- BOOT_OPTIONS+=("$i")
|
||||
+BOOT_OPTIONS=
|
||||
+if [ -f "$cmdline" ]; then
|
||||
+ for i in $(cat "$cmdline"); do
|
||||
+ case $i in
|
||||
+ initrd=*) ;;
|
||||
+ *) BOOT_OPTIONS="${BOOT_OPTIONS}${BOOT_OPTIONS:+ }$i" ;;
|
||||
+ esac
|
||||
done
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
||||
-for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
|
||||
- # shellcheck disable=SC1001
|
||||
- if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
|
||||
+for i in $BOOT_OPTIONS; do
|
||||
+ case $i in
|
||||
+ root=PARTUUID=*)
|
||||
noimageifnotneeded="yes"
|
||||
break
|
||||
- fi
|
||||
+ ;;
|
||||
+ esac
|
||||
done
|
||||
|
||||
-# shellcheck disable=SC2046
|
||||
-dracut -f \
|
||||
- ${noimageifnotneeded:+--noimageifnotneeded} \
|
||||
- $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
|
||||
- $([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \
|
||||
- "$UEFI_OPTS" \
|
||||
- --kver "$KERNEL_VERSION" \
|
||||
- "$KERNEL_INSTALL_STAGING_AREA/$IMAGE" || exit 1
|
||||
+set -- dracut -f
|
||||
+[ -n "$noimageifnotneeded" ] && set -- "$@" --noimageifnotneeded
|
||||
+[ "$KERNEL_INSTALL_VERBOSE" = 1 ] && set -- "$@" --verbose
|
||||
+[ -n "$KERNEL_IMAGE" ] && set -- "$@" --kernel-image "$KERNEL_IMAGE"
|
||||
+set -- "$@" "$UEFI_OPTS" --kver "$KERNEL_VERSION" "$KERNEL_INSTALL_STAGING_AREA/$IMAGE"
|
||||
+"$@" || exit 1
|
||||
diff --git a/install.d/51-dracut-rescue.install b/install.d/51-dracut-rescue.install
|
||||
index f49d7a7..701e5e8 100755
|
||||
--- a/install.d/51-dracut-rescue.install
|
||||
+++ b/install.d/51-dracut-rescue.install
|
||||
@@ -1,6 +1,7 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
export LANG=C
|
||||
+set -f
|
||||
|
||||
COMMAND="${1:?}"
|
||||
KERNEL_VERSION="${2:?}"
|
||||
@@ -8,19 +9,19 @@ BOOT_DIR_ABS="${3%/*}/0-rescue"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
# If the initrd was provided on the kernel command line, we shouldn't generate our own.
|
||||
-if [[ "$COMMAND" = "add" && "$#" -gt 4 ]]; then
|
||||
+if [ "$COMMAND" = "add" ] && [ "$#" -gt 4 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Do not attempt to create initramfs if the supplied image is already a UKI
|
||||
-if [[ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]]; then
|
||||
+if [ "$KERNEL_INSTALL_IMAGE_TYPE" = "uki" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-if [[ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]]; then
|
||||
+if [ "$KERNEL_INSTALL_UKI_GENERATOR" = "dracut" ]; then
|
||||
# Rescue images currently not compatible with UKIs
|
||||
exit 0
|
||||
-elif [[ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]]; then
|
||||
+elif [ "${KERNEL_INSTALL_INITRD_GENERATOR:-dracut}" != "dracut" ]; then
|
||||
# We are not the initrd generator
|
||||
exit 0
|
||||
fi
|
||||
@@ -28,19 +29,17 @@ fi
|
||||
dropindirs_sort() {
|
||||
suffix=$1
|
||||
shift
|
||||
- args=("$@")
|
||||
files=$(
|
||||
- while (($# > 0)); do
|
||||
- for i in "${1}"/*"${suffix}"; do
|
||||
- [[ -f $i ]] && echo "${i##*/}"
|
||||
+ for d in "$@"; do
|
||||
+ for i in "$d"/*"${suffix}"; do
|
||||
+ [ -f "$i" ] && echo "${i##*/}"
|
||||
done
|
||||
- shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
- for d in "${args[@]}"; do
|
||||
- if [[ -f "$d/$f" ]]; then
|
||||
+ for d in "$@"; do
|
||||
+ if [ -f "$d/$f" ]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
@@ -48,43 +47,45 @@ dropindirs_sort() {
|
||||
done
|
||||
}
|
||||
|
||||
-if [[ -f /etc/os-release ]]; then
|
||||
+if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
-elif [[ -f /usr/lib/os-release ]]; then
|
||||
+elif [ -f /usr/lib/os-release ]; then
|
||||
. /usr/lib/os-release
|
||||
fi
|
||||
|
||||
-[[ -n $PRETTY_NAME ]] || PRETTY_NAME="Linux $KERNEL_VERSION"
|
||||
+[ -n "$PRETTY_NAME" ] || PRETTY_NAME="Linux $KERNEL_VERSION"
|
||||
|
||||
-if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
|
||||
+if [ "${KERNEL_INSTALL_MACHINE_ID+x}" ]; then
|
||||
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
|
||||
-elif [[ -f /etc/machine-id ]]; then
|
||||
+elif [ -f /etc/machine-id ]; then
|
||||
read -r MACHINE_ID < /etc/machine-id
|
||||
fi
|
||||
|
||||
-if ! [[ $MACHINE_ID ]]; then
|
||||
+if [ -z "$MACHINE_ID" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
|
||||
- if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||
- fi
|
||||
-elif [[ -f /etc/kernel/cmdline ]]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
-elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
- read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
+ cmdline="$KERNEL_INSTALL_CONF_ROOT/cmdline"
|
||||
+elif [ -f /etc/kernel/cmdline ]; then
|
||||
+ cmdline=/etc/kernel/cmdline
|
||||
+elif [ -f /usr/lib/kernel/cmdline ]; then
|
||||
+ cmdline=/usr/lib/kernel/cmdline
|
||||
else
|
||||
- declare -a BOOT_OPTIONS
|
||||
+ cmdline=/proc/cmdline
|
||||
+fi
|
||||
|
||||
- read -r -d '' -a line < /proc/cmdline
|
||||
- for i in "${line[@]}"; do
|
||||
- [[ ${i#initrd=*} != "$i" ]] && continue
|
||||
- BOOT_OPTIONS+=("$i")
|
||||
+BOOT_OPTIONS=
|
||||
+if [ -f "$cmdline" ]; then
|
||||
+ for i in $(cat "$cmdline"); do
|
||||
+ case $i in
|
||||
+ initrd=*) ;;
|
||||
+ *) BOOT_OPTIONS="${BOOT_OPTIONS}${BOOT_OPTIONS:+ }$i" ;;
|
||||
+ esac
|
||||
done
|
||||
fi
|
||||
|
||||
-if [[ -d ${BOOT_DIR_ABS%/*} ]]; then
|
||||
+if [ -d "${BOOT_DIR_ABS%/*}" ]; then
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%"$BOOT_DIR"}
|
||||
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
|
||||
@@ -102,55 +103,53 @@ ret=0
|
||||
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
- if [[ -f $LOADER_ENTRY ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
|
||||
- && [[ -f "$BOOT_DIR_ABS/$INITRD" ]]; then
|
||||
- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] \
|
||||
+ if [ -f "$LOADER_ENTRY" ] && [ -f "$BOOT_DIR_ABS/$KERNEL" ] \
|
||||
+ && [ -f "$BOOT_DIR_ABS/$INITRD" ]; then
|
||||
+ [ "$KERNEL_INSTALL_VERBOSE" = 1 ] \
|
||||
&& echo "Skipping, there is already a rescue image generated with the same input parameters"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# source our config dir
|
||||
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d" "/run/initramfs/dracut.conf.d"); do
|
||||
- if [[ -e $f ]]; then
|
||||
+ if [ -e "$f" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
- if [[ $dracut_rescue_image != "yes" ]]; then
|
||||
- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] \
|
||||
+ if [ "$dracut_rescue_image" != "yes" ]; then
|
||||
+ [ "$KERNEL_INSTALL_VERBOSE" = 1 ] \
|
||||
&& echo "Skipping, 'dracut_rescue_image' not set to 'yes' in any dracut configuration file"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
- [[ -d $BOOT_DIR_ABS ]] || mkdir -p "$BOOT_DIR_ABS"
|
||||
+ [ -d "$BOOT_DIR_ABS" ] || mkdir -p "$BOOT_DIR_ABS"
|
||||
|
||||
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
|
||||
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
|
||||
fi
|
||||
|
||||
- if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
|
||||
- # shellcheck disable=SC2046
|
||||
- dracut -f \
|
||||
- --add-confdir rescue \
|
||||
- $([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
|
||||
- --kver "$KERNEL_VERSION" \
|
||||
- "$BOOT_DIR_ABS/$INITRD"
|
||||
- ((ret += $?))
|
||||
+ if [ ! -f "$BOOT_DIR_ABS/$INITRD" ]; then
|
||||
+ set -- dracut -f --add-confdir rescue
|
||||
+ [ "$KERNEL_INSTALL_VERBOSE" = 1 ] && set -- "$@" --verbose
|
||||
+ set -- "$@" --kver "$KERNEL_VERSION" "$BOOT_DIR_ABS/$INITRD"
|
||||
+ "$@"
|
||||
+ ret=$((ret + $?))
|
||||
fi
|
||||
|
||||
- [[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo "Creating $LOADER_ENTRY"
|
||||
- if [[ ${BOOT_DIR_ABS} != "/boot" ]]; then
|
||||
+ [ "$KERNEL_INSTALL_VERBOSE" = 1 ] && echo "Creating $LOADER_ENTRY"
|
||||
+ if [ "$BOOT_DIR_ABS" != "/boot" ]; then
|
||||
{
|
||||
echo "title $PRETTY_NAME - Rescue Image"
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
- echo "options ${BOOT_OPTIONS[*]}"
|
||||
+ echo "options $BOOT_OPTIONS"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "initrd $BOOT_DIR/initrd"
|
||||
} > "$LOADER_ENTRY"
|
||||
else
|
||||
- if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
|
||||
+ if [ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]; then
|
||||
cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" "$LOADER_ENTRY"
|
||||
else
|
||||
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" "$LOADER_ENTRY"
|
||||
@@ -158,7 +157,7 @@ case "$COMMAND" in
|
||||
sed -i "s/${KERNEL_VERSION}/0-rescue-${MACHINE_ID}/" "$LOADER_ENTRY"
|
||||
fi
|
||||
|
||||
- ((ret += $?))
|
||||
+ ret=$((ret + $?))
|
||||
;;
|
||||
|
||||
remove)
|
||||
diff --git a/modules.d/45net-lib/net-lib.sh b/modules.d/45net-lib/net-lib.sh
|
||||
index a0b8740..5365c2d 100755
|
||||
--- a/modules.d/45net-lib/net-lib.sh
|
||||
+++ b/modules.d/45net-lib/net-lib.sh
|
||||
@@ -756,7 +756,7 @@ linkup() {
|
||||
wait_for_if_link "$@" 2> /dev/null && ip link set "$@" up 2> /dev/null && wait_for_if_up "$@" 2> /dev/null
|
||||
}
|
||||
|
||||
-type hostname > /dev/null 2>&1 \
|
||||
+command -v hostname > /dev/null 2>&1 \
|
||||
|| hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
diff --git a/modules.d/45plymouth/plymouth-newroot.sh b/modules.d/45plymouth/plymouth-newroot.sh
|
||||
index 29c56e9..7409dee 100755
|
||||
--- a/modules.d/45plymouth/plymouth-newroot.sh
|
||||
+++ b/modules.d/45plymouth/plymouth-newroot.sh
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
-if type plymouth > /dev/null 2>&1 && [ -z "${DRACUT_SYSTEMD-}" ]; then
|
||||
+if command -v plymouth > /dev/null 2>&1 && [ -z "${DRACUT_SYSTEMD-}" ]; then
|
||||
plymouth --newroot="$NEWROOT"
|
||||
fi
|
||||
diff --git a/modules.d/45plymouth/plymouth-pretrigger.sh b/modules.d/45plymouth/plymouth-pretrigger.sh
|
||||
index 869a119..b28b4f5 100755
|
||||
--- a/modules.d/45plymouth/plymouth-pretrigger.sh
|
||||
+++ b/modules.d/45plymouth/plymouth-pretrigger.sh
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
-if type plymouthd > /dev/null 2>&1 && [ -z "${DRACUT_SYSTEMD-}" ]; then
|
||||
+if command -v plymouthd > /dev/null 2>&1 && [ -z "${DRACUT_SYSTEMD-}" ]; then
|
||||
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth; then
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --action=add --attr-match=class=0x030000 > /dev/null 2>&1
|
||||
diff --git a/modules.d/70crypt-lib/crypt-lib.sh b/modules.d/70crypt-lib/crypt-lib.sh
|
||||
index 82a672f..c065d7e 100755
|
||||
--- a/modules.d/70crypt-lib/crypt-lib.sh
|
||||
+++ b/modules.d/70crypt-lib/crypt-lib.sh
|
||||
@@ -106,7 +106,7 @@ ask_for_password() {
|
||||
{
|
||||
flock -s 9
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
- if type plymouth > /dev/null 2>&1 && plymouth --ping 2> /dev/null; then
|
||||
+ if command -v plymouth > /dev/null 2>&1 && plymouth --ping 2> /dev/null; then
|
||||
plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries="$ply_tries" \
|
||||
--command="$ply_cmd"
|
||||
diff --git a/modules.d/70dmsquash-live/dmsquash-live-root.sh b/modules.d/70dmsquash-live/dmsquash-live-root.sh
|
||||
index 3702a91..93b6f45 100755
|
||||
--- a/modules.d/70dmsquash-live/dmsquash-live-root.sh
|
||||
+++ b/modules.d/70dmsquash-live/dmsquash-live-root.sh
|
||||
@@ -73,7 +73,7 @@ if [ ! -f "$livedev" ]; then
|
||||
fi
|
||||
getarg rd.live.check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
- type plymouth > /dev/null 2>&1 && plymouth --hide-splash
|
||||
+ command -v plymouth > /dev/null 2>&1 && plymouth --hide-splash
|
||||
if [ -n "${DRACUT_SYSTEMD-}" ]; then
|
||||
p=$(dev_unit_name "$check_dev")
|
||||
systemctl start checkisomd5@"${p}".service
|
||||
@@ -86,7 +86,7 @@ if [ ! -f "$livedev" ]; then
|
||||
die "Media check failed!"
|
||||
exit 1
|
||||
fi
|
||||
- type plymouth > /dev/null 2>&1 && plymouth --show-splash
|
||||
+ command -v plymouth > /dev/null 2>&1 && plymouth --show-splash
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -234,7 +234,7 @@ do_live_overlay() {
|
||||
Press [Enter] to continue.'
|
||||
printf "\n\n\n\n%s\n\n\n" "${m}" > /dev/kmsg
|
||||
if [ -n "${DRACUT_SYSTEMD-}" ]; then
|
||||
- if type plymouth > /dev/null 2>&1 && plymouth --ping; then
|
||||
+ if command -v plymouth > /dev/null 2>&1 && plymouth --ping; then
|
||||
if getargbool 0 rhgb || getargbool 0 splash; then
|
||||
m='>>>
|
||||
>>>
|
||||
@@ -257,7 +257,7 @@ do_live_overlay() {
|
||||
systemd-ask-password --timeout=0 "${m}"
|
||||
fi
|
||||
else
|
||||
- type plymouth > /dev/null 2>&1 && plymouth --ping && plymouth --quit
|
||||
+ command -v plymouth > /dev/null 2>&1 && plymouth --ping && plymouth --quit
|
||||
printf '\n\n%s' "$m"
|
||||
read -r _
|
||||
fi
|
||||
diff --git a/modules.d/70fs-lib/fs-lib.sh b/modules.d/70fs-lib/fs-lib.sh
|
||||
index e11f3c1..a450aa5 100755
|
||||
--- a/modules.d/70fs-lib/fs-lib.sh
|
||||
+++ b/modules.d/70fs-lib/fs-lib.sh
|
||||
@@ -43,17 +43,17 @@ fsck_able() {
|
||||
return 1
|
||||
;;
|
||||
ext?)
|
||||
- type e2fsck > /dev/null 2>&1 \
|
||||
+ command -v e2fsck > /dev/null 2>&1 \
|
||||
&& _drv="fsck_drv_com e2fsck" \
|
||||
&& return 0
|
||||
;;
|
||||
f2fs)
|
||||
- type fsck.f2fs > /dev/null 2>&1 \
|
||||
+ command -v fsck.f2fs > /dev/null 2>&1 \
|
||||
&& _drv="fsck_drv_com fsck.f2fs" \
|
||||
&& return 0
|
||||
;;
|
||||
jfs)
|
||||
- type jfs_fsck > /dev/null 2>&1 \
|
||||
+ command -v jfs_fsck > /dev/null 2>&1 \
|
||||
&& _drv="fsck_drv_com jfs_fsck" \
|
||||
&& return 0
|
||||
;;
|
||||
@@ -69,7 +69,7 @@ fsck_able() {
|
||||
&& return 0
|
||||
;;
|
||||
*)
|
||||
- type fsck > /dev/null 2>&1 \
|
||||
+ command -v fsck > /dev/null 2>&1 \
|
||||
&& _drv="fsck_drv_std fsck" \
|
||||
&& return 0
|
||||
;;
|
||||
@@ -250,7 +250,7 @@ write_fs_tab() {
|
||||
return
|
||||
fi
|
||||
|
||||
- if type systemctl > /dev/null 2> /dev/null; then
|
||||
+ if command -v systemctl > /dev/null 2> /dev/null; then
|
||||
systemctl daemon-reload
|
||||
systemctl --no-block start initrd-root-fs.target
|
||||
fi
|
||||
diff --git a/modules.d/70livenet/livenet-generator.sh b/modules.d/70livenet/livenet-generator.sh
|
||||
index 45a4001..c79321b 100755
|
||||
--- a/modules.d/70livenet/livenet-generator.sh
|
||||
+++ b/modules.d/70livenet/livenet-generator.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
command -v getarg > /dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
@@ -74,7 +74,7 @@ ROOTFLAGS="$(getarg rootflags)"
|
||||
else
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
- _dev=$'dev-mapper-live\\x2drw'
|
||||
+ _dev='dev-mapper-live\x2drw'
|
||||
fi
|
||||
} > "$GENERATOR_DIR"/sysroot.mount
|
||||
|
||||
diff --git a/modules.d/70livenet/module-setup.sh b/modules.d/70livenet/module-setup.sh
|
||||
index 3ec6baf..9465213 100755
|
||||
--- a/modules.d/70livenet/module-setup.sh
|
||||
+++ b/modules.d/70livenet/module-setup.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
# module-setup.sh for livenet
|
||||
|
||||
# called by dracut
|
||||
@@ -8,7 +8,7 @@ check() {
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
- echo network url-lib dmsquash-live img-lib bash initqueue
|
||||
+ echo network url-lib dmsquash-live img-lib initqueue
|
||||
return 0
|
||||
}
|
||||
|
||||
diff --git a/modules.d/73zipl/install_zipl_cmdline.sh b/modules.d/73zipl/install_zipl_cmdline.sh
|
||||
index 1a666da..59af087 100755
|
||||
--- a/modules.d/73zipl/install_zipl_cmdline.sh
|
||||
+++ b/modules.d/73zipl/install_zipl_cmdline.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
DEV="$1"
|
||||
MNT=/boot/zipl
|
||||
@@ -22,7 +22,7 @@ if [ -f ${MNT}/dracut-cmdline.conf ]; then
|
||||
fi
|
||||
|
||||
if [ -f ${MNT}/active_devices.txt ]; then
|
||||
- while read -r dev _ || [[ $dev ]]; do
|
||||
+ while read -r dev _ || [ -n "$dev" ]; do
|
||||
[ "$dev" = "#" ] || [ "$dev" = "" ] && continue
|
||||
cio_ignore -r "$dev"
|
||||
done < ${MNT}/active_devices.txt
|
||||
diff --git a/modules.d/73zipl/module-setup.sh b/modules.d/73zipl/module-setup.sh
|
||||
index 2772ec6..b1facb3 100755
|
||||
--- a/modules.d/73zipl/module-setup.sh
|
||||
+++ b/modules.d/73zipl/module-setup.sh
|
||||
@@ -1,9 +1,8 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
get_boot_zipl_dev() {
|
||||
- local _boot_zipl
|
||||
_boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' "${dracutsysrootdir-}"/etc/fstab)
|
||||
printf "%s" "$(trim "$_boot_zipl")"
|
||||
}
|
||||
@@ -19,13 +18,11 @@ check() {
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
- echo bash initqueue
|
||||
+ echo initqueue
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
- local _boot_zipl
|
||||
-
|
||||
_boot_zipl=$(get_boot_zipl_dev)
|
||||
if [ -n "$_boot_zipl" ]; then
|
||||
eval "$(blkid -s TYPE -o udev "${_boot_zipl}")"
|
||||
@@ -42,8 +39,6 @@ installkernel() {
|
||||
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
- local _boot_zipl
|
||||
-
|
||||
_boot_zipl=$(get_boot_zipl_dev)
|
||||
if [ -n "$_boot_zipl" ]; then
|
||||
printf "%s" " rd.zipl=${_boot_zipl}"
|
||||
@@ -56,10 +51,9 @@ install() {
|
||||
|
||||
inst_hook cmdline 91 "$moddir/parse-zipl.sh"
|
||||
inst_script "${moddir}/install_zipl_cmdline.sh" /sbin/install_zipl_cmdline.sh
|
||||
- if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
- local _zipl
|
||||
+ if [ "$hostonly_cmdline" = "yes" ]; then
|
||||
_zipl=$(cmdline)
|
||||
|
||||
- [[ $_zipl ]] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/19-zipl.conf"
|
||||
+ [ -n "$_zipl" ] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/19-zipl.conf"
|
||||
fi
|
||||
}
|
||||
diff --git a/modules.d/74znet/module-setup.sh b/modules.d/74znet/module-setup.sh
|
||||
index 6c340a6..59ef3a2 100755
|
||||
--- a/modules.d/74znet/module-setup.sh
|
||||
+++ b/modules.d/74znet/module-setup.sh
|
||||
@@ -11,7 +11,6 @@ check() {
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
- echo bash
|
||||
return 0
|
||||
}
|
||||
|
||||
diff --git a/modules.d/74znet/parse-ccw.sh b/modules.d/74znet/parse-ccw.sh
|
||||
index acdd63e..473e355 100755
|
||||
--- a/modules.d/74znet/parse-ccw.sh
|
||||
+++ b/modules.d/74znet/parse-ccw.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
znet_base_args="--no-settle --yes --no-root-update --force"
|
||||
|
||||
@@ -48,14 +48,25 @@ for ccw_arg in $(getargs rd.znet); do
|
||||
done
|
||||
|
||||
for ifname in $(getargs rd.znet_ifname); do
|
||||
- IFS=: read -r ifname_if ifname_subchannels _rest <<< "$ifname"
|
||||
+ ifname_if=${ifname%%:*}
|
||||
+ ifname_subchannels=${ifname#*:}
|
||||
+ if [ "$ifname_subchannels" = "$ifname" ]; then
|
||||
+ _rest=invalid
|
||||
+ else
|
||||
+ _rest=${ifname_subchannels#*:}
|
||||
+ if [ "$_rest" = "$ifname_subchannels" ]; then
|
||||
+ _rest=
|
||||
+ else
|
||||
+ ifname_subchannels=${ifname_subchannels%%:*}
|
||||
+ fi
|
||||
+ fi
|
||||
if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then
|
||||
warn "Invalid arguments for rd.znet_ifname="
|
||||
else
|
||||
{
|
||||
- ifname_subchannels="${ifname_subchannels//,/|}"
|
||||
+ ifname_subchannels=$(printf '%s' "$ifname_subchannels" | tr ',' '|')
|
||||
# sanitize for use in udev label: replace non-word characters by _
|
||||
- ifname_if_label="${ifname_if//[^[:word:]]/_}"
|
||||
+ ifname_if_label=$(printf '%s' "$ifname_if" | sed 's/[^[:alnum:]_]/_/g')
|
||||
|
||||
echo "ACTION!=\"add|change\", GOTO=\"ccw_ifname_${ifname_if_label}_end\""
|
||||
echo "ATTR{type}!=\"1\", GOTO=\"ccw_ifname_${ifname_if_label}_end\""
|
||||
diff --git a/modules.d/77dracut-systemd/dracut-emergency.sh b/modules.d/77dracut-systemd/dracut-emergency.sh
|
||||
index a427a8f..65f8232 100755
|
||||
--- a/modules.d/77dracut-systemd/dracut-emergency.sh
|
||||
+++ b/modules.d/77dracut-systemd/dracut-emergency.sh
|
||||
@@ -8,7 +8,7 @@ command -v getarg > /dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
-type plymouth > /dev/null 2>&1 && plymouth quit
|
||||
+command -v plymouth > /dev/null 2>&1 && plymouth quit
|
||||
|
||||
export _rdshell_name="dracut" action="Boot" hook="emergency"
|
||||
_emergency_action=$(getarg rd.emergency)
|
||||
diff --git a/modules.d/80base/dracut-dev-lib.sh b/modules.d/80base/dracut-dev-lib.sh
|
||||
index bc640f7..1f30438 100755
|
||||
--- a/modules.d/80base/dracut-dev-lib.sh
|
||||
+++ b/modules.d/80base/dracut-dev-lib.sh
|
||||
@@ -83,7 +83,7 @@ set_systemd_timeout_for_dev() {
|
||||
echo "JobTimeoutSec=$_timeout"
|
||||
echo "JobRunningTimeoutSec=$_timeout"
|
||||
} > "${PREFIX-}/etc/systemd/system/${_name}.device.d/timeout.conf"
|
||||
- type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/"${_name}".device.d/timeout.conf
|
||||
+ command -v mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/"${_name}".device.d/timeout.conf
|
||||
_needreload=1
|
||||
fi
|
||||
|
||||
@@ -110,7 +110,7 @@ wait_for_dev() {
|
||||
|
||||
_name="$(str_replace "$1" '/' '\x2f')"
|
||||
|
||||
- type mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
|
||||
+ command -v mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
|
||||
|
||||
[ -e "${PREFIX-}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
|
||||
|
||||
@@ -127,7 +127,7 @@ wait_for_dev() {
|
||||
if ! [ -L "${PREFIX-}/etc/systemd/system/initrd.target.wants/${_unit}" ]; then
|
||||
[ -d "${PREFIX-}"/etc/systemd/system/initrd.target.wants ] || mkdir -p "${PREFIX-}"/etc/systemd/system/initrd.target.wants
|
||||
ln -s ../"${_unit}" "${PREFIX-}/etc/systemd/system/initrd.target.wants/${_unit}"
|
||||
- type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/"${_unit}"
|
||||
+ command -v mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/"${_unit}"
|
||||
_needreload=1
|
||||
fi
|
||||
|
||||
diff --git a/modules.d/86shutdown/shutdown.sh b/modules.d/86shutdown/shutdown.sh
|
||||
index fd15ab5..cb9828c 100755
|
||||
--- a/modules.d/86shutdown/shutdown.sh
|
||||
+++ b/modules.d/86shutdown/shutdown.sh
|
||||
@@ -35,7 +35,7 @@ if [ "$ACTION" = "kexec" ] && ! command -v kexec > /dev/null 2>&1; then
|
||||
for p in /usr/sbin /usr/bin /sbin /bin; do
|
||||
cp -a /oldroot/${p}/kexec $p > /dev/null 2>&1 && break
|
||||
done
|
||||
- hash kexec
|
||||
+ command -v kexec > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
trap "emergency_shell --shutdown shutdown Signal caught!" 0
|
||||
@@ -152,7 +152,7 @@ while [ $_cnt -le 40 ]; do
|
||||
done
|
||||
[ $_cnt -ge 40 ] && _check_shutdown final
|
||||
|
||||
-if type plymouth > /dev/null 2>&1; then
|
||||
+if command -v plymouth > /dev/null 2>&1; then
|
||||
plymouth --hide-splash
|
||||
elif [ -x /oldroot/bin/plymouth ]; then
|
||||
/oldroot/bin/plymouth --hide-splash
|
||||
diff --git a/tools/release.sh b/tools/release.sh
|
||||
index 92dad34..f14fc62 100755
|
||||
--- a/tools/release.sh
|
||||
+++ b/tools/release.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/bin/sh
|
||||
|
||||
# clog might be installed in the user home
|
||||
export PATH="$PATH:~/.cargo/bin"
|
||||
@@ -31,7 +31,7 @@ cat _CONTRIBUTORS >> CONTRIBUTORS.md
|
||||
make AUTHORS
|
||||
|
||||
# Update the contributors list in NEWS.md
|
||||
-if ! type -p clog &> /dev/null; then
|
||||
+if ! command -v clog > /dev/null 2>&1; then
|
||||
cargo install clog-cli --version 0.9.3
|
||||
fi
|
||||
head --lines=2 NEWS.md > NEWS_header.md
|
||||
Reference in New Issue
Block a user