Skip to content

Commit 5fb60b9

Browse files
authored
Simplified method for picking out shared libraries from system package query result (#136)
1 parent 9dd0bdf commit 5fb60b9

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

packaging/packager

+5-12
Original file line numberDiff line numberDiff line change
@@ -56,43 +56,36 @@ if ! type zip > /dev/null 2>&1; then
5656
exit 1
5757
fi
5858

59-
function pluck_so_files() {
59+
function find_so_files() {
6060
sed -E '/\.so$|\.so\.[0-9]+$/!d'
6161
}
6262

6363
function package_libc_alpine() {
6464
# -F matches a fixed string rather than a regex (grep that comes with busybox doesn't know --fixed-strings)
6565
if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then
6666
if type apk > /dev/null 2>&1; then
67-
apk info --contents musl 2>/dev/null | pluck_so_files | sed 's/^/\//'
67+
apk info --contents musl 2>/dev/null | find_so_files | sed 's/^/\//'
6868
fi
6969
fi
7070
}
7171

7272
function package_libc_pacman() {
7373
if grep --extended-regexp "Arch Linux|Manjaro Linux" < /etc/os-release > /dev/null 2>&1; then
7474
if type pacman > /dev/null 2>&1; then
75-
pacman --query --list --quiet glibc | pluck_so_files
75+
pacman --query --list --quiet glibc | find_so_files
7676
fi
7777
fi
7878
}
7979

8080
function package_libc_dpkg() {
8181
if type dpkg-query > /dev/null 2>&1; then
82-
architecture=$(dpkg --print-architecture)
83-
if [[ $(dpkg-query --listfiles libc6:$architecture | wc -l) -gt 0 ]]; then
84-
dpkg-query --listfiles libc6:$architecture | pluck_so_files
85-
fi
82+
dpkg-query --listfiles libc6:$(dpkg --print-architecture) | find_so_files
8683
fi
8784
}
8885

8986
function package_libc_rpm() {
90-
arch=$(uname -m)
91-
9287
if type rpm > /dev/null 2>&1; then
93-
if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then
94-
rpm --query --list glibc.$arch | pluck_so_files
95-
fi
88+
rpm --query --list glibc.$(uname -m) | find_so_files
9689
fi
9790
}
9891

0 commit comments

Comments
 (0)