diff --git a/bin/bscommitupdates b/bin/bscommitupdates index f91b942b8cd87ed3a342f889cf791be50799887b..d34391c8c500e22401248d1afb30f4fd93874ab4 100755 --- a/bin/bscommitupdates +++ b/bin/bscommitupdates @@ -81,25 +81,25 @@ done for DIST in $DISTS do for REPO in $REPOS - do + do case $REPO in - "testing") - ADV="/afs/cern.ch/project/linux/www/updates/$DIST/$TODAY-test.file" - REPO_DEST_PATH="updates/$DIST/test/" - ;; - "updates") - ADV="/afs/cern.ch/project/linux/www/updates/$DIST/$TODAY.file" - REPO_DEST_PATH="updates/$DIST/prod/" - ;; - *) - echo -e $ROUGE "*** $DIST/$REPO not configured to commit updates"; - continue - ;; - esac + "testing") + ADV="/afs/cern.ch/project/linux/www/updates/$DIST/$TODAY-test.file" + REPO_DEST_PATH="updates/$DIST/test/" + ;; + "updates") + ADV="/afs/cern.ch/project/linux/www/updates/$DIST/$TODAY.file" + REPO_DEST_PATH="updates/$DIST/prod/" + ;; + *) + echo -e $ROUGE "*** $DIST/$REPO not configured to commit updates"; + continue + ;; + esac # Use a temp directory that we later delete TMPDIR=$(mktemp -d) # This file would have already been generated by bsmailusers, we only use the production file - + if [ ! -s "$ADV" ]; then echo "There are no updates, no need to commit a file" exit 0 @@ -119,12 +119,12 @@ do i=1 while IFS= read -r LINE do - test $i -eq 1 && ((i=i+1)) && continue - # Split table variables to ease future css styling if needed, much more readable than one-liners - PACKAGE="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $5}')" - ADVTYPE="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $3}')" - ADVURL="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $7}')" - echo "$PACKAGE | $ADVTYPE $ADVURL | " >> "$TMPDIR"/.updates + test $i -eq 1 && ((i=i+1)) && continue + # Split table variables to ease future css styling if needed, much more readable than one-liners + PACKAGE="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $5}')" + ADVTYPE="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $3}')" + ADVURL="$(echo $LINE | awk -F "</*td>|</*tr>" '/<\/*t[rd]>.*/ {print $7}')" + echo "$PACKAGE | $ADVTYPE $ADVURL | " >> "$TMPDIR"/.updates done < $ADV echo >> "$TMPDIR"/.updates