Skip to content

Commit

Permalink
add multi-gitter
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed May 12, 2025
1 parent e538357 commit 4a83142
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions multi-gitter-release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tar.gz
multi-gitter_*/
1 change: 1 addition & 0 deletions multi-gitter-release/README.md
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
1 change: 1 addition & 0 deletions multi-gitter-release/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.57.1
73 changes: 73 additions & 0 deletions multi-gitter-release/get.sh
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

0 comments on commit 4a83142

Please sign in to comment.