From 935f4f59efe170c75e4e7ab5543bdff245a77d5b Mon Sep 17 00:00:00 2001 From: Ildar Sagdejev Date: Thu, 25 Nov 2021 18:46:58 -0500 Subject: [PATCH 1/4] busybox grep doesn't know -F as --fixed-strings --- packaging/packager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/packager b/packaging/packager index 795d330..fbce051 100755 --- a/packaging/packager +++ b/packaging/packager @@ -61,7 +61,7 @@ function pluck_so_files() { } function package_libc_alpine() { - if grep --fixed-strings "Alpine Linux" < /etc/os-release > /dev/null; then + if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then if type apk > /dev/null 2>&1; then apk info --contents musl 2>/dev/null | pluck_so_files | sed 's/^/\//' fi From ff0c00125bf20dda1f84aebd549305f823e95dcd Mon Sep 17 00:00:00 2001 From: Ildar Sagdejev Date: Fri, 26 Nov 2021 07:38:19 -0500 Subject: [PATCH 2/4] Simplified method for picking out shared libraries from system package query result --- packaging/packager | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/packaging/packager b/packaging/packager index fbce051..894412b 100755 --- a/packaging/packager +++ b/packaging/packager @@ -56,14 +56,14 @@ if ! type zip > /dev/null 2>&1; then exit 1 fi -function pluck_so_files() { +function find_so_files() { sed -E '/\.so$|\.so\.[0-9]+$/!d' } function package_libc_alpine() { if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then if type apk > /dev/null 2>&1; then - apk info --contents musl 2>/dev/null | pluck_so_files | sed 's/^/\//' + apk info --contents musl 2>/dev/null | find_so_files | sed 's/^/\//' fi fi } @@ -71,26 +71,20 @@ function package_libc_alpine() { function package_libc_pacman() { if grep --extended-regexp "Arch Linux|Manjaro Linux" < /etc/os-release > /dev/null 2>&1; then if type pacman > /dev/null 2>&1; then - pacman --query --list --quiet glibc | pluck_so_files + pacman --query --list --quiet glibc | find_so_files fi fi } function package_libc_dpkg() { if type dpkg-query > /dev/null 2>&1; then - if [[ $(dpkg-query --listfiles libc6 | wc -l) -gt 0 ]]; then - dpkg-query --listfiles libc6 | pluck_so_files - fi + dpkg-query --listfiles libc6 | find_so_files fi } function package_libc_rpm() { - arch=$(uname -m) - if type rpm > /dev/null 2>&1; then - if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then - rpm --query --list glibc.$arch | pluck_so_files - fi + rpm --query --list glibc.$(uname -m) | find_so_files fi } From d63870ce3b3f71e9eace8541f6ad460f6c148fd8 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 1 Oct 2021 15:21:58 -0700 Subject: [PATCH 3/4] packager: fetch glibc corresponding to the host architecture on debian multiarch --- packaging/packager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/packager b/packaging/packager index 894412b..2e68bda 100755 --- a/packaging/packager +++ b/packaging/packager @@ -78,7 +78,7 @@ function package_libc_pacman() { function package_libc_dpkg() { if type dpkg-query > /dev/null 2>&1; then - dpkg-query --listfiles libc6 | find_so_files + dpkg-query --listfiles libc6:$(dpkg --print-architecture) | find_so_files fi } From c1480f79b139ee3f427f12e25dfd09f24e89236c Mon Sep 17 00:00:00 2001 From: Ildar Sagdejev Date: Tue, 30 Nov 2021 09:21:48 -0500 Subject: [PATCH 4/4] Added comment that explains -F flag --- packaging/packager | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/packager b/packaging/packager index 2e68bda..4e8759e 100755 --- a/packaging/packager +++ b/packaging/packager @@ -61,6 +61,7 @@ function find_so_files() { } function package_libc_alpine() { + # -F matches a fixed string rather than a regex (grep that comes with busybox doesn't know --fixed-strings) if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then if type apk > /dev/null 2>&1; then apk info --contents musl 2>/dev/null | find_so_files | sed 's/^/\//'