From 52a01fa9119586c01190e40e8c736573f128c4ad Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 14 May 2012 16:26:28 +0200 Subject: [PATCH] properly keep the RSS files existing when clearing --- misc/tools/conflict-rss.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/misc/tools/conflict-rss.sh b/misc/tools/conflict-rss.sh index 5ad6d335..f92fd5e3 100755 --- a/misc/tools/conflict-rss.sh +++ b/misc/tools/conflict-rss.sh @@ -28,7 +28,7 @@ to_rss() repo=" in $repo" fi - filename=`echo -n "$name" | tr -c 'A-Za-z0-9' '_'`.xml + filename=`echo -n "$name" | tr -c 'A-Za-z0-9' '_'`.rss outfilename="$outdir/$filename" datetime=`date --rfc-2822` branch=`echo "$branch" | escape_html` @@ -63,6 +63,11 @@ EOF EOF } +clear_rss() +{ + sed -i -e '//,$d' "$1" +} + finish_rss() { cat <>"$1" @@ -77,8 +82,11 @@ fi case "$action" in --init) - rm -rf "$outdir" mkdir -p "$outdir" + for f in "$outdir"/*; do + [ -f "$f" ] || continue + clear_rss "$f" + done ;; --finish) for f in "$outdir"/*; do -- 2.39.2