-#!/bin/sh -e
+#!/bin/ksh -e
# Usage:
-# Just run this script in your rpm/packages/rpm-build-tools directory.
+# Just run this script in your rpm/packages/rpm-build-tools directory with
+# no arguments to release new version of rpm-build-tools.
+# Run "update.sh clean" to clean all local modifications.
+
+# Note:
+# shebang is /bin/ksh, because arrays are non-posix bash/ksh extension.
die() {
>&2 printf '*** '${1:+"$@\n"}
dst[1]=${src[1]}
dst[2]=builder.sh
dst[3]=${src[3]}
+dst[4]=${src[4]}
+
+#
+# parse args
+#
+
+if [ "$1" = "clean" ]; then
+ rm ${dst[@]}
+ cvs up ${dst[@]}
+ exit 0
+fi
#
# Checkout on involved files and check for local modifications.
LOG=""
msg "Checking wich files need update."
for I in 0 1 2 3; do
- if [ "$(diff -q ../${src[$I]} ${dst[$I]})" ]; then
+ if [ "$(diff -I'$Id[:] ' -I'$Revision[:] ' ../${src[$I]} ${dst[$I]})" ]; then
cat ../${src[$I]} > ${dst[$I]}
LOG="$LOG- ${dst[$I]} up to ${rev[$I]}\n"
fi
# Show changes and ask user for confirmation.
#
-cvs di -u | diffcol | ${PAGER:-'less -r'}
+cvs di -u ${dst[@]} | diffcol | ${PAGER:-'less -r'}
printf "Commit log:\n$LOG\nCommit (Yes, No)? "
read ans
case "$ans" in
[yY])
- cvs ci -m "$(printf $LOG)" ${dst[0]} ${dst[1]} ${dst[2]} ${dst[3]} ;;
+ cvs ci -m "$(printf "$LOG")" ${dst[@]} ;;
*)
msg ":(" ;;
esac