#!/bin/bash ## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC ## See the file COPYING for copying conditions. if [ -f /usr/libexec/helper-scripts/pre.bsh ]; then ## pre.bsh would `source` the following folders: ## /etc/remove-system.map_pre.d/*.conf ## /usr/local/etc/remove-system.map_pre.d/*.conf source /usr/libexec/helper-scripts/pre.bsh fi shopt -s nullglob system_map_location="/boot/System.map* /usr/src/*/System.map* /lib/modules/*/*/System.map* /System.map*" counter=0 for filename in ${system_map_location} ; do counter=$(( counter + 1 )) done if [ "$counter" -ge "1" ]; then echo "INFO: Deleting system.map files..." 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 if [ -w "${filename}" ]; then ## 'shred' with '--verbose' is too chatty. (7 lines) shred --force --zero -u "${filename}" echo "INFO: removed '${filename}'" else echo "NOTE: Cannot delete '${filename}' - read-only. For details, see: https://www.kicksecure.com/wiki/security-misc#system_map" exit 0 fi fi done if [ "$counter" -ge "1" ]; then echo "INFO: Done. Success." fi