-
Notifications
You must be signed in to change notification settings - Fork 94
Packaging support on Alpine Linux #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,6 @@ done | |
set -- "${POSITIONAL[@]}" # restore positional parameters | ||
|
||
PKG_BIN_PATH=$1 | ||
architecture=$(arch) | ||
|
||
if [ ! -f "$PKG_BIN_PATH" ]; then | ||
echo "$PKG_BIN_PATH" - No such file.; | ||
|
@@ -56,26 +55,41 @@ if ! type zip > /dev/null 2>&1; then | |
echo "zip utility is not found. Please install it and re-run this script" | ||
exit 1 | ||
fi | ||
function package_libc_via_pacman { | ||
|
||
function pluck_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 -L musl 2>/dev/null | pluck_so_files | sed 's/^/\//' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here if applicable. If not add a comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem. |
||
fi | ||
fi | ||
} | ||
|
||
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 | sed -E '/\.so$|\.so\.[0-9]+$/!d' | ||
pacman --query --list --quiet glibc | pluck_so_files | ||
fi | ||
fi | ||
} | ||
|
||
function package_libc_via_dpkg() { | ||
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 | sed -E '/\.so$|\.so\.[0-9]+$/!d' | ||
dpkg-query --listfiles libc6 | pluck_so_files | ||
fi | ||
fi | ||
} | ||
|
||
function package_libc_via_rpm() { | ||
function package_libc_rpm() { | ||
arch=$(uname -m) | ||
|
||
if type rpm > /dev/null 2>&1; then | ||
if [[ $(rpm --query --list glibc.$architecture | wc -l) -gt 1 ]]; then | ||
rpm --query --list glibc.$architecture | sed -E '/\.so$|\.so\.[0-9]+$/!d' | ||
if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then | ||
rpm --query --list glibc.$arch | pluck_so_files | ||
fi | ||
fi | ||
} | ||
|
@@ -99,9 +113,10 @@ PKG_LD="" | |
|
||
list=$(ldd "$PKG_BIN_PATH" | awk '{print $(NF-1)}') | ||
libc_libs=() | ||
libc_libs+=($(package_libc_via_dpkg)) | ||
libc_libs+=($(package_libc_via_rpm)) | ||
libc_libs+=($(package_libc_via_pacman)) | ||
libc_libs+=($(package_libc_dpkg)) | ||
libc_libs+=($(package_libc_rpm)) | ||
libc_libs+=($(package_libc_pacman)) | ||
libc_libs+=($(package_libc_alpine)) | ||
|
||
mkdir -p "$PKG_DIR/bin" "$PKG_DIR/lib" | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the long form of the command line option, please.
grep --fixed-strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcomagdy, now it doesn't build on Alpine, because busybox knows
grep -F
but it doesn't know it as--fixed-strings
.