From: Michael Tremer Date: Sun, 19 Mar 2023 19:53:44 +0000 (+0000) Subject: strip: Apply hack to preserve capabilities X-Git-Tag: 0.9.29~233 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=470880d89a26a1190e0c2e9e403cabcce92cbbf5;p=pakfire.git strip: Apply hack to preserve capabilities Signed-off-by: Michael Tremer --- diff --git a/src/scripts/strip b/src/scripts/strip index 6fa9aaf07..3d82beb5a 100644 --- a/src/scripts/strip +++ b/src/scripts/strip @@ -80,6 +80,10 @@ process_file() { fi fi + # Fetch any capabilities + local capabilities="$(getfattr --no-dereference --name="security.capability" \ + --absolute-names --dump "${file}" 2>/dev/null)" + # Extract sources if ! extract_sources "${file}"; then error "Could not extract sources from ${file}" @@ -143,6 +147,11 @@ process_file() { cat "${tempfile}" > "${file}" rm -f "${tempfile}" + # Restore capabilities + if [ -n "${capabilities}" ]; then + setfattr --no-dereference --restore=<(echo "${capabilities}") + fi + return 0 }