fix, skip deletion of system.map files on read-only filesystems

This is required for Qubes /lib/modules read-only implementation at time of writing.

Thanks to @marmarek for the bug report!

https://forums.whonix.org/t/remove-system-map-cannot-work-lib-modules-is-mounted-read-only/13324
This commit is contained in:
Patrick Schleizer 2022-02-10 13:44:55 -05:00
parent 356232677a
commit 4f6f588fb5
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -26,9 +26,14 @@ fi
## Removes the System.map files as they are only used for debugging or malware.
for filename in ${system_map_location} ; do
if [ -f "${filename}" ]; then
## 'shred' with '--verbose' is too chatty. (7 lines)
shred --force --zero -u "${filename}"
echo "removed '${filename}'"
if [ -w "${filename}" ]; then
## 'shred' with '--verbose' is too chatty. (7 lines)
shred --force --zero -u "${filename}"
echo "removed '${filename}'"
else
echo "Cannot delete '${filename}' - read-only. For details, see: https://www.kicksecure.com/wiki/security-misc#system_map"
exit 0
fi
fi
done