diff --git a/percona-packaging/scripts/pg_stat_monitor_builder.sh b/percona-packaging/scripts/pg_stat_monitor_builder.sh index 92986dc..052e308 100644 --- a/percona-packaging/scripts/pg_stat_monitor_builder.sh +++ b/percona-packaging/scripts/pg_stat_monitor_builder.sh @@ -92,6 +92,30 @@ add_percona_yum_repo(){ return } +set_changelog(){ + if [ -z $1 ] + then + echo "No spec file is provided" + return + else + start_line=0 + while read -r line; do + (( start_line++ )) + if [ "$line" = "%changelog" ] + then + (( start_line++ )) + echo "$start_line" + current_date=$(date +"%a %b %d %Y") + sed -i "$start_line,$ d" $1 + echo "* $current_date Percona Build/Release Team - ${VERSION}-${RPM_RELEASE}" >> $1 + echo "- Release ${VERSION}-${RPM_RELEASE}" >> $1 + echo >> $1 + return + fi + done <$1 + fi +} + get_sources(){ cd "${WORKDIR}" if [ "${SOURCE}" = 0 ] @@ -137,6 +161,8 @@ get_sources(){ sed -i "s:@@RPM_RELEASE@@:${RPM_RELEASE}:g" rpm/pg-stat-monitor.spec sed -i "s:@@VERSION@@:${VERSION}:g" rpm/pg-stat-monitor.spec + set_changelog rpm/pg-stat-monitor.spec + cd ${WORKDIR} # source pg-stat-monitor.properties