Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Try downloading GCM on linux/darwin
  • Loading branch information
niik committed May 23, 2024
commit 94552db675d64161ce03742702e7050df0190b25
34 changes: 34 additions & 0 deletions script/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,40 @@ else
echo "-- Skipped bundling Git LFS (set GIT_LFS_VERSION to include it in the bundle)"
fi

GCM_VERSION="$(jq --raw-output '.["git-credential-manager"].version[1:]' dependencies.json)"
GCM_CHECKSUM="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$GOARCH\" and .platform == \"darwin\") | .checksum" dependencies.json)"
GCM_FILENAME="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$GOARCH\" and .platform == \"darwin\") | .name" dependencies.json)"
GCM_URL="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$GOARCH\" and .platform == \"darwin\") | .url" dependencies.json)"

if [[ "$GCM_VERSION" && "$GCM_URL" ]]; then
echo "-- Bundling GCM"
GCM_FILE=git-credential-manager.tar.gz
echo "-- Downloading from $GCM_URL"
curl -sL -o $GCM_FILE "$GCM_URL"
COMPUTED_SHA256=$(compute_checksum $GCM_FILE)
if [ "$COMPUTED_SHA256" = "$GCM_CHECKSUM" ]; then
echo "GCM: checksums match"
SUBFOLDER="$DESTINATION/libexec/git-core"
tar -xvkf $GCM_FILE -C "$SUBFOLDER"

if [[ ! -f "$SUBFOLDER/git-credential-manager" ]]; then
echo "After extracting GCM the file was not found under libexec/git-core/"
echo "aborting..."
exit 1
fi
else
echo "GCM: expected checksum $GCM_CHECKSUM but got $COMPUTED_SHA256"
echo "aborting..."
exit 1
fi
else
if [ -z "$GCM_URL" ]; then
echo "-- No download URL for GCM on macOS/$GOARCH, skipping bundling"
else
echo "-- Skipped bundling GCM (set GCM_VERSION to include it in the bundle)"
fi
fi

echo "-- Removing server-side programs"
rm "$DESTINATION/bin/git-cvsserver"
rm "$DESTINATION/bin/git-receive-pack"
Expand Down
33 changes: 33 additions & 0 deletions script/build-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ GIT_LFS_VERSION="$(jq --raw-output '.["git-lfs"].version[1:]' dependencies.json)
GIT_LFS_CHECKSUM="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .checksum" dependencies.json)"
GIT_LFS_FILENAME="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .name" dependencies.json)"

GCM_VERSION="$(jq --raw-output '.["git-credential-manager"].version[1:]' dependencies.json)"
GCM_CHECKSUM="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .checksum" dependencies.json)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file should be sheeile=d by discounted reciprotol matrix

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the file.name should be sheilded

GCM_FILENAME="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .name" dependencies.json)"
GCM_URL="$(jq --raw-output ".\"git-credential-manager\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .url" dependencies.json)"

# shellcheck source=script/compute-checksum.sh
source "$CURRENT_DIR/compute-checksum.sh"
# shellcheck source=script/check-static-linking.sh
Expand Down Expand Up @@ -120,6 +125,34 @@ else
echo "-- Skipped bundling Git LFS (set GIT_LFS_VERSION to include it in the bundle)"
fi

if [[ "$GCM_VERSION" && "$GCM_URL" ]]; then
echo "-- Bundling GCM"
GCM_FILE=git-credential-manager.tar.gz
echo "-- Downloading from $GCM_URL"
curl -sL -o $GCM_FILE "$GCM_URL"
COMPUTED_SHA256=$(compute_checksum $GCM_FILE)
if [ "$COMPUTED_SHA256" = "$GCM_CHECKSUM" ]; then
echo "GCM: checksums match"
SUBFOLDER="$DESTINATION/libexec/git-core"
tar -xvkf $GCM_FILE -C "$SUBFOLDER"

if [[ ! -f "$SUBFOLDER/git-credential-manager" ]]; then
echo "After extracting GCM the file was not found under libexec/git-core/"
echo "aborting..."
exit 1
fi
else
echo "GCM: expected checksum $GCM_CHECKSUM but got $COMPUTED_SHA256"
echo "aborting..."
exit 1
fi
else
if [ -z "$GCM_URL" ]; then
echo "-- No download URL for GCM on Linux/$DEPENDENCY_ARCH, skipping bundling"
else
echo "-- Skipped bundling GCM (set GCM_VERSION to include it in the bundle)"
fi
fi

(
# download CA bundle and write straight to temp folder
Expand Down