summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2025-11-21 16:57:44 +0100
committerSimon Rettberg2025-11-21 16:57:44 +0100
commit08b956b1ee14e033c3e16082d8386d3ae54496fc (patch)
tree5920a0fd7a95e7e792d03be3f759e53eb1c6ab43
parent[busybox] Try random server if busybox.net is securwebinfot (diff)
downloadsystemd-init-08b956b1ee14e033c3e16082d8386d3ae54496fc.tar.gz
systemd-init-08b956b1ee14e033c3e16082d8386d3ae54496fc.tar.xz
systemd-init-08b956b1ee14e033c3e16082d8386d3ae54496fc.zip
Update dracut to 109
-rwxr-xr-xbuild-initramfs.sh7
-rwxr-xr-xmodules.d/busybox/hooks/s3-install-busybox.sh9
-rwxr-xr-xmodules.d/busybox/module-setup.sh12
-rwxr-xr-xmodules.d/conf-tgz/hooks/s3-unpack-config-tgz.sh5
-rwxr-xr-xmodules.d/slx-extra-script/hooks/s3-extra-script.sh2
-rwxr-xr-xmodules.d/slx-network/hooks/s3-parse-network-kcl.sh8
-rw-r--r--patches/dracut/dracut-install-ash.patch13
-rw-r--r--patches/dracut/dracut-lib.sh.patch54
8 files changed, 63 insertions, 47 deletions
diff --git a/build-initramfs.sh b/build-initramfs.sh
index 683e8478..2934b079 100755
--- a/build-initramfs.sh
+++ b/build-initramfs.sh
@@ -36,7 +36,7 @@ declare -rg _dracut_dir="${_root_dir}/dracut"
# Autodetect the kmod version present on the system to decide which dracut version to get
# * v59 requires kmod >= 23 (Available in Ubuntu 18.04)
# * v46 works with kmod == 20 (CentOS 7.5 only provides kmod v20)
-declare -g _dracut_version="059"
+declare -g _dracut_version="109"
if [ "$(pkg-config --modversion libkmod)" -lt 23 ]; then
_dracut_version="046"
fi
@@ -51,7 +51,7 @@ declare -A core_repo=(
declare -A core_dracut=(
[handler]="http"
[path]="$_dracut_dir"
- [url]="https://github.com/dracutdevs/dracut/archive/refs/tags/${_dracut_version}.tar.gz"
+ [url]="https://github.com/dracut-ng/dracut-ng/archive/refs/tags/${_dracut_version}.tar.gz"
)
declare -A module_dnbd3=(
@@ -397,7 +397,7 @@ parse_command_line() {
## region helper
initialize_dracut() {
pushd "${_dracut_dir}" || exit 1
- echo 'Compiling dracut.'
+ echo "Compiling dracut $dracut_version."
./configure || exit 1
make dracut-install || exit 1
make dracut-util
@@ -453,7 +453,6 @@ initialize_dracut() {
_tmpfile="/tmp/dracut-service-$RANDOM"
inst "$moddir/hooks/${_name}.sh" \
"/usr/local/slx-services/${_name}.sh" || exit 10
- [ "${_name}" != "s3-install-busybox" ] && _after+=( "s3-install-busybox.service" )
{
echo "[Unit]"
echo "Description=${_desc}"
diff --git a/modules.d/busybox/hooks/s3-install-busybox.sh b/modules.d/busybox/hooks/s3-install-busybox.sh
deleted file mode 100755
index 38a90ece..00000000
--- a/modules.d/busybox/hooks/s3-install-busybox.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-if busybox --install -s; then
- echo "Busybox installed."
- exit 0
-fi
-
-echo "Busybox install failed."
-exit 1
diff --git a/modules.d/busybox/module-setup.sh b/modules.d/busybox/module-setup.sh
index 1a17ee78..f93d304e 100755
--- a/modules.d/busybox/module-setup.sh
+++ b/modules.d/busybox/module-setup.sh
@@ -43,8 +43,16 @@ install() {
derror "Could not install busybox"
return 1
fi
- slx_service "s3-install-busybox" "Install busybox applet symlinks" \
- --wbefore "dracut-cmdline.service"
+ # manually install, /bin etc. are read-only in initrd
+ local applet
+ for applet in $("${moddir}/src/busybox" --listfull); do
+ if [ -e "${initdir}/${applet}" ]; then
+ # real tool probably exists
+ continue
+ fi
+ ln -sfn /bin/busybox "${initdir}/${applet}" \
+ || dwarn "Could not install busybox applet: $applet"
+ done
slx_service "s3-install-busybox-stage4" "Install busybox into stage 4" \
--wafter "initrd-root-fs.target" \
--after "s3-install-busybox.service"
diff --git a/modules.d/conf-tgz/hooks/s3-unpack-config-tgz.sh b/modules.d/conf-tgz/hooks/s3-unpack-config-tgz.sh
index 7bc93a69..ba5178a4 100755
--- a/modules.d/conf-tgz/hooks/s3-unpack-config-tgz.sh
+++ b/modules.d/conf-tgz/hooks/s3-unpack-config-tgz.sh
@@ -1,6 +1,9 @@
#!/bin/ash
# -*- coding: utf-8 -*-
+. /etc/openslx
+[ -n "$SLX_NO_CONFIG_TGZ" ] && exit 0
+
# tarcopy <source_dir> <target_dir>
tarcopy() (
if ! [ -d "$1" ] || ! [ -d "$2" ]; then
@@ -36,12 +39,12 @@ if ! tar \
exit 1
fi
# check SLX_LOCAL_CONFIG
-. "/etc/openslx"
if [ -n "$SLX_LOCAL_CONFIG" ]; then
for mod in $SLX_LOCAL_CONFIG; do
if [ ! -d "${extract_dir}/openslx-configs/${mod}" ]; then
echo "Ignoring missing mod '$mod' in config.tgz"
else
+ echo "Unpacking '$mod' from config.tgz"
tarcopy \
"${extract_dir}/openslx-configs/${mod}" \
"${extract_dir}"
diff --git a/modules.d/slx-extra-script/hooks/s3-extra-script.sh b/modules.d/slx-extra-script/hooks/s3-extra-script.sh
index 7ac293ee..1f700275 100755
--- a/modules.d/slx-extra-script/hooks/s3-extra-script.sh
+++ b/modules.d/slx-extra-script/hooks/s3-extra-script.sh
@@ -3,6 +3,6 @@
. /etc/openslx
[ -z "$SLX_EXTRA_SCRIPT_URL" ] && exit 0
-slx-tools download_retry --slx-time 20 -sS "$SLX_EXTRA_SCRIPT_URL" > /etc/extra-init || exit 1
+slx-tools download_retry --slx-time 20 -sS --insecure "$SLX_EXTRA_SCRIPT_URL" > /etc/extra-init || exit 1
chmod +x /etc/extra-init
exec /etc/extra-init pre-dmsetup
diff --git a/modules.d/slx-network/hooks/s3-parse-network-kcl.sh b/modules.d/slx-network/hooks/s3-parse-network-kcl.sh
index 37dc7814..84398150 100755
--- a/modules.d/slx-network/hooks/s3-parse-network-kcl.sh
+++ b/modules.d/slx-network/hooks/s3-parse-network-kcl.sh
@@ -9,7 +9,7 @@
command -v getarg >/dev/null || . /lib/dracut-lib.sh
# static names for the boot interface and its bridge
-declare -rg bootif_name="boot0"
+declare -g bootif_name="boot0"
declare -rg bridge_name="br0"
# parse old syslinux style 'ip=...' and 'BOOTIF=...' parameters
@@ -52,6 +52,12 @@ parse_kcl() {
parse_kcl_ip
parse_kcl_ipv4
+ local kcl_bootif_name="$(getarg bootif_name=)"
+ if [ -n "$kcl_bootif_name" ]; then
+ declare -g bootif_name="$kcl_bootif_name"
+ fi
+ readonly bootif_name
+
# if not boot server was given, use slxsrv
if [ -z "$bootsrv" ]; then
kclsrv="$(getarg slxsrv=)"
diff --git a/patches/dracut/dracut-install-ash.patch b/patches/dracut/dracut-install-ash.patch
new file mode 100644
index 00000000..8c9c75ba
--- /dev/null
+++ b/patches/dracut/dracut-install-ash.patch
@@ -0,0 +1,13 @@
+diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c
+index b1b2391b..ce58da36 100644
+--- a/src/install/dracut-install.c
++++ b/src/install/dracut-install.c
+@@ -1203,6 +1203,8 @@ static int resolve_deps(const char *src, Hashmap *pdeps)
+ char *p, *q;
+ for (p = &shebang[2]; *p && isspace(*p); p++) ;
+ for (q = p; *q && (!isspace(*q)); q++) ;
++ if (strncmp(p, "/bin/ash", q - p) == 0)
++ goto finish;
+ char *interpreter = strndup(p, q - p);
+ log_debug("Script install: '%s'", interpreter);
+ ret = dracut_install(interpreter, interpreter, false, true, false);
diff --git a/patches/dracut/dracut-lib.sh.patch b/patches/dracut/dracut-lib.sh.patch
index accc42bc..09d70689 100644
--- a/patches/dracut/dracut-lib.sh.patch
+++ b/patches/dracut/dracut-lib.sh.patch
@@ -1,9 +1,9 @@
-diff --git a/modules.d/98dracut-systemd/dracut-emergency.sh b/modules.d/98dracut-systemd/dracut-emergency.sh
-index c6637a5c..19fc4948 100755
---- a/modules.d/98dracut-systemd/dracut-emergency.sh
-+++ b/modules.d/98dracut-systemd/dracut-emergency.sh
-@@ -42,6 +42,11 @@ else
- [ -z "$_emergency_action" ] && _emergency_action=halt
+diff --git a/modules.d/77dracut-systemd/dracut-emergency.sh b/modules.d/77dracut-systemd/dracut-emergency.sh
+index a427a8f7..ce819d87 100755
+--- a/modules.d/77dracut-systemd/dracut-emergency.sh
++++ b/modules.d/77dracut-systemd/dracut-emergency.sh
+@@ -47,6 +47,11 @@ else
+ [ -z "$_emergency_action" ] && _emergency_action=poweroff
fi
+if ! getarg splash; then
@@ -14,16 +14,16 @@ index c6637a5c..19fc4948 100755
/bin/rm -f -- /.console_lock
case "$_emergency_action" in
-diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
-index 39609d82..8e28789a 100755
---- a/modules.d/99base/dracut-lib.sh
-+++ b/modules.d/99base/dracut-lib.sh
-@@ -945,7 +945,13 @@ _emergency_shell() {
+diff --git a/modules.d/80base/dracut-lib.sh b/modules.d/80base/dracut-lib.sh
+index d44b05cc..18199801 100755
+--- a/modules.d/80base/dracut-lib.sh
++++ b/modules.d/80base/dracut-lib.sh
+@@ -869,7 +869,13 @@ _emergency_shell() {
fi
[ -c "$_ctty" ] || _ctty=/dev/tty1
case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty" ;; esac
+ : > /.console_lock
- setsid $CTTY /bin/sh -i -l 0<> $_ctty 1<> $_ctty 2<> $_ctty
+ setsid ${CTTY:+"${CTTY}"} /bin/sh -i -l 0<> "$_ctty" 1<> "$_ctty" 2<> "$_ctty"
+ rm -f -- /.console_lock
+ if ! getarg splash; then
+ # Enable systemd output again
@@ -32,7 +32,7 @@ index 39609d82..8e28789a 100755
fi
}
-@@ -955,6 +961,8 @@ emergency_shell() {
+@@ -879,6 +885,8 @@ emergency_shell() {
local _rdshell_name="dracut" action="Boot" hook="emergency"
local _emergency_action
@@ -41,13 +41,10 @@ index 39609d82..8e28789a 100755
if [ "$1" = "-n" ]; then
_rdshell_name=$2
shift 2
-@@ -964,11 +972,16 @@ emergency_shell() {
- hook="shutdown-emergency"
- shift 2
- fi
--
-- echo
-- echo
+@@ -891,8 +899,16 @@ emergency_shell() {
+
+ echo
+ echo
- warn "$*"
- echo
+ {
@@ -63,20 +60,19 @@ index 39609d82..8e28789a 100755
_emergency_action=$(getarg rd.emergency)
[ -z "$_emergency_action" ] \
-@@ -981,6 +994,16 @@ emergency_shell() {
+@@ -905,6 +921,15 @@ emergency_shell() {
source_hook "$hook"
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
- [ -z "$_emergency_action" ] && _emergency_action=halt
+ [ -z "$_emergency_action" ] && _emergency_action=poweroff
+ local delay=60
+ {
-+ echo "FATAL - contact your bwLehrpool administrator."
-+ while [ "$delay" -gt 0 ]; do
-+ echo -e "System will ${_emergency_action} in $delay seconds or upon key press."'\e[1A\e[K'
-+ (( delay-- ))
-+ sleep 1
-+ done &
++ echo "FATAL - contact your bwLehrpool administrator."
++ while [ "$delay" -gt 0 ]; do
++ echo -e "System will ${_emergency_action} in $delay seconds or upon key press."'\e[1A\e[K'
++ (( delay-- ))
++ sleep 1
++ done &
+ } > /dev/tty1
-+ read -s -t 60 -n 1 bs < /dev/tty1
fi
case "$_emergency_action" in