-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.tar.gz | ||
| multi-gitter_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| https://github.com/lindell/multi-gitter/releases/download/v0.57.1/multi-gitter_0.57.1_Linux_x86_64.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0.57.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #!/bin/bash | ||
|
|
||
| THIS_VERSION="1.0.0" | ||
| THIS=$(basename $0) | ||
|
|
||
| ARG=$1 | ||
|
|
||
| REPONAME="lindell" | ||
| BINNAME="multi-gitter" | ||
| PROGNAME=$BINNAME | ||
| OS="Linux_x86_64" | ||
| URL="https://github.com/$REPONAME/$BINNAME/releases/download/v%%VERSION%%/${BINNAME}_%%VERSION%%_${OS}.tar.gz" | ||
|
|
||
| if [ -z $VERSION ] | ||
| then | ||
| version=$(cat VERSION) | ||
| fi | ||
| v_major=$(echo $version| awk -F\. '{print $1 "." $2}') | ||
| v_minor=$(echo $version| awk -F\. '{print $3}') | ||
| v_minor_next=$(( $v_minor + 1 )) | ||
| version_next="${v_major}.${v_minor_next}" | ||
|
|
||
| if [[ $ARG == "current" ]] | ||
| then | ||
| version_next=$version | ||
| fi | ||
|
|
||
| if [[ -z $ARG ]] || [[ $ARG == "get" ]] || [[ $ARG == "current" ]] | ||
| then | ||
| T_URL=$(echo $URL | sed -e "s/%%VERSION%%/$version_next/g") | ||
| file="$(basename $T_URL)" | ||
| echo "* old $version, attempting next version $version_next" | ||
| curl -L -s -f -k "$T_URL" -o $file 2> /dev/null | ||
| if [ $? == 0 ] | ||
| then | ||
| echo $version_next > VERSION | ||
| echo "* downloaded new version $version_next" | ||
| echo "* install new version with:" | ||
| echo " ./$THIS install" | ||
| else | ||
| T_URL=$(echo $URL | sed -e "s/%%VERSION%%/$version/g") | ||
| echo "* version $version is current" | ||
| file="$(basename $T_URL)_$version" | ||
| if [ ! -r $file ] | ||
| then | ||
| echo "* downloading current version $version" | ||
| curl -L -s -f -k "$T_URL" -o $file 2> /dev/null | ||
| status=$? | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| if [[ $ARG == "install" ]] | ||
| then | ||
| T_URL=$(echo $URL | sed -e "s/%%VERSION%%/$version/g") | ||
| file="$(basename $T_URL)" | ||
| tfbin=$(which $PROGNAME 2> /dev/null) | ||
| if [ ! -z $tfbin ] | ||
| then | ||
| BINDIR=$(dirname $tfbin) | ||
| elif [ -z $BINDIR ] | ||
| then | ||
| echo "x unable to locate current $BINNAME binary, use BINDIR=path to install" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "* installing $PROGNAME $version into $BINDIR" | ||
| umask 022 | ||
| mkdir -p ${PROGNAME}_${version}_${OS} | ||
| tar -xzvf $file --directory ${PROGNAME}_${version}_${OS}/ | ||
| cp ${PROGNAME}_${version}_${OS}/${PROGNAME} $BINDIR/${PROGNAME}_${version} && ln -sf ${PROGNAME}_${version} $BINDIR/$PROGNAME | ||
| chmod 755 $BINDIR/${PROGNAME}_${version} | ||
| fi |