Skip to content

Commit

Permalink
fix(dracut-lib): only remove initqueue/finished scripts, not the hook…
Browse files Browse the repository at this point in the history
… dir

The `remove_hostonly_files` function should only remove (as its name suggests)
hostonly configuration and files. The initqueue/finished scripts considered as
hostonly that must be removed are added via `wait_for_dev`. But, the `hookdirs`
are always created at build time, and should not be removed.

This patch also allows to remove the `mkdir` workaround in the `network-manager`
module (copied-pasted into the `connman` module after), and avoids having to add
it tree-wide in many missing places.

Fixes 87e90d7
  • Loading branch information
aafeijoo-suse committed Apr 4, 2024
1 parent 0fc4a60 commit 066dd43
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion modules.d/35connman/cm-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh

cm_generate_connections() {
if getargbool 0 rd.neednet; then
mkdir -p "$hookdir"/initqueue/finished
echo '[ -f /tmp/cm.done ]' > "$hookdir"/initqueue/finished/cm.sh
mkdir -p /run/connman/initrd
: > /run/connman/initrd/neednet # activate ConnMan services
Expand Down
1 change: 0 additions & 1 deletion modules.d/35network-manager/nm-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ nm_generate_connections() {
/etc/NetworkManager/system-connections/* \
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
mkdir -p "$hookdir"/initqueue/finished
echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh
mkdir -p /run/NetworkManager/initrd
: > /run/NetworkManager/initrd/neednet # activate NM services
Expand Down
2 changes: 1 addition & 1 deletion modules.d/99base/dracut-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ show_memstats() {
}

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
Expand Down

0 comments on commit 066dd43

Please sign in to comment.