Skip to content

Commit

Permalink
[ci skip] fix perl-install
Browse files Browse the repository at this point in the history
  • Loading branch information
skaji committed Oct 7, 2024
1 parent 250a909 commit dc5f183
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions perl-install
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ if [[ $_ARCH = aarch64 ]]; then
_ARCH=arm64
fi

TAR_CMD=gtar
if ! type $TAR_CMD &>/dev/null; then
TAR_CMD=tar
if ! type $TAR_CMD &>/dev/null; then
die 'Cannot find `tar` command'
fi
fi

TAR_OPTION=xzf
TAR_SUFFIX=tar.gz
COMPRESS_TYPE=gz
if type xz &>/dev/null; then
TAR_OPTION=xJf
TAR_SUFFIX=tar.xz
COMPRESS_TYPE=xz
fi

if type curl &>/dev/null; then
HTTP_GET=curl
HTTP_GET_OPTION='-fsSL'
Expand All @@ -37,7 +54,7 @@ else
die 'Cannot find `curl` nor `wget`'
fi

LATEST_LINE=$($HTTP_GET $HTTP_GET_OPTION https://raw.githubusercontent.com/skaji/relocatable-perl/main/releases.csv | (\grep -m 1 ,$_OS,$_ARCH,; cat >/dev/null))
LATEST_LINE=$($HTTP_GET $HTTP_GET_OPTION https://raw.githubusercontent.com/skaji/relocatable-perl/main/releases.csv | (\grep -m 1 ,$_OS,$_ARCH,$COMPRESS_TYPE; cat >/dev/null))
if [[ -z $LATEST_LINE ]]; then
die "Failed to determine latest perl version"
fi
Expand All @@ -49,21 +66,6 @@ if [[ $PRINT_VERSION = "YES" ]]; then
exit
fi

TAR_CMD=gtar
if ! type $TAR_CMD &>/dev/null; then
TAR_CMD=tar
if ! type $TAR_CMD &>/dev/null; then
die 'Cannot find `tar` command'
fi
fi

TAR_OPTION=xzf
TAR_SUFFIX=tar.gz
if type xz &>/dev/null; then
TAR_OPTION=xJf
TAR_SUFFIX=tar.xz
fi

INSTALL_DIR=$1
if [[ -d $INSTALL_DIR ]]; then
[[ -w $INSTALL_DIR ]] || die "You don't have write permission to $INSTALL_DIR"
Expand Down

0 comments on commit dc5f183

Please sign in to comment.