Skip to content

Commit

Permalink
install-from-source.sh: fix libssl Alpine pkgs (#1582)
Browse files Browse the repository at this point in the history
The version of libssl available in the Alpine package feeds changed with
version 3.15. The latest libssl package is 1.1 in 3.14.x and earlier,
but newer versions only have libssl3.

Add a check for the Alpine version in the install from source script and
switch between installing libssl3 and libssl1.1 depending on the distro
version.

Also add another entry to the test matrix of distributions to include a
3.14.x Alpine version.

This replaces the two other PRs that aimed to address this issue:
- #1535
- #1574

Tested the updated workflow here:
https://github.com/git-ecosystem/git-credential-manager/actions/runs/8698286553/job/23855027830
  • Loading branch information
mjcheetham authored Apr 16, 2024
2 parents 1ed7037 + 7cda9db commit 5086b37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/validate-install-from-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- image: tgagor/centos-stream
- image: redhat/ubi8
- image: alpine
- image: alpine:3.14.10
- image: opensuse/leap
- image: opensuse/tumbleweed
- image: registry.suse.com/suse/sle15:15.4.27.11.31
Expand Down
13 changes: 12 additions & 1 deletion src/linux/Packaging.Linux/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ print_unsupported_distro() {
echo "See https://gh.io/gcm/linux for details."
}

version_at_least() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$1" ]
}

sudo_cmd=

# If the user isn't root, we need to use `sudo` for certain commands
Expand Down Expand Up @@ -189,7 +193,14 @@ case "$distribution" in
$sudo_cmd apk update

# Install dotnet/GCM dependencies.
install_packages apk add "curl git icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib which bash coreutils gcompat"
# Alpine 3.14 and earlier need libssl1.1, while later versions need libssl3.
if ( version_at_least "3.15" $version ) then
libssl_pkg="libssl3"
else
libssl_pkg="libssl1.1"
fi

install_packages apk add "curl git icu-libs krb5-libs libgcc libintl $libssl_pkg libstdc++ zlib which bash coreutils gcompat"

ensure_dotnet_installed
;;
Expand Down

0 comments on commit 5086b37

Please sign in to comment.