40 lines
783 B
Bash
Executable File
40 lines
783 B
Bash
Executable File
#!/bin/bash
|
|
|
|
NAME="crystal"
|
|
VERSION="0.28.0"
|
|
REV="1"
|
|
ARCH="x86_64"
|
|
PREFIX="/usr"
|
|
TMP="/tmp"
|
|
URL="https://github.com/crystal-lang/crystal/releases/download/${VERSION}/${NAME}-${VERSION}-${REV}-linux-${ARCH}.tar.gz"
|
|
|
|
|
|
|
|
download_(){
|
|
if [ ! -f ${TMP}/${NAME}-${VERSION}-${REV}-linux-${ARCH}.tar.gz ];then
|
|
printf "Downloading ${NAME}-${VERSION}-${ARCH}...\n"
|
|
wget ${URL} -P ${TMP}
|
|
|
|
else
|
|
echo "${NAME}-${VERSION}-${REV}-linux-${ARCH}tar.gz" exists
|
|
fi
|
|
}
|
|
|
|
extract_(){
|
|
printf "Ectracting archive file to ${TMP}...\n"
|
|
cd ${TMP}
|
|
tar -xzvf ${NAME}-${VERSION}-${REV}-linux-${ARCH}.tar.gz
|
|
}
|
|
|
|
install_(){
|
|
printf "Copying files to system..\n"
|
|
cd ${TMP}/${NAME}-${VERSION}-${REV}
|
|
cp -r {bin,lib,share} ${PREFIX}/
|
|
|
|
}
|
|
|
|
|
|
download_
|
|
extract_
|
|
install_
|