chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
Justin Vreeland 794d92
#!/bin/sh
Justin Vreeland 794d92
# rpmdev-bumpspec 'helpfully' bumps the release which we don't always want.
Justin Vreeland 794d92
# This script fixes it up.
Justin Vreeland 794d92
Justin Vreeland 794d92
RELEASE=`grep "%global baserelease" kernel.spec | cut -d ' ' -f 3`
Justin Vreeland 794d92
export RELEASE=$(($RELEASE-1))
Justin Vreeland 794d92
perl -p -i -e 's|%global baserelease.*|%global baserelease $ENV{'RELEASE'}|' kernel.spec
Justin Vreeland 794d92
TODAY=`date +"%a %b %d %Y"`
Justin Vreeland 794d92
awk -v DATE="$TODAY" 'START { marked = 0; } $0 ~ DATE { if (marked == 1) { print $0 } else {out=$1; for(i = 2; i <= NF - 2; i++) { out=out" "$i } print out; marked = 1;  } } $0 !~ DATE { print $0; }' < kernel.spec > kernel.spec.tmp
Justin Vreeland 794d92
mv kernel.spec.tmp kernel.spec