75 lines
1.8 KiB
Bash
Executable File
75 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
#echo $1
|
|
#exit 0
|
|
|
|
|
|
LANG="en_us_8859_1";
|
|
dateJ=`date "+%Y-%m-%d"`;
|
|
dateH=`date "+%a %b %d %Y"`;
|
|
|
|
|
|
if [[ $1 ]] && [ ${1##*.} == "spec" ]
|
|
then
|
|
specfile=$1
|
|
else
|
|
specfile=`grep '\.spec' ./CVS/Entries|cut -d'/' -f2`
|
|
fi
|
|
|
|
echo "search for release in $specfile";
|
|
# could be
|
|
#%define main_release 12.6
|
|
#%define release 2
|
|
#%define release 2%{?dist}
|
|
#Release: 24
|
|
#Release: 24%{?dist}
|
|
rele=0;
|
|
release=`cat $specfile|egrep '^%define (main_)?release'|cut -d " " -f3|cut -d% -f1`;
|
|
if [[ ! $release ]]; then
|
|
release=`cat $specfile|egrep '^Release:'|cut -d ":" -f2| tr -d "[:space:]"|cut -d% -f1`;
|
|
rele=1;
|
|
fi
|
|
|
|
echo "search for version in $specfile";
|
|
#%define version 23
|
|
#Version: 23
|
|
version=`cat $specfile|grep -i '%define version'|cut -d " " -f3|cut -d% -f1`;
|
|
if [[ ! $version ]]; then
|
|
version=`cat $specfile|egrep '^Version:'|cut -d ":" -f2| tr -d "[:space:]"`;
|
|
fi
|
|
|
|
|
|
|
|
echo "update release";
|
|
oldrelease=$release;
|
|
#release=$(($release + 1));# do not handle float
|
|
#release=`echo "$release + 1"|bc`; # not always available
|
|
addme=1;
|
|
if [[ "$release" =~ ^[0-9]+\.[0-9]+$ ]]
|
|
then
|
|
addme=0.1;
|
|
fi
|
|
release=`lua -e "print( $release + $addme)"`;
|
|
echo "update release $oldrelease ==> $release";
|
|
if [ "$rele" -eq "0" ]; then
|
|
cat $specfile |sed -r "s/(^%define (main_)?release) *$oldrelease/\1 $release/">$specfile.tmp;
|
|
else
|
|
cat $specfile |sed -r "s/(^Release:) *$oldrelease/\1 $release/">$specfile.tmp;
|
|
fi
|
|
cat $specfile.tmp > $specfile;
|
|
|
|
echo "updating changelog $specfile";
|
|
entete="* $dateH Brian Read <brianr@bjsystems.co.uk> $version-$release.sme"
|
|
changelog="- fix [SME: ]"
|
|
cat $specfile |sed "/^%changelog/a $entete\n$changelog\n" >$specfile.tmp;
|
|
cat $specfile.tmp>$specfile;
|
|
rm -f $specfile.tmp
|
|
echo "nano $specfile"
|
|
# and check for old directory
|
|
if [ -d "*.old" ]; then
|
|
echo "old found"
|
|
else
|
|
echo "***Remember to make the old directory!!***"
|
|
fi
|