mirror of
https://git.proxmox.com/git/proxmox-offline-mirror
synced 2025-04-28 15:24:24 +00:00
d/rules: patch out wrongly linked libraries from ELFs
Adapted from proxmox-backup's 198ebc6c ("d/rules: patch out wrongly linked libraries from ELFs") Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
6346bb5599
commit
e0663bd83f
1
debian/control
vendored
1
debian/control
vendored
@ -40,6 +40,7 @@ Build-Depends: bash-completion,
|
||||
librust-walkdir-2+default-dev (>= 2.3.1-~~),
|
||||
librust-xz2-0.1+default-dev,
|
||||
libstd-rust-dev,
|
||||
patchelf,
|
||||
python3-sphinx,
|
||||
rsync,
|
||||
rustc:native,
|
||||
|
10
debian/rules
vendored
10
debian/rules
vendored
@ -32,3 +32,13 @@ override_dh_missing:
|
||||
|
||||
override_dh_compress:
|
||||
dh_compress -X.pdf
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip
|
||||
for exe in $$(find \
|
||||
debian/proxmox-offline-mirror/usr \
|
||||
debian/proxmox-offline-mirror-helper/usr \
|
||||
-executable -type f); \
|
||||
do \
|
||||
debian/scripts/elf-strip-unused-dependencies.sh "$$exe" || true; \
|
||||
done
|
||||
|
20
debian/scripts/elf-strip-unused-dependencies.sh
vendored
Executable file
20
debian/scripts/elf-strip-unused-dependencies.sh
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
binary=$1
|
||||
|
||||
exec 3< <(ldd -u "$binary" | grep -oP '[^/:]+$')
|
||||
|
||||
patchargs=""
|
||||
dropped=""
|
||||
while read -r dep; do
|
||||
dropped="$dep $dropped"
|
||||
patchargs="--remove-needed $dep $patchargs"
|
||||
done <&3
|
||||
exec 3<&-
|
||||
|
||||
if [[ $dropped == "" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "patchelf '$binary' - removing unused dependencies:\n $dropped"
|
||||
patchelf $patchargs $binary
|
Loading…
Reference in New Issue
Block a user