summaryrefslogtreecommitdiffstats
path: root/modules.d/99base
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:36 +0000
commit70de5d4041249c1a0f597714398cc245f59495c6 (patch)
treeff491e31b95b662ca6c481ac49d1ca8a94c0226b /modules.d/99base
parentAdding debian version 060+5-8. (diff)
downloaddracut-70de5d4041249c1a0f597714398cc245f59495c6.tar.xz
dracut-70de5d4041249c1a0f597714398cc245f59495c6.zip
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/99base')
-rwxr-xr-xmodules.d/99base/dracut-lib.sh51
-rwxr-xr-xmodules.d/99base/init.sh22
-rwxr-xr-xmodules.d/99base/loginit.sh2
-rwxr-xr-xmodules.d/99base/module-setup.sh5
-rwxr-xr-xmodules.d/99base/rdsosreport.sh2
5 files changed, 37 insertions, 45 deletions
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 39609d8..e83ee94 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -451,7 +451,7 @@ die() {
fi
if [ -n "$DRACUT_SYSTEMD" ]; then
- systemctl --no-block --force halt
+ systemctl --no-block --force poweroff
fi
exit 1
@@ -973,25 +973,25 @@ emergency_shell() {
_emergency_action=$(getarg rd.emergency)
[ -z "$_emergency_action" ] \
&& [ -e /run/initramfs/.die ] \
- && _emergency_action=halt
+ && _emergency_action=poweroff
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
_emergency_shell "$_rdshell_name"
else
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
fi
case "$_emergency_action" in
reboot)
- reboot || exit 1
+ reboot -f || exit 1
;;
poweroff)
- poweroff || exit 1
+ poweroff -f || exit 1
;;
halt)
- halt || exit 1
+ halt -f || exit 1
;;
esac
}
@@ -1130,8 +1130,20 @@ show_memstats() {
esac
}
+# parameter: <memory_name:> example: MemTotal:
+# Check /proc/meminfo
+# echo the field value, if present.
+check_meminfo() {
+ local - m sz
+ set +x
+ while read -r m sz _ || [ "$m" ]; do
+ [ "$m" = "$1" ] && echo "$sz" && return 0
+ done < /proc/meminfo
+ return 1
+}
+
remove_hostonly_files() {
- rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir/initqueue/finished"
+ rm -fr /etc/cmdline /etc/cmdline.d/*.conf "$hookdir"/initqueue/finished/*.sh
if [ -f /lib/dracut/hostonly-files ]; then
while read -r line || [ -n "$line" ]; do
[ -e "$line" ] || [ -h "$line" ] || continue
@@ -1151,28 +1163,3 @@ load_fstype() {
done < /proc/filesystems
modprobe "$1"
}
-
-# parameter: size of live image
-# calls emergency shell if ram size is too small for the image
-check_live_ram() {
- minmem=$(getarg rd.minmem)
- minmem=${minmem:-1024}
- imgsize=$1
- memsize=$(($(sed -n 's/MemTotal: *\([[:digit:]]*\).*/\1/p' /proc/meminfo) / 1024))
-
- if [ -z "$imgsize" ]; then
- warn "Image size could not be determined"
- return 0
- fi
-
- if [ $((memsize - imgsize)) -lt "$minmem" ]; then
- sed -i "N;/and attach it to a bug report./s/echo$/echo\n\
- echo \n\
- echo 'Warning!!!'\n\
- echo 'The memory size of your system is too small for this live image.'\n\
- echo 'Expect killed processes due to out of memory conditions.'\n\
- echo \n/" /usr/bin/dracut-emergency
-
- emergency_shell
- fi
-}
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 285059e..727f279 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -123,7 +123,7 @@ fi
# run scriptlets to parse the command line
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
-getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
+getargs 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
[ -z "$root" ] && die "No or empty root= argument"
@@ -133,12 +133,14 @@ export root rflags fstype netroot NEWROOT
# pre-udev scripts run before udev starts, and are run only once.
make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
-getarg 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
+getargs 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
source_hook pre-udev
UDEV_LOG=err
-getargbool 0 rd.udev.info -d -y rdudevinfo && UDEV_LOG=info
-getargbool 0 rd.udev.debug -d -y rdudevdebug && UDEV_LOG=debug
+getargbool 0 rd.udev.log_level=info -d rd.udev.log-priority=info -d rd.udev.info -d -y rdudevinfo \
+ && UDEV_LOG=info
+getargbool 0 rd.udev.log_level=debug -d rd.udev.log-priority=debug -d rd.udev.debug -d -y rdudevdebug \
+ && UDEV_LOG=debug
# start up udev and trigger cold plugs
UDEV_LOG=$UDEV_LOG "$systemdutildir"/systemd-udevd --daemon --resolve-names=never
@@ -148,7 +150,7 @@ UDEV_QUEUE_EMPTY="udevadm settle --timeout=0"
udevproperty "hookdir=$hookdir"
make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
-getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
+getargs 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
source_hook pre-trigger
udevadm control --reload > /dev/null 2>&1 || :
@@ -157,7 +159,7 @@ udevadm trigger --type=subsystems --action=add > /dev/null 2>&1
udevadm trigger --type=devices --action=add > /dev/null 2>&1
make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
-getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
+getargs 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
RDRETRY=${RDRETRY:-180}
@@ -223,10 +225,10 @@ unset RDRETRY
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
-getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount"
+getargs 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break before pre-mount"
source_hook pre-mount
-getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount"
+getargs 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break before mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one succeeds, no more are sourced.
_i_mount=0
@@ -262,12 +264,12 @@ done
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
-getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot"
+getargs 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break before pre-pivot"
source_hook pre-pivot
make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
-getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup"
+getargs 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break before cleanup"
source_hook cleanup
# By the time we get here, the root filesystem should be mounted.
diff --git a/modules.d/99base/loginit.sh b/modules.d/99base/loginit.sh
index cdb305b..7c47a5a 100755
--- a/modules.d/99base/loginit.sh
+++ b/modules.d/99base/loginit.sh
@@ -18,6 +18,6 @@ while read -r line || [ -n "$line" ]; do
fi
echo "<31>dracut: $line" >&5
# if "quiet" is specified we output to /dev/console
- [ -n "$QUIET" ] || echo "dracut: $line"
+ [ "$QUIET" = "yes" ] || echo "dracut: $line"
echo "$line" >&6
done
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index 54b0deb..bfdc51d 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -45,7 +45,10 @@ install() {
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
mkdir -m 0755 -p "${initdir}"/lib/dracut
- mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks
+ mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks
+
+ # symlink to old hooks location for compatibility
+ ln_r /var/lib/dracut/hooks /lib/dracut/hooks
mkdir -p "${initdir}"/tmp
diff --git a/modules.d/99base/rdsosreport.sh b/modules.d/99base/rdsosreport.sh
index dadf30b..61ca458 100755
--- a/modules.d/99base/rdsosreport.sh
+++ b/modules.d/99base/rdsosreport.sh
@@ -28,7 +28,7 @@ cat /proc/self/mountinfo
cat /proc/mounts
blkid
-blkid -o udev
+command -v udevadm > /dev/null 2> /dev/null && udevadm info --export-db
ls -l /dev/disk/by*