]>
git.ipfire.org Git - people/stevee/ipfire-2.x.git/blob - src/scripts/filesystem-cleanup
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
30 while [ $# -gt 0 ]; do
37 echo "${0}: Invalid argument: ${1}" >&2
44 # Update the runtime linker cache (this may fix any broken symlinks)
48 for path
in ${PATHS[@]}; do
49 echo "Searching in ${path}..."
51 # Find all files called libsomething.so.N
53 for lib
in $
(find "${path}" -maxdepth 1 -type l
-name "lib*.so.*" |
sort); do
54 # Ignore some libraries
61 # Read the name of the linked library
62 local link
="$(readlink -m "${lib}")"
64 # We have two versioning schemas that we need to distinguish...
67 # Libraries called libsomething-N.so
69 files
+=( ${link%-*}-* )
72 # Libraries called libsomething.so.N.*
78 # Remove all files that have the same base name than
79 # the library we are looking at, apart from the symlink
80 # and the linked file itself.
82 for file in ${files[@]}; do
89 echo "Removing ${file}..."
91 # Actually remove the file (maybe)
92 if [ "${dry_run}" = "false" ]; then