From a147bd1592845103e4aa73a3419cba38f143d050 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Sun, 23 Jul 2023 21:32:11 +0530 Subject: [PATCH] feat(packaging_aur): create utils script --- package/aur/utils.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 package/aur/utils.sh diff --git a/package/aur/utils.sh b/package/aur/utils.sh new file mode 100644 index 0000000..21d5dc3 --- /dev/null +++ b/package/aur/utils.sh @@ -0,0 +1,17 @@ +function increment_version() { + local v=$1 + if [ -z $2 ]; then + local rgx='^((?:[0-9]+\.)*)([0-9]+)($)' + else + local rgx='^((?:[0-9]+\.){'$(($2-1))'})([0-9]+)(\.|$)' + for (( p=`grep -o "\."<<<".$v"|wc -l`; p<$2; p++)); do + v+=.0; done; fi + val=`echo -e "$v" | perl -pe 's/^.*'$rgx'.*$/$2/'` + echo "$v" | perl -pe s/$rgx.*$'/${1}'`printf %0${#val}s $(($val+1))`/ +} + +function get_current_version() { + current_version=`cat PKGBUILD.git | grep pkgver | head -n 1 | cut -d '=' -f 2` + + printf current_version +}