From 23fc4793001e4de920bb8dae280133f4467a7797 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 30 Jul 2023 11:05:00 -0400 Subject: [PATCH] ; Fix admin/upload-manuals script * admin/upload-manuals (html_mono): Chdir to the right directory before committing. (html_node): Avoid computing $stale in newly-created or empty directories. --- admin/upload-manuals | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/admin/upload-manuals b/admin/upload-manuals index 6f44456efb8..a206177a5c1 100755 --- a/admin/upload-manuals +++ b/admin/upload-manuals @@ -305,13 +305,14 @@ done ## TODO: check for removed manuals. [ "$clist" ] && ( - cd $webdir/manual/html_mono + cd $webdir/manual [ "$new" ] && { echo "Adding new files: $new" $cvs add $new || die "add error" new_manual $new || die echo "Remember to add new entries to manual/index.html" } + cd html_mono $cvs commit -m "$message" $clist || die "commit error" ) @@ -339,9 +340,13 @@ for d in html_node/*; do done stale= - for f in $webdir/manual/$d/*.html; do - [ -e ${f#$webdir/manual/} ] || stale="$stale ${f##*/}" - done + # Newly created directory will have no HTML files, so none can be + # "stale". But 'for' returns the original wildcard, so avoid that. + ls $webdir/manual/$d/*.html > /dev/null 2>&1 && { + for f in $webdir/manual/$d/*.html; do + [ -e ${f#$webdir/manual/} ] || stale="$stale ${f##*/}" + done + } mv $d/*.html $webdir/manual/$d/ -- 2.39.2