ci: convert "install-dependencies.sh" to use "/bin/sh"
We're about to merge the "install-docker-dependencies.sh" script into "install-dependencies.sh". This will also move our Alpine-based jobs over to use the latter script. This script uses the Bash shell though, which is not available by default on Alpine Linux. Refactor "install-dependencies.sh" to use "/bin/sh" instead of Bash. This requires us to get rid of the pushd/popd invocations, which are replaced by some more elaborate commands that download or extract executables right to where they are needed. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Apr 12, 2024 at 06:44 UTC
40c60f4c124d1ae59c0f05dcd37dbe0c63d64ab7
1 file changed
+12
-17
ci/install-dependencies.sh
+12
-17
@@ -1,4 +1,4 @@
1
-#!/usr/bin/env bash
1
+#!/bin/sh
2
#
3
# Install dependencies required to build and test Git on Linux and macOS
4
#
@@ -30,19 +30,15 @@ ubuntu-*)
30
$CC_PACKAGE $PYTHON_PACKAGE
31
32
mkdir --parents "$P4_PATH"
33
- pushd "$P4_PATH"
34
- wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
35
- wget --quiet "$P4WHENCE/bin.linux26x86_64/p4"
36
- chmod u+x p4d
37
- chmod u+x p4
38
- popd
33
+ wget --quiet --directory-prefix="$P4_PATH" \
34
+ "$P4WHENCE/bin.linux26x86_64/p4d" "$P4WHENCE/bin.linux26x86_64/p4"
35
+ chmod u+x "$P4_PATH/p4d" "$P4_PATH/p4"
36
37
mkdir --parents "$GIT_LFS_PATH"
41
- pushd "$GIT_LFS_PATH"
42
- wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
43
- tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
44
- cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
45
- popd
38
+ wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
39
+ tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
40
+ -C "$GIT_LFS_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
41
+ rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
42
;;
43
macos-*)
44
export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
@@ -53,11 +49,10 @@ macos-*)
49
brew link --force gettext
50
51
mkdir -p "$P4_PATH"
56
- pushd "$P4_PATH"
57
- wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
58
- tar -xf helix-core-server.tgz &&
59
- sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
60
- popd
52
+ wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
53
+ tar -xf helix-core-server.tgz -C "$P4_PATH" p4 p4d &&
54
+ sudo xattr -d com.apple.quarantine "$P4_PATH/p4" "$P4_PATH/p4d" 2>/dev/null || true
55
+ rm helix-core-server.tgz
56
57
if test -n "$CC_PACKAGE"
58
then