shorewall_code/tools/build/setversion

39 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/sh
[ $# -eq 1 ] || { echo "usage: setversion <version>" >&2; exit 1; }
VERSION=$1
for product in common lite shell perl; do
eval perl -p -i -e "'s/VERSION=.*/VERSION=$1/'" Shorewall-${product}/install.sh
done
for product in common lite; do
eval perl -p -i -e "'s/^VERSION=.*/VERSION=$1/'" Shorewall-${product}/uninstall.sh Shorewall-${product}/fallback.sh
done
case $VERSION in
*.*.*.*)
RELEASE=${VERSION##*.}
RPMVERSION=${VERSION%.*}-${RELEASE}
;;
*)
RPMVERSION=${VERSION}
RELEASE=1
;;
esac
for product in common lite shell perl; do
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\"; \
}'" Shorewall-${product}/shorewall-${product}.spec
done
eval perl -p -i -e "'s/^(\s+)VERSION => .*/\$1VERSION => \"$1\",/'" Shorewall-perl/Shorewall/Config.pm