mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
code review: use download_with_retries, remove custom tmp dir, set -e
Signed-off-by: Paolo Mainardi <paolo.mainardi@sparkfabrik.com>
This commit is contained in:
@@ -13,7 +13,7 @@ download_with_retries() {
|
|||||||
local NAME="${3:-${URL##*/}}"
|
local NAME="${3:-${URL##*/}}"
|
||||||
local COMPRESSED="$4"
|
local COMPRESSED="$4"
|
||||||
|
|
||||||
if [ $COMPRESSED == "compressed" ]; then
|
if [[ $COMPRESSED == "compressed" ]]; then
|
||||||
COMMAND="curl $URL -4 -sL --compressed -o '$DEST/$NAME'"
|
COMMAND="curl $URL -4 -sL --compressed -o '$DEST/$NAME'"
|
||||||
else
|
else
|
||||||
COMMAND="curl $URL -4 -sL -o '$DEST/$NAME'"
|
COMMAND="curl $URL -4 -sL -o '$DEST/$NAME'"
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
## File: git.sh
|
## File: git.sh
|
||||||
## Desc: Installs Git
|
## Desc: Installs Git
|
||||||
################################################################################
|
################################################################################
|
||||||
|
set -e
|
||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source "$HELPER_SCRIPTS"/document.sh
|
source "$HELPER_SCRIPTS"/document.sh
|
||||||
|
source "$HELPER_SCRIPTS"/install.sh
|
||||||
|
|
||||||
## Install git
|
## Install git
|
||||||
add-apt-repository ppa:git-core/ppa -y
|
add-apt-repository ppa:git-core/ppa -y
|
||||||
@@ -46,14 +48,12 @@ DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 |
|
|||||||
DocumentInstalledItem "Git-ftp ($(git-ftp --version | cut -d ' ' -f 3))"
|
DocumentInstalledItem "Git-ftp ($(git-ftp --version | cut -d ' ' -f 3))"
|
||||||
|
|
||||||
#Install hub
|
#Install hub
|
||||||
TEMP_HUB=$(mktemp -d -t)
|
tmp_hub="/tmp/hub"
|
||||||
pushd "$TEMP_HUB" || exit
|
mkdir -p "$tmp_hub"
|
||||||
URL=$(curl -s https://api.github.com/repos/github/hub/releases/latest | jq -r '.assets[].browser_download_url | select(contains("hub-linux-amd64"))')
|
url=$(curl -s https://api.github.com/repos/github/hub/releases/latest | jq -r '.assets[].browser_download_url | select(contains("hub-linux-amd64"))')
|
||||||
wget -P "$TEMP_HUB" "$URL"
|
download_with_retries "$url" "$tmp_hub"
|
||||||
tar xzvf "$TEMP_HUB"/hub-linux-amd64-*.tgz --strip-components 1
|
tar xzvf /tmp/hub-linux-amd64-*.tgz --strip-components 1 -C "$tmp_hub"
|
||||||
mv bin/hub /usr/local/bin
|
mv "$tmp_hub"/bin/hub /usr/local/bin
|
||||||
rm -rf "$TEMP_HUB"
|
|
||||||
popd || exit
|
|
||||||
|
|
||||||
if command -v hub; then
|
if command -v hub; then
|
||||||
echo "hub CLI was installed successfully"
|
echo "hub CLI was installed successfully"
|
||||||
|
|||||||
Reference in New Issue
Block a user