From 4a83142a4e36d64a35d589ba7a238207674787ab Mon Sep 17 00:00:00 2001 From: badra001 Date: Mon, 12 May 2025 11:16:23 -0400 Subject: [PATCH] add multi-gitter --- multi-gitter-release/.gitignore | 2 + multi-gitter-release/README.md | 1 + multi-gitter-release/VERSION | 1 + multi-gitter-release/get.sh | 73 +++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 multi-gitter-release/.gitignore create mode 100644 multi-gitter-release/README.md create mode 100644 multi-gitter-release/VERSION create mode 100755 multi-gitter-release/get.sh diff --git a/multi-gitter-release/.gitignore b/multi-gitter-release/.gitignore new file mode 100644 index 00000000..23684887 --- /dev/null +++ b/multi-gitter-release/.gitignore @@ -0,0 +1,2 @@ +*.tar.gz +multi-gitter_*/ diff --git a/multi-gitter-release/README.md b/multi-gitter-release/README.md new file mode 100644 index 00000000..c8c8efbb --- /dev/null +++ b/multi-gitter-release/README.md @@ -0,0 +1 @@ +https://github.com/lindell/multi-gitter/releases/download/v0.57.1/multi-gitter_0.57.1_Linux_x86_64.tar.gz diff --git a/multi-gitter-release/VERSION b/multi-gitter-release/VERSION new file mode 100644 index 00000000..d139b327 --- /dev/null +++ b/multi-gitter-release/VERSION @@ -0,0 +1 @@ +0.57.1 diff --git a/multi-gitter-release/get.sh b/multi-gitter-release/get.sh new file mode 100755 index 00000000..773dfcd4 --- /dev/null +++ b/multi-gitter-release/get.sh @@ -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