Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initrd-setup-root: Clean up whiteout entries for files to be recreated #79

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions dracut/99setup-root/initrd-setup-root
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ if [ -s /sysroot/selective-os-reset ]; then
rm -f /sysroot/etc/machine-id
fi

# Remove any user-created whiteouts for files that have a tmpfiles
# rule which normally would recreate them (we use the lowerdir for that).
while IFS="" read -r entry ; do
entry="/sysroot${entry}"
# The -c check for character devs also guards against empty strings and nonexisting files
# The stat command prints the major and minor device type in decimal
if [ -c "${entry}" ] && [ "$(stat --printf='%Hr %Lr\n' "${entry}")" = "0 0" ]; then
pothos marked this conversation as resolved.
Show resolved Hide resolved
rm "${entry}" || true
fi
done < /sysroot/usr/share/flatcar/etc-no-whiteouts

# This creates the modifiable users/groups in /sysroot/etc,
# initializing the shadow database in the process. This needs to
# happen early, so systemd-tmpfiles can read the user info from
Expand Down