This commit is contained in:
milisbir 2018-07-21 00:28:55 +03:00
parent 05d17d53d7
commit 370d566cac
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,65 @@
#!/bin/bash
vercomp () {
if [[ $1 == $2 ]]
then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
return 2
fi
done
return 0
}
testvercomp () {
vercomp $1 $2
case $? in
0) op='=';;
1) op='>';;
2) op='<';;
esac
echo $1 $op $2
}
_repo="firehol/firehol"
get_latest_release() {
curl -k --silent "https://api.github.com/repos/$1/releases/latest" \
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
function surum_takip
{
local _talimat _ENSON surum isim
_talimat=firehol
isim=firehol
surum=`grep "surum=" $talimatname/genel/${_talimat:0:1}/$_talimat/talimat | cut -d'=' -f2`
ENSON=$(get_latest_release $_repo)
ENSON=${ENSON:1} # eğer v1.2 gibi başında v harfi ile dönüş veriyorsa
testvercomp $surum $ENSON
}

View File

@ -5,7 +5,7 @@
isim=firehol isim=firehol
surum=3.1.3 surum=3.1.3
devir=1.0 devir=1
kaynak=(https://github.com/firehol/firehol/releases/download/v3.1.3/firehol-3.1.3.tar.xz) kaynak=(https://github.com/firehol/firehol/releases/download/v3.1.3/firehol-3.1.3.tar.xz)
derle() { derle() {