shorewall_code/tools/build/setversion

41 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/sh
[ $# -eq 1 ] || { echo "usage: setversion <version>" >&2; exit 1; }
VERSION=$1
case $VERSION in
*.*.*.*)
RELEASE=${VERSION##*.}
RPMVERSION=${VERSION%.*}-${RELEASE}
SUFFIX="-$RELEASE"
;;
*)
RPMVERSION=${VERSION}
RELEASE=1
SUFFIX=
;;
esac
for product in common lite shell perl; do
dir=Shorewall-${product}${SUFFIX}
for file in $dir/install.sh $dir/uninstall.sh $dir/fallback.sh; do
[ -f $file ] && eval perl -p -i -e "'s/^VERSION=.*/VERSION=${VERSION}/'" $file
done
file=$dir/shorewall-${product}.spec
[ -f $file ] && eval perl -n -i -e "'s/^%define version .*/%define version ${RPMVERSION}/; \
s/^%define release .*/%define release ${RELEASE}/; \
print \$_; \
if ( /%changelog/ ) {\
print \"\* $(date +'%a %b %d %Y') Tom Eastep tom\\@shorewall.net\\n\"; \
print \"- Updated to ${RPMVERSION}-${RELEASE}\\n\"; \
}'" $file
done
file=Shorewall-perl${SUFFIX}/Shorewall/Config.pm
[ -f $file ] && eval perl -p -i -e "'s/^(\s+)VERSION => .*/\$1VERSION => \"${VERSION}\",/'" $file