]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/stripper
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / src / stripper
index fa624815bb1b81267a8f8c0762cc7563a1067e24..4014f03a4ff2cb4afa119020dfb169604555b08a 100755 (executable)
@@ -2,11 +2,21 @@
 
 paths=()
 excludes=()
+strip="strip"
+break_on_error="1"
 
 while [ $# -gt 0 ]; do
        case "${1}" in
+               --strip=*)
+                       strip="${1#*=}"
+                       ;;
                --exclude=*)
-                       excludes+=( "!" "-path" "${1#*=}/*" )
+                       if [ -n "${1#*=}" ]; then
+                               excludes+=( "!" "-path" "${1#*=}" "!" "-path" "${1#*=}/*" )
+                       fi
+                       ;;
+               --ignore-errors)
+                       break_on_error="0"
                        ;;
                *)
                        paths+=( "${1}" )
@@ -28,6 +38,10 @@ function _strip() {
                        args+=( "--strip-all" )
                        ;;
 
+               *Type:*"DYN (Position-Independent Executable file)"*)
+                       args+=( "--strip-all" )
+                       ;;
+
                # Binaries
                *Type:*"EXEC (Executable file)"*)
                        args+=( "--strip-all" )
@@ -49,11 +63,10 @@ function _strip() {
                --absolute-names --dump "${file}" 2>/dev/null)"
 
        echo "Stripping ${file}..."
-       if ! strip "${args[@]}" "${file}"; then
-               return 1
+       if ! "${strip}" "${args[@]}" "${file}"; then
+               return ${break_on_error}
        fi
 
-
        # Restore capabilities
        if [ -n "${capabilities}" ]; then
                setfattr --no-dereference --restore=<(echo "${capabilities}")