Tuesday, 2 October 2018

Shorter Method of re-packaging debian build

#!/bin/bash

var1=$(awk 'NR==2{print $2}' raspbian-stretch/eyemagnet-monitoring-nagios-naveed2/DEBIAN/control | head -c 3 | tail -c 1)
var2=$(awk 'NR==2{print $2}' raspbian-stretch/eyemagnet-monitoring-nagios-naveed2/DEBIAN/control | head -c 1)
var3=$(($var1 + 1))
if [ $var3 -gt 9 ]
then
  var2=$(($var2 + 1))
  var3=0
fi
version="$var2.$var3"
echo
echo "New version is $version"
sed -i "2s/.*/Version: $version/" raspbian-stretch/eyemagnet-monitoring-nagios-naveed2/DEBIAN/control
echo
dpkg-deb -Z xz -b raspbian-stretch/eyemagnet-monitoring-nagios-naveed2/ .
echo
exit 0

No comments:

Post a Comment