hooks: Remove /etc/.pwd.lock and /run/mount/utab

When the zero-byte file /etc/.pwd.lock is present in the ISO image,
diffoscope will abort
(https://salsa.debian.org/reproducible-builds/diffoscope/-/issues/367)

This file will be generated when needed, so it can be removed from the
image.

Cleanup /run/mount/utab (and its directory)
This commit is contained in:
Roland Clobus 2024-03-13 22:16:09 +01:00 committed by Luca Boccassi
parent 724f449e0d
commit f290d31960
1 changed files with 10 additions and 0 deletions

View File

@ -10,3 +10,13 @@ do
mkdir -p ${_DIRECTORY}
chmod 1777 ${_DIRECTORY}
done
# Remove the old lock file which will be generated when needed
rm -f /etc/.pwd.lock
# Remove /run/mount/utab of util-linux libmount (and its directory)
# The file and directory will be generated when needed
if [ -d /run/mount ]; then
rm -f /run/mount/utab
rmdir --ignore-fail-on-non-empty /run/mount
fi