Skip to content

Commit

Permalink
Merge pull request #79 from flatcar/kai/overlay-whiteouts
Browse files Browse the repository at this point in the history
initrd-setup-root: Clean up whiteout entries for files to be recreated
  • Loading branch information
pothos authored Nov 30, 2023
2 parents 10cea16 + 4b44a62 commit 31d24b8
Showing 1 changed file with 11 additions and 0 deletions.
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
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

0 comments on commit 31d24b8

Please sign in to comment.