mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
filesystem-cleanup: Add parameter to show changes
Use --dry-run to only show files that would be deleted, but do not actually delete them. Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
97756e2124
commit
1475bc53a4
@@ -27,6 +27,22 @@ PATHS=(
|
||||
)
|
||||
|
||||
main() {
|
||||
local dry_run="false"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--dry-run)
|
||||
dry_run="true"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "${0}: Invalid argument: ${1}" >&2
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Update the runtime linker cache (this may fix any broken symlinks)
|
||||
ldconfig
|
||||
|
||||
@@ -65,7 +81,12 @@ main() {
|
||||
;;
|
||||
|
||||
*)
|
||||
unlink "${file}"
|
||||
echo "Removing ${file}..."
|
||||
|
||||
# Actually remove the file (maybe)
|
||||
if [ "${dry_run}" = "false" ]; then
|
||||
unlink "${file}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user