SCRIPTS: announce-release: allow the user to force to overwrite old files
When starting the script multiple times, one had to remove the previous files by hand. Now with -f it's not needed anymore, they get removed.
This commit is contained in:
parent
0f5ce6014a
commit
3823408b60
|
@ -10,7 +10,8 @@
|
||||||
# - creates web-$version.html
|
# - creates web-$version.html
|
||||||
# - indicates how to edit the mail and how to send it
|
# - indicates how to edit the mail and how to send it
|
||||||
|
|
||||||
USAGE="Usage: ${0##*/} [-b branch] [-d date] [-o oldver] [-n newver]"
|
USAGE="Usage: ${0##*/} [-f] [-b branch] [-d date] [-o oldver] [-n newver]"
|
||||||
|
FORCE=
|
||||||
OUTPUT=
|
OUTPUT=
|
||||||
BRANCH=
|
BRANCH=
|
||||||
HTML=
|
HTML=
|
||||||
|
@ -38,6 +39,7 @@ while [ -n "$1" -a -z "${1##-*}" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-d) DATE="$2" ; shift 2 ;;
|
-d) DATE="$2" ; shift 2 ;;
|
||||||
-b) BRANCH="$2" ; shift 2 ;;
|
-b) BRANCH="$2" ; shift 2 ;;
|
||||||
|
-f) FORCE=1 ; shift ;;
|
||||||
-o) OLD="$2" ; shift 2 ;;
|
-o) OLD="$2" ; shift 2 ;;
|
||||||
-n) NEW="$2" ; shift 2 ;;
|
-n) NEW="$2" ; shift 2 ;;
|
||||||
-h|--help) quit "$USAGE" ;;
|
-h|--help) quit "$USAGE" ;;
|
||||||
|
@ -108,13 +110,16 @@ fi
|
||||||
YEAR="${DATE%%/*}"
|
YEAR="${DATE%%/*}"
|
||||||
|
|
||||||
OUTPUT="$DIR/mail-haproxy-$NEW.txt"
|
OUTPUT="$DIR/mail-haproxy-$NEW.txt"
|
||||||
|
HTML="$DIR/web-haproxy-$NEW.html"
|
||||||
|
|
||||||
|
[ -z "$FORCE" ] || rm -f "${OUTPUT}" "${HTML}"
|
||||||
|
|
||||||
if [ -e "$OUTPUT" ]; then
|
if [ -e "$OUTPUT" ]; then
|
||||||
die "$OUTPUT already exists, please remove it."
|
die "${OUTPUT##*/} already exists, please remove it or retry with -f."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HTML="$DIR/web-haproxy-$NEW.html"
|
|
||||||
if [ -e "$HTML" ]; then
|
if [ -e "$HTML" ]; then
|
||||||
die "$HTML already exists, please remove it."
|
die "$HTML already exists, please remove it or retry with -f."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue