]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/stripper
14 excludes
+=( "!" "-path" "${1#*=}/*" )
31 local type="$(readelf -h "${file}" 2>/dev/null)"
34 # Libraries and Relocatable binaries
35 *Type
:*"DYN (Shared object file)"*)
36 args
+=( "--strip-all" )
40 *Type
:*"EXEC (Executable file)"*)
41 args
+=( "--strip-all" )
45 *Type
:*"REL (Relocatable file)"*)
46 args
+=( "--strip-debug" "--remove-section=.comment" "--remove-section=.note" )
49 # Skip any unrecognised files
55 # Fetch any capabilities
56 local capabilities
="$(getfattr --no-dereference --name="security.capability
" \
57 --absolute-names --dump "${file}" 2>/dev/null)"
59 echo "Stripping ${file}..."
60 if ! "${strip}" "${args[@]}" "${file}"; then
61 return ${break_on_error}
64 # Restore capabilities
65 if [ -n "${capabilities}" ]; then
66 setfattr
--no-dereference --restore=<(echo "${capabilities}")
70 for path
in ${paths[@]}; do
71 for file in $
(find -H "${path}" -xdev "${excludes[@]}" -type f \
( -perm -0100 -or -perm -0010 -or -perm -0001 \
) 2>/dev
/null
); do
72 _strip
"${file}" ||
exit $?