From c176b51cec603d00fea6fb660355364ad0cc2d3e Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 27 Mar 2024 01:12:23 -0700 Subject: [PATCH] improve bin tool script shell variable use We export shell variables where needed. We print debug messages of shell variables in the order they were exported or declared, except for the USAGE shell variable, for those shell variables that were exported or declared prior to the set of debug messages of shell variables. Changed `bin/chk-entry.sh` VERSION from "1.1.3 2024-03-18" to "1.1.4 2024-03-26". Changed `bin/gen-authors.sh` VERSION from "1.3.1 2024-03-18" to "1.3.2 2024-03-26". Changed `bin/gen-location.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/gen-other-html.sh` VERSION from "1.0.1 2024-03-08" to "1.0.2 2024-03-26". Changed `bin/gen-sitemap.sh` VERSION from "1.3.2 2024-03-18" to "1.3.3 2024-03-26". Changed `bin/gen-status.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/gen-years.sh` VERSION from "1.0.2 2024-03-13" to "1.0.3 2024-03-26". Changed `bin/md2html.sh` VERSION from "1.1.1 2024-03-09" to "1.1.2 2024-03-26". Changed `bin/output-index-author.sh` VERSION from "1.5.1 2024-03-19" to "1.5.2 2024-03-26". Changed `bin/output-index-inventory.sh` VERSION from "1.2.2 2024-03-19" to "1.2.3 2024-03-26". Changed `bin/output-year-index.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.2 2024-03-19" to "1.5.3 2024-03-26". Changed `bin/quick-readme2index.sh` VERSION from "1.1.2 2024-03-08" to "1.1.3 2024-03-26". Changed `bin/readme2index.sh` VERSION from "1.2.1 2024-02-23" to "1.2.2 2024-02-26". Changed `bin/sort.gitignore.sh` VERSION from "1.1.2 2024-03-18" to "1.1.3 2024-03-26". Changed `bin/status2html.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/subst.default.sh` VERSION from "1.2.1 2024-02-23" to "1.2.2 2024-02-26". Changed `bin/subst.entry-index.sh` VERSION from "1.3.1 2024-03-19" to "1.3.2 2024-03-26". Changed `bin/tar-all.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/tar-entry.sh` VERSION from "1.3.1 2024-03-25" to "1.3.2 2024-03-26". Changed `bin/tar-year.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/all-years.sh` VERSION from "1.0.1 2024-02-23" to "1.0.2 2024-02-26". Changed `bin/gen-top-html.sh` VERSION from "1.2.1 2024-03-08" to "1.2.2 2024-03-26". Changed `bin/gen-year-index.sh` VERSION from "1.0.3 2024-03-09" to "1.0.4 2024-03-26". Changed `bin/subst.year-index.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/untar-entry.sh` VERSION from "1.0 2024-03-25" to "1.0.1 2024-03-26". --- bin/all-run.sh | 5 ++- bin/all-years.sh | 7 +-- bin/chk-entry.sh | 14 +++--- bin/gen-authors.sh | 36 ++++++++++++---- bin/gen-location.sh | 17 ++++++-- bin/gen-other-html.sh | 7 +-- bin/gen-sitemap.sh | 18 ++++---- bin/gen-status.sh | 15 ++++--- bin/gen-top-html.sh | 9 ++-- bin/gen-year-index.sh | 9 ++-- bin/gen-years.sh | 17 +++++--- bin/md2html.sh | 81 ++++++++++++++++++++++------------- bin/output-index-author.sh | 26 +++++++---- bin/output-index-inventory.sh | 12 +++--- bin/output-year-index.sh | 21 ++++----- bin/pandoc-wrapper.sh | 15 ++++--- bin/quick-readme2index.sh | 19 ++++---- bin/readme2index.sh | 19 ++++---- bin/sort.gitignore.sh | 12 +++--- bin/status2html.sh | 6 ++- bin/subst.default.sh | 4 +- bin/subst.entry-index.sh | 22 +++++----- bin/subst.year-index.sh | 11 +++-- bin/tar-all.sh | 18 ++++---- bin/tar-entry.sh | 17 +++++--- bin/tar-year.sh | 17 ++++---- bin/untar-entry.sh | 9 ++-- 27 files changed, 285 insertions(+), 178 deletions(-) diff --git a/bin/all-run.sh b/bin/all-run.sh index a4f5f8299..3d70cc03b 100755 --- a/bin/all-run.sh +++ b/bin/all-run.sh @@ -113,7 +113,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.3.1 2024-02-23" +export VERSION="1.3.2 2024-02-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -420,11 +420,12 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: TOOL=$TOOL" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: TOOL=$TOOL" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi diff --git a/bin/all-years.sh b/bin/all-years.sh index 824ec9f2e..cba825533 100755 --- a/bin/all-years.sh +++ b/bin/all-years.sh @@ -111,7 +111,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.1 2024-02-23" +export VERSION="1.0.2 2024-02-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -410,7 +410,6 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 - echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2 echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2 @@ -420,11 +419,13 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: TOOL=$TOOL" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: TOOL=$TOOL" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 + echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi # -N stops early before any processing is performed diff --git a/bin/chk-entry.sh b/bin/chk-entry.sh index 65e25c3e4..be8b89ceb 100755 --- a/bin/chk-entry.sh +++ b/bin/chk-entry.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.3 2024-03-18" +export VERSION="1.1.4 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -308,6 +308,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -328,7 +329,7 @@ fi # verify we have our awk tool # -FILELIST_ENTRY_JSON_AWK="$BIN_DIR/filelist.entry.json.awk" +export FILELIST_ENTRY_JSON_AWK="$BIN_DIR/filelist.entry.json.awk" if [[ ! -e $FILELIST_ENTRY_JSON_AWK ]]; then echo "$0: ERROR: filelist.entry.json.awk does not exist: $FILELIST_ENTRY_JSON_AWK" 1>&2 exit 5 @@ -357,16 +358,19 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 + echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2 fi @@ -382,7 +386,7 @@ fi # create a temporary file manifest list # -TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" +export TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2 fi @@ -404,7 +408,7 @@ fi # create a temporary find files list # -TMP_FILE_LIST=".$NAME.$$.find.list" +export TMP_FILE_LIST=".$NAME.$$.find.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file manifest list: $TMP_FILE_LIST" 1>&2 fi diff --git a/bin/gen-authors.sh b/bin/gen-authors.sh index 3b311f04c..376260e7e 100755 --- a/bin/gen-authors.sh +++ b/bin/gen-authors.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.3.1 2024-03-18" +export VERSION="1.3.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -403,7 +403,8 @@ function output_location_code # function output_award { - local ENTRY_JSON_PATH; # the .entry.json path + local ENTRY_JSON_PATH; # the .entry.json path + local AWARD_STRING; # winning entry award string # parse args # @@ -427,12 +428,12 @@ function output_award # obtain the award string # - AWARD=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') - if [[ -z $AWARD ]]; then + AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') + if [[ -z $AWARD_STRING ]]; then echo "$0: ERROR: in output_award: no award found in .entry.json file: $ENTRY_JSON_PATH" 1>&2 return 5 fi - echo "$AWARD" + echo "$AWARD_STRING" return 0 } @@ -639,6 +640,7 @@ export BIN_DIR="bin" # find the location tool # LOCATION_TOOL=$(type -P location) +export LOCATION_TOOL if [[ -z $LOCATION_TOOL ]]; then # guess we have a location tool in bin # @@ -671,15 +673,22 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 - echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 + echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + for index in "${!IS_FOR[@]}"; do + echo "$0: debug[3]: IS_FOR[$index]=${IS_FOR[$index]}" 1>&2 + done for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 + echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 + echo "$0: debug[3]: LOCATION_TOOL=$LOCATION_TOOL" 1>&2 + echo "$0: debug[3]: AUTHORS_HTML=$AUTHORS_HTML" 1>&2 fi # -N stops early before any processing is performed @@ -693,7 +702,7 @@ fi # create a temporary entry markdown file # -TMP_AUTHORS_MD=".$NAME.$$.entry.md" +export TMP_AUTHORS_MD=".$NAME.$$.entry.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary entry markdown file: $TMP_AUTHORS_MD" 1>&2 fi @@ -715,7 +724,7 @@ fi # create a temporary sort word list file # -TMP_SORT_WORD=".$NAME.$$.sort.word" +export TMP_SORT_WORD=".$NAME.$$.sort.word" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary sort word list file: $TMP_SORT_WORD" 1>&2 fi @@ -751,6 +760,7 @@ done > "$TMP_SORT_WORD" # find "$AUTHOR_DIR" -mindepth 1 -maxdepth 1 -type f -name '*.json' 2>/dev/null | while read -r json_file; do SORT_WORD=$(grep -F '"sort_word" : "' "$json_file" 2>/dev/null | sed -e 's/",//' -e 's/^.*"//') + export SORT_WORD echo "$SORT_WORD $json_file" done >> "$TMP_SORT_WORD" @@ -835,17 +845,20 @@ EOF exit 15 fi FULL_NAME=$(output_full_name "$filename") + export FULL_NAME if [[ -z $FULL_NAME ]]; then echo "$0: ERROR: full name is empty in: $filename" 1>&2 exit 16 fi LOCATION_CODE=$(output_location_code "$filename") + export LOCATION_CODE if [[ -z $LOCATION_CODE ]]; then echo "$0: ERROR: location code is empty in: $filename" 1>&2 exit 17 fi LOCATION_NAME=$("$LOCATION_TOOL" "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location name" \ "for location ISO 3166 code: $LOCATION_CODE" 1>&2 @@ -858,6 +871,7 @@ EOF fi LOCATION_COMMON_NAME=$("$LOCATION_TOOL" -c "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_COMMON_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location common name" \ "for location ISO 3166 code: $LOCATION_CODE" 1>&2 @@ -869,6 +883,7 @@ EOF exit 21 fi AUTHOR_HANDLE=$(output_author_handle "$filename") + export AUTHOR_HANDLE if [[ -z $AUTHOR_HANDLE ]]; then echo "$0: ERROR: author handle is empty in: $filename" 1>&2 exit 22 @@ -901,6 +916,7 @@ EOF exit 23 fi YYYY_DIR=$(echo "$ENTRY_ID" | tr _ /) + export YYYY_DIR if [[ ! -d $YYYY_DIR ]]; then echo "$0: ERROR: YYYY/dir is not a directory" 1>&2 exit 24 @@ -909,6 +925,7 @@ EOF # verify that the .entry.json file is a non-empty readable file # ENTRY_JSON="$YYYY_DIR/.entry.json" + export ENTRY_JSON if [[ ! -e $ENTRY_JSON ]]; then echo "$0: ERROR: .entry.json does not exist: $ENTRY_JSON" 1>&2 exit 25 @@ -932,6 +949,7 @@ EOF # collect the award for this entry id # AWARD=$(output_award "$ENTRY_JSON") + export AWARD if [[ -z $AWARD ]]; then echo "$0: ERROR: award not found in .entry.json: $ENTRY_JSON" 1>&2 exit 29 diff --git a/bin/gen-location.sh b/bin/gen-location.sh index f9123fdd9..4393d0f12 100755 --- a/bin/gen-location.sh +++ b/bin/gen-location.sh @@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-18" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -368,6 +368,7 @@ fi # find the location tool # LOCATION_TOOL=$(type -P location) +export LOCATION_TOOL if [[ -z $LOCATION_TOOL ]]; then # guess we have a location tool in bin # @@ -400,15 +401,18 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 - echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 + echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 + echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 + echo "$0: debug[3]: LOCATION_TOOL=$LOCATION_TOOL" 1>&2 echo "$0: debug[3]: LOCATION_HTML=$LOCATION_HTML" 1>&2 fi @@ -423,7 +427,7 @@ fi # create a temporary location markdown file # -TMP_LOC_MD=".$NAME.$$.location.md" +export TMP_LOC_MD=".$NAME.$$.location.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary location markdown file: $TMP_LOC_MD" 1>&2 fi @@ -464,6 +468,7 @@ fi # LOCATION_NAME=$("$LOCATION_TOOL" "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location name for location ISO 3166 code: $LOCATION_CODE" 1>&2 exit 12 @@ -473,6 +478,7 @@ fi # LOCATION_COMMON_NAME=$("$LOCATION_TOOL" -c "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_COMMON_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location common name" \ "for location ISO 3166 code: $LOCATION_CODE" 1>&2 @@ -485,6 +491,7 @@ fi xargs -0 grep -l '"location_code".*:.*"'"$LOCATION_CODE"'"' | wc -l | sed -e 's/[[:space:]]*//') + export AUTHOR_COUNT if [[ -z $AUTHOR_COUNT || $AUTHOR_COUNT -le 0 ]]; then echo "$0: ERROR: author count was zero for location: $LOCATION_CODE" 1>&2 exit 14 @@ -520,10 +527,12 @@ fi # The author_handle foo_bin is found in author/foo_bar.json # AUTHOR_HANDLE=$(basename "$AUTHOR_HANDLE_PATH" .json) + export AUTHOR_HANDLE # fetch full_name # FULL_NAME=$(grep '"full_name".*:' "$AUTHOR_HANDLE_PATH" | sed -e 's/^.*: "//' -e 's/",*$//') + export FULL_NAME # output the author from the location # diff --git a/bin/gen-other-html.sh b/bin/gen-other-html.sh index a75fc96c2..4c109b968 100755 --- a/bin/gen-other-html.sh +++ b/bin/gen-other-html.sh @@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.1 2024-03-08" +export VERSION="1.0.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -366,6 +366,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi @@ -383,7 +384,7 @@ fi # It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file # and read the file (setting EXIT_CODE again) after the loop. A hack, but good enough for our needs. # -TMP_EXIT_CODE=".$NAME.$$.exit.code" +export TMP_EXIT_CODE=".$NAME.$$.exit.code" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary exit code: $TMP_EXIT_CODE" 1>&2 fi @@ -594,7 +595,7 @@ for YYYY in $(< "$TOP_FILE"); do # determine the number of levels in path of MD_FILE from topdir # - NO_SLASH=${MD_FILE///} + export NO_SLASH=${MD_FILE///} LEVEL_CNT=$((${#MD_FILE} - ${#NO_SLASH})) export LEVEL_CNT if [[ $LEVEL_CNT -lt 2 ]]; then diff --git a/bin/gen-sitemap.sh b/bin/gen-sitemap.sh index 3894daa7f..d26a948e8 100755 --- a/bin/gen-sitemap.sh +++ b/bin/gen-sitemap.sh @@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.3.2 2024-03-18" +export VERSION="1.3.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -478,11 +478,14 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 + echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 + echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 + echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: ARCHIVE_HISTORIC_PATH=$ARCHIVE_HISTORIC_PATH" 1>&2 echo "$0: debug[3]: ARCHIVE_HISTORIC_DIR=$ARCHIVE_HISTORIC_DIR" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 @@ -491,11 +494,9 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: SITEMAP=$SITEMAP" 1>&2 echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2 - echo "$0: debug[3]: FILELIST=$FILELIST" 1>&2 - echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2 + echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi # If -N, time to exit @@ -509,7 +510,7 @@ fi # create a temporary file manifest list # -TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" +export TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2 fi @@ -530,7 +531,7 @@ fi # It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file # and read the file (setting EXIT_CODE again) after the loop. A hack, but good enough for our needs. # -TMP_EXIT_CODE=".$NAME.$$.exit.code" +export TMP_EXIT_CODE=".$NAME.$$.exit.code" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary exit code: $TMP_EXIT_CODE" 1>&2 fi @@ -548,7 +549,7 @@ fi # create a temporary sitemap # -TMP_SITEMAP=".$NAME.$$.sitemap" +export TMP_SITEMAP=".$NAME.$$.sitemap" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary tarball: $TMP_SITEMAP" 1>&2 fi @@ -863,6 +864,7 @@ if [[ -z $NOOP ]]; then # LC_ALL=C sort -d -f -u -t / "$TMP_MANIFEST_LIST" | while read -r FILE_PATH; do LASTMOD=$(output_modtime "$FILE_PATH") + export LASTMOD echo '' echo " $SITE_URL/$FILE_PATH" echo " $LASTMOD" diff --git a/bin/gen-status.sh b/bin/gen-status.sh index d26fb2461..d7ea5489b 100755 --- a/bin/gen-status.sh +++ b/bin/gen-status.sh @@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-18" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -701,22 +701,25 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2 echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2 - echo "$0: debug[3]: CONTEST_STATUS=$CONTEST_STATUS" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: JPARSE_TOOL=$JPARSE_TOOL" 1>&2 + echo "$0: debug[3]: IOCCC_STATUS_VERSION=$IOCCC_STATUS_VERSION" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 - echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 + echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2 - echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2 + echo "$0: debug[3]: CONTEST_STATUS=$CONTEST_STATUS" 1>&2 + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: NEWS_HTML=$NEWS_HTML" 1>&2 echo "$0: debug[3]: STATUS_JSON=$STATUS_JSON" 1>&2 echo "$0: debug[3]: STATUS_MD=$STATUS_MD" 1>&2 echo "$0: debug[3]: STATUS_HTML=$STATUS_HTML" 1>&2 + echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi # validate JSON in status.json @@ -777,7 +780,7 @@ fi # create a temporary status.json file # -TMP_STATUS_JSON=".$NAME.$$.entry.md" +export TMP_STATUS_JSON=".$NAME.$$.entry.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary status.json file: $TMP_STATUS_JSON" 1>&2 fi diff --git a/bin/gen-top-html.sh b/bin/gen-top-html.sh index 6e557a7bb..f85ee2623 100755 --- a/bin/gen-top-html.sh +++ b/bin/gen-top-html.sh @@ -88,7 +88,7 @@ TOP_MD_SET+=("faq") # set variables referenced in the usage message # -export VERSION="1.2.1 2024-03-08" +export VERSION="1.2.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -112,6 +112,7 @@ export REPO_URL="https://github.com/ioccc-src/temp-test-ioccc" export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc" # unset TOP_MD_SET +declare -ag TOP_MD_SET TOP_MD_SET+=("CODE_OF_CONDUCT") TOP_MD_SET+=("README") TOP_MD_SET+=("archive/historic/README") @@ -421,15 +422,17 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: TOP_MD_SET[$index]=${TOP_MD_SET[$index]}" 1>&2 done echo "$0: debug[3]: NOOP=$NOOP" 1>&2 - echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 + echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 + echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: LOCATION_HTML=$LOCATION_HTML" 1>&2 fi diff --git a/bin/gen-year-index.sh b/bin/gen-year-index.sh index 0821c0b0f..83f35b807 100755 --- a/bin/gen-year-index.sh +++ b/bin/gen-year-index.sh @@ -85,7 +85,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.3 2024-03-09" +export VERSION="1.0.4 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -396,13 +396,14 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 + for index in "${!TOOL_OPTION[@]}"; do + echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 + done echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: YYYY=$YYYY" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 - for index in "${!TOOL_OPTION[@]}"; do - echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 - done + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: YEAR_FILE=$YEAR_FILE" 1>&2 echo "$0: debug[3]: README_FILE=$README_FILE" 1>&2 fi diff --git a/bin/gen-years.sh b/bin/gen-years.sh index ab7a5880e..7b680b22d 100755 --- a/bin/gen-years.sh +++ b/bin/gen-years.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.2 2024-03-13" +export VERSION="1.0.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -195,7 +195,8 @@ $NAME version: $VERSION" # function output_award { - local ENTRY_JSON_PATH; # the .entry.json path + local ENTRY_JSON_PATH; # the .entry.json path + local AWARD_STRING; # winning entry award string # parse args # @@ -219,12 +220,12 @@ function output_award # obtain the award string # - AWARD=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') - if [[ -z $AWARD ]]; then + AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') + if [[ -z $AWARD_STRING ]]; then echo "$0: ERROR: in output_award: no award found in .entry.json file: $ENTRY_JSON_PATH" 1>&2 return 5 fi - echo "$AWARD" + echo "$AWARD_STRING" return 0 } @@ -516,6 +517,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: TAC_TOOL=$TAC_TOOL" 1>&2 echo "$0: debug[3]: FMT_TOOL=$FMT_TOOL" 1>&2 + echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2 echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2 echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2 @@ -524,10 +526,11 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 @@ -545,7 +548,7 @@ fi # create a temporary years markdown file # -TMP_YEARS_MD=".$NAME.$$.years.md" +export TMP_YEARS_MD=".$NAME.$$.years.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary years markdown file: $TMP_YEARS_MD" 1>&2 fi diff --git a/bin/md2html.sh b/bin/md2html.sh index b82026cff..29ce6a69f 100755 --- a/bin/md2html.sh +++ b/bin/md2html.sh @@ -141,7 +141,7 @@ shopt -s lastpipe # run last command of a pipeline not executed in the backgroun # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-09" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -720,38 +720,58 @@ function debug_parameters echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: URL=$URL" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: NOOP=$NOOP" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: TOPDIR=$TOPDIR" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: MD2HTML_CFG=$MD2HTML_CFG" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: BEFORE_TOOL=$BEFORE_TOOL" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: P_FLAG_FOUND=$P_FLAG_FOUND" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: CAP_P_FLAG_FOUND=$CAP_P_FLAG_FOUND" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: U_FLAG_FOUND=$U_FLAG_FOUND" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: USAGE=$USAGE" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: CAP_U_FLAG_FOUND=$CAP_U_FLAG_FOUND" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: AFTER_TOOL=$AFTER_TOOL" 1>&2 + for index in "${!TOKEN[@]}"; do + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: TOKEN[$index]=${TOKEN[$index]}" 1>&2 + done + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: CAP_S_FLAG=$CAP_S_FLAG" 1>&2 + for index in "${!OUTPUT_TOOL[@]}"; do + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: OUTPUT_TOOL[$index]=${OUTPUT_TOOL[$index]}" 1>&2 + done echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: TAGLINE=$TAGLINE" 1>&2 echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: MDTAG=$MDTAG" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: BEFORE_TOOL=$BEFORE_TOOL" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: AFTER_TOOL=$AFTER_TOOL" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: WORKING_DIR=$WORKING_DIR" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: REPO_NAME=$REPO_NAME" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: INC_PATH=$INC_PATH" 1>&2 - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: TOP=$TOP" 1>&2 - for index in "${!PHASE_NAME[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: phase name $index: ${PHASE_NAME[$index]}" - done 1>&2 - for index in "${!TOKEN[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: token $index to be replaced with: ${TOKEN[$index]}" - done 1>&2 - for index in "${!OUTPUT_TOOL[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: OUTPUT_TOOL[$index]=${OUTPUT_TOOL[$index]}" - done 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: MATCH_MD=$MATCH_MD" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: INPUT_MD=$INPUT_MD" 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: OUTPUT_HTML=$OUTPUT_HTML" 1>&2 for index in "${!B_OPTION[@]}"; do - echo "$0: debug[3]: $DBG_PREFIX: B_OPTION[$index]=${B_OPTION[$index]}" - done 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: B_OPTION[$index]=${B_OPTION[$index]}" 1>&2 + done for index in "${!P_OPTION[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: P_OPTION[$index]=${P_OPTION[$index]}" - done 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: P_OPTION[$index]=${P_OPTION[$index]}" 1>&2 + done for index in "${!A_OPTION[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: A_OPTION[$index]=${A_OPTION[$index]}" - done 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: A_OPTION[$index]=${A_OPTION[$index]}" 1>&2 + done for index in "${!O_OPTION[@]}"; do - echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: O_OPTION[$index]=${O_OPTION[$index]}" - done 1>&2 + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: O_OPTION[$index]=${O_OPTION[$index]}" 1>&2 + done + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: GIT_TOOL=$GIT_TOOL" 1>&2 + for index in "${!PHASE_NAME[@]}"; do + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: PHASE_NAME[$index]=${PHASE_NAME[$index]}" 1>&2 + done + for index in "${!HTML_PHASE_NAME[@]}"; do + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: HTML_PHASE_NAME[$index]=${HTML_PHASE_NAME[$index]}" 1>&2 + done + echo "$0: debug[$DEBUG_LEVEL]: $DBG_PREFIX: GETOPT_PHASE=$GETOPT_PHASE" 1>&2 return 0 } @@ -914,6 +934,7 @@ function append_html_phase local SED_SCRIPT # file contain sed commands local TMP_PHASE_FILE # temp file used to write sed script results local TMP_APPEND # growing temporary HTML file to append tmp_phase onto + local PHASE_FILE # HTML filename for the given phase # parse args # @@ -1084,8 +1105,8 @@ fi # In the case of a year level directory, this will be a YYYY working directory. # In the case of a top level directory, this will be just a . working directory. # -export WORKING_DIR WORKING_DIR=$(dirname "$MATCH_MD") +export WORKING_DIR # verify that we have a topdir directory # @@ -1460,7 +1481,7 @@ fi # for n in "${PHASE_NAME[@]}"; do if [[ ${HTML_PHASE_NAME[$n]} != . ]]; then - HTML_PHASE_FILE="$INC_DIR/$n.${HTML_PHASE_NAME[$n]}.html" + export HTML_PHASE_FILE="$INC_DIR/$n.${HTML_PHASE_NAME[$n]}.html" if [[ $V_FLAG -ge 9 ]]; then echo "$0: debug[9]: HTML phase $n: ${HTML_PHASE_NAME[$n]} file: $HTML_PHASE_FILE" 1>&2 fi @@ -1572,7 +1593,7 @@ fi # create a temporary sed script # -TMP_SED_SCRIPT=".$NAME.$$.sed" +export TMP_SED_SCRIPT=".$NAME.$$.sed" if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: temporary sed script: $TMP_SED_SCRIPT" 1>&2 fi @@ -1615,7 +1636,7 @@ fi # # NOTE: This file, when we are finished building it, will be come the final index.html file. # -TMP_PHASE=".$NAME.$$.html-phase.html" +export TMP_PHASE=".$NAME.$$.html-phase.html" if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: temporary HTML file: $TMP_PHASE" 1>&2 fi @@ -1642,7 +1663,7 @@ fi # # NOTE: This file, when we are finished building it, will be come the final index.html file. # -TMP_INDEX_HTML=".$NAME.$$.index.html" +export TMP_INDEX_HTML=".$NAME.$$.index.html" if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: temporary index HTML file: $TMP_INDEX_HTML" 1>&2 fi @@ -1668,7 +1689,7 @@ fi # input.md is -, we will need to capture standard input into a new temporary file # if [[ $INPUT_MD == - ]]; then - TMP_INPUT_MD=".$NAME.$$.stdin.md" + export TMP_INPUT_MD=".$NAME.$$.stdin.md" if [[ $V_FLAG -ge 5 ]]; then echo "$0: debug[5]: temporary stdin file: $TMP_INPUT_MD" 1>&2 fi diff --git a/bin/output-index-author.sh b/bin/output-index-author.sh index b04356706..2196fa6db 100755 --- a/bin/output-index-author.sh +++ b/bin/output-index-author.sh @@ -101,7 +101,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.5.1 2024-03-19" +export VERSION="1.5.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -446,9 +446,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # verify that we have a topdir directory # @@ -574,6 +571,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -610,6 +608,7 @@ fi # find the location tool # LOCATION_TOOL=$(type -P location) +export LOCATION_TOOL if [[ -z $LOCATION_TOOL ]]; then # guess we have a location tool in bin # @@ -638,6 +637,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 @@ -648,16 +648,18 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: LOCATION_TOOL=$LOCATION_TOOL" 1>&2 fi # Set AUTHOR_HANDLE_SET with author handles from .entry.json # -export AUTHOR_HANDLE_SET AUTHOR_HANDLE_SET=$(output_author_handles "$ENTRY_JSON") status="$?" +export AUTHOR_HANDLE_SET if [[ $status -ne 0 || -z $AUTHOR_HANDLE_SET ]]; then echo "$0: ERROR: unable to obtain any author handles from: $ENTRY_JSON" 1>&2 exit 7 @@ -674,7 +676,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # determine the author handle JSON path # - AUTHOR_HANDLE_JSON="$AUTHOR_DIR/$author_handle.json" + export AUTHOR_HANDLE_JSON="$AUTHOR_DIR/$author_handle.json" # verify that /author/author_handle.json exists as a readable file # @@ -698,6 +700,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # ENTRY_ID_FOUND=$(output_entry_ids "$AUTHOR_HANDLE_JSON" | grep -F -- "$ENTRY_ID") status="$?" + export ENTRY_ID_FOUND if [[ $status -ne 0 || -z $ENTRY_ID_FOUND ]]; then echo "$0: ERROR: entry id: $ENTRY_ID not found in author JSON file: $AUTHOR_HANDLE_JSON, status: $status" 1>&2 exit 8 @@ -710,6 +713,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # FULL_NAME=$(output_full_name "$AUTHOR_HANDLE_JSON") status="$?" + export FULL_NAME if [[ $status -ne 0 || -z $FULL_NAME ]]; then echo "$0: ERROR: author JSON file: $AUTHOR_HANDLE_JSON as no FULL NAME, status: $status" 1>&2 exit 8 @@ -722,6 +726,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # LOCATION_CODE=$(output_location_code "$AUTHOR_HANDLE_JSON") status="$?" + export LOCATION_CODE if [[ $status -ne 0 || -z $LOCATION_CODE ]]; then echo "$0: ERROR: author JSON file: $AUTHOR_HANDLE_JSON as no Location Code, status: $status" 1>&2 exit 8 @@ -742,7 +747,7 @@ fi # create a temporary markdown for pandoc to process # -TMP_FILE=".$NAME.$$.md" +export TMP_FILE=".$NAME.$$.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2 fi @@ -766,6 +771,7 @@ fi # { AUTHOR_COUNT=$(echo "$AUTHOR_HANDLE_SET" | wc -l) + export AUTHOR_COUNT if [[ $AUTHOR_COUNT -gt 1 ]]; then echo '## Authors:' else @@ -786,12 +792,13 @@ for author_handle in $AUTHOR_HANDLE_SET; do # determine the author handle JSON path # - AUTHOR_HANDLE_JSON="$AUTHOR_DIR/$author_handle.json" + export AUTHOR_HANDLE_JSON="$AUTHOR_DIR/$author_handle.json" # obtain the Full Name from the author handle JSON file # FULL_NAME=$(output_full_name "$AUTHOR_HANDLE_JSON") status="$?" + export FULL_NAME if [[ $status -ne 0 || -z $FULL_NAME ]]; then echo "$0: ERROR: author JSON file: $AUTHOR_HANDLE_JSON as no FULL NAME, status: $status" 1>&2 exit 12 @@ -801,6 +808,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # LOCATION_CODE=$(output_location_code "$AUTHOR_HANDLE_JSON") status="$?" + export LOCATION_CODE if [[ $status -ne 0 || -z $LOCATION_CODE ]]; then echo "$0: ERROR: author JSON file: $AUTHOR_HANDLE_JSON as no Location Code, status: $status" 1>&2 exit 13 @@ -810,6 +818,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # LOCATION_NAME=$("$LOCATION_TOOL" "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location name for location ISO 3166 code: $LOCATION_CODE" 1>&2 exit 14 @@ -819,6 +828,7 @@ for author_handle in $AUTHOR_HANDLE_SET; do # LOCATION_COMMON_NAME=$("$LOCATION_TOOL" -c "$LOCATION_CODE" 2>/dev/null) status="$?" + export LOCATION_COMMON_NAME if [[ $status -ne 0 ]]; then echo "$0: ERROR: cannot determine location common name" \ "for location ISO 3166 code: $LOCATION_CODE" 1>&2 diff --git a/bin/output-index-inventory.sh b/bin/output-index-inventory.sh index d1a5b04ed..cee381d4a 100755 --- a/bin/output-index-inventory.sh +++ b/bin/output-index-inventory.sh @@ -101,7 +101,7 @@ shopt -s globstar # enable '**' to match all files and zero or more directories # set variables referenced in the usage message # -export VERSION="1.2.2 2024-03-19" +export VERSION="1.2.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -244,9 +244,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # verify that we have a topdir directory # @@ -372,6 +369,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -438,6 +436,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 @@ -450,6 +449,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: MANIFEST_ENTRY_JSON_AWK=$MANIFEST_ENTRY_JSON_AWK" 1>&2 fi @@ -465,7 +465,7 @@ fi # create a temporary markdown for pandoc to process # -TMP_FILE=".$NAME.$$.md" +export TMP_FILE=".$NAME.$$.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2 fi @@ -487,7 +487,7 @@ fi # create a temporary manifest file # -TMP_MANIFEST=".$NAME.$$.manifest" +export TMP_MANIFEST=".$NAME.$$.manifest" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary manifest file: $TMP_MANIFEST" 1>&2 fi diff --git a/bin/output-year-index.sh b/bin/output-year-index.sh index 33798b164..86f2046d5 100755 --- a/bin/output-year-index.sh +++ b/bin/output-year-index.sh @@ -108,7 +108,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-19" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -189,7 +189,8 @@ $NAME version: $VERSION" # function output_award { - local ENTRY_JSON_PATH; # the .entry.json path + local ENTRY_JSON_PATH; # the .entry.json path + local AWARD_STRING; # winning entry award string # parse args # @@ -213,12 +214,12 @@ function output_award # obtain the award string # - AWARD=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') - if [[ -z $AWARD ]]; then + AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') + if [[ -z $AWARD_STRING ]]; then echo "$0: ERROR: in output_award: no award found in .entry.json file: $ENTRY_JSON_PATH" 1>&2 return 5 fi - echo "$AWARD" + echo "$AWARD_STRING" return 0 } @@ -364,9 +365,6 @@ if [[ $# -ne 1 ]]; then fi # export YYYY="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: YYYY=$YYYY" 1>&2 -fi if [[ -z $YYYY ]]; then echo "$0: ERROR: YYYY arg is empty" 1>&2 exit 3 @@ -484,6 +482,7 @@ fi # determine The N-th IOCCC string # LINE_NUM=$(sed -n "/$YYYY/=" "$TOP_FILE" | head -1) +export LINE_NUM if [[ -z $LINE_NUM ]]; then echo "$0: ERROR: cannot determine line number in $TOP_FILE for year: $YYYY" 1>&2 exit 10 @@ -505,12 +504,12 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 - echo "$0: debug[3]: URL=$URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: YYYY=$YYYY" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 echo "$0: debug[3]: YEAR_FILE=$YEAR_FILE" 1>&2 echo "$0: debug[3]: LINE_NUM=$LINE_NUM" 1>&2 @@ -528,7 +527,7 @@ fi # create a temporary markdown for pandoc to process # -TMP_FILE=".$NAME.$$.md" +export TMP_FILE=".$NAME.$$.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2 fi @@ -612,6 +611,7 @@ for YYYY_DIR in $(< "$YEAR_FILE"); do exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") + export DOT_PATH_CONTENT if [[ $YYYY_DIR != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $YYYY_DIR does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -633,6 +633,7 @@ for YYYY_DIR in $(< "$YEAR_FILE"); do # determine the award for this entry # AWARD=$(output_award "$ENTRY_JSON") + export AWARD if [[ -z $AWARD ]]; then echo "$0: ERROR: cannot find award in .entry.json: $ENTRY_JSON" 1>&2 exit 7 diff --git a/bin/pandoc-wrapper.sh b/bin/pandoc-wrapper.sh index 078d51989..bca14fb62 100755 --- a/bin/pandoc-wrapper.sh +++ b/bin/pandoc-wrapper.sh @@ -99,7 +99,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.5.2 2024-03-19" +export VERSION="1.5.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -117,6 +117,7 @@ if [[ $status -eq 0 ]]; then fi export TOPDIR PANDOC_TOOL=$(type -P pandoc) +export PANDOC_TOOL if [[ -z $PANDOC_TOOL ]]; then PANDOC_TOOL="/opt/homebrew/bin/pandoc" fi @@ -237,10 +238,6 @@ fi # export MARKDOWN_INPUT="$1" export HTML_OUTPUT="$2" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: MARKDOWN_INPUT=$MARKDOWN_INPUT" 1>&2 - echo "$0: debug[1]: HTML_OUTPUT=$HTML_OUTPUT" 1>&2 -fi # firewall - validate args # @@ -280,6 +277,7 @@ export PANDOC_MIN_VERSION="3.1.12.2" # verify that we have a topdir directory # REPO_NAME=$(basename "$REPO_URL") +export REPO_NAME if [[ -z $TOPDIR ]]; then echo "$0: ERROR: cannot find top of git repo directory" 1>&2 echo "$0: Notice: if needed: $GIT_TOOL clone $REPO_URL; cd $REPO_NAME" 1>&2 @@ -355,6 +353,10 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: PANDOC_TOOL=$PANDOC_TOOL" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 + echo "$0: debug[3]: PANDOC_TOOL=$PANDOC_TOOL" 1>&2 + for index in "${!PANDOC_OPTION[@]}"; do + echo "$0: debug[3]: PANDOC_OPTION[$index]=${PANDOC_OPTION[$index]}" 1>&2 + done echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 @@ -362,6 +364,8 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: HTML_OUTPUT=$HTML_OUTPUT" 1>&2 echo "$0: debug[3]: PANDOC_TOOL_VERSION=$PANDOC_TOOL_VERSION" 1>&2 echo "$0: debug[3]: PANDOC_MIN_VERSION=$PANDOC_MIN_VERSION" 1>&2 + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 @@ -382,6 +386,7 @@ fi # verify that the pandoc version is >= the minimum version # FIRST_VERSION=$(printf "%s\n%s" "$PANDOC_TOOL_VERSION" "$PANDOC_MIN_VERSION" | LC_ALL=C sort -V | head -1) +export FIRST_VERSION if [[ $FIRST_VERSION != "$PANDOC_MIN_VERSION" ]]; then echo "$0: ERROR: pandoc: $PANDOC_TOOL version: $PANDOC_TOOL_VERSION <=" \ "minimum allowed: $PANDOC_MIN_VERSION" 1>&2 diff --git a/bin/quick-readme2index.sh b/bin/quick-readme2index.sh index 17a8dd533..e8a8c35b6 100755 --- a/bin/quick-readme2index.sh +++ b/bin/quick-readme2index.sh @@ -92,7 +92,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.2 2024-03-08" +export VERSION="1.1.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -282,9 +282,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 3 ]]; then - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool # @@ -397,6 +394,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -488,6 +486,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2 + echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2 echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2 echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 @@ -495,16 +494,20 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 - echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 - echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 + echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 + echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 + echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 + echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: README_PATH=$README_PATH" 1>&2 echo "$0: debug[3]: INDEX_PATH=$INDEX_PATH" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 diff --git a/bin/readme2index.sh b/bin/readme2index.sh index ef078db77..fb1cd8a32 100755 --- a/bin/readme2index.sh +++ b/bin/readme2index.sh @@ -86,7 +86,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.2.1 2024-02-23" +export VERSION="1.2.2 2024-02-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -275,9 +275,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 3 ]]; then - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # always add the '-v level' option, unless level is empty, to the set of options passed to the md2html.sh tool # @@ -390,6 +387,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -488,18 +486,23 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 - echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 for index in "${!TOOL_OPTION[@]}"; do echo "$0: debug[3]: TOOL_OPTION[$index]=${TOOL_OPTION[$index]}" 1>&2 done + echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 - echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 + echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 + echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 + echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 + echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: README_PATH=$README_PATH" 1>&2 echo "$0: debug[3]: INDEX_PATH=$INDEX_PATH" 1>&2 + echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 fi # -N stops early before any processing is performed diff --git a/bin/sort.gitignore.sh b/bin/sort.gitignore.sh index 028010545..c3b659872 100755 --- a/bin/sort.gitignore.sh +++ b/bin/sort.gitignore.sh @@ -99,7 +99,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.2 2024-03-18" +export VERSION="1.1.3 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -206,9 +206,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # verify that we have a topdir directory # @@ -326,6 +323,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -375,13 +373,17 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 + echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: GITIGNORE=$GITIGNORE" 1>&2 fi @@ -396,7 +398,7 @@ fi # create a temporary markdown for pandoc to process # -TMP_FILE="$ENTRY_PATH/.$NAME.$$.sgi.sh" +export TMP_FILE="$ENTRY_PATH/.$NAME.$$.sgi.sh" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2 fi diff --git a/bin/status2html.sh b/bin/status2html.sh index 5fa65e0ba..5b23999c5 100755 --- a/bin/status2html.sh +++ b/bin/status2html.sh @@ -99,7 +99,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-19" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -346,6 +346,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: STATUS_JSON=$STATUS_JSON" 1>&2 @@ -362,7 +363,7 @@ fi # create a temporary markdown for pandoc to process # -TMP_FILE=".$NAME.$$.md" +export TMP_FILE=".$NAME.$$.md" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary markdown file: $TMP_FILE" 1>&2 fi @@ -386,6 +387,7 @@ fi # CONTEST_STATUS=$(grep '"contest_status"\s*:\s*"[^"][^"]*"' "$STATUS_JSON" | sed -e 's/",\s*$//' -e 's/^.*"//') status="$?" +export CONTEST_STATUS if [[ $status -ne 0 || -z $CONTEST_STATUS ]]; then echo "$0: ERROR: cannot determine contest_status from status.json: $STATUS_JSON" 1>&2 exit 8 diff --git a/bin/subst.default.sh b/bin/subst.default.sh index 64a8ca5c7..44b0c5435 100755 --- a/bin/subst.default.sh +++ b/bin/subst.default.sh @@ -92,7 +92,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.2.1 2024-02-23" +export VERSION="1.2.2 2024-02-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -227,6 +227,7 @@ fi # form Nu Html Checker doc url string # VALIDATOR_ENCODED_URL=$(echo "$URL" | sed -e 's;/;%2F;g' -e 's;:;%3A;') +export VALIDATOR_ENCODED_URL # parameter debugging # @@ -234,6 +235,7 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: VERSION=$VERSION" 1>&2 echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 + echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 diff --git a/bin/subst.entry-index.sh b/bin/subst.entry-index.sh index ea0fa5d35..232e6cbcd 100755 --- a/bin/subst.entry-index.sh +++ b/bin/subst.entry-index.sh @@ -103,7 +103,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.3.1 2024-03-19" +export VERSION="1.3.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -179,7 +179,8 @@ $NAME version: $VERSION" # function output_award { - local ENTRY_JSON_PATH; # the .entry.json path + local ENTRY_JSON_PATH; # the .entry.json path + local AWARD_STRING; # winning entry award string # parse args # @@ -203,12 +204,12 @@ function output_award # obtain the award string # - AWARD=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') - if [[ -z $AWARD ]]; then + AWARD_STRING=$(grep -F '"award" : "' "$ENTRY_JSON_PATH" | sed -e 's/^.*"award" : "//' -e 's/",//') + if [[ -z $AWARD_STRING ]]; then echo "$0: ERROR: in output_award: no award found in .entry.json file: $ENTRY_JSON_PATH" 1>&2 return 5 fi - echo "$AWARD" + echo "$AWARD_STRING" return 0 } @@ -291,9 +292,6 @@ if [[ $# -ne 1 ]]; then fi # export ENTRY_PATH="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: ENTRY_PATH=$ENTRY_PATH" 1>&2 -fi # verify that we have a topdir directory # @@ -419,6 +417,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 7 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 7 @@ -456,11 +455,11 @@ fi # determine award # AWARD=$(output_award "$ENTRY_JSON") +export AWARD if [[ -z $AWARD ]]; then echo "$0: ERROR: cannot determine award for $YEAR_DIR from: $ENTRY_JSON" 1>&2 exit 1 fi -export AWARD # parameter debugging # @@ -468,15 +467,16 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: VERSION=$VERSION" 1>&2 echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 + echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 - echo "$0: debug[3]: URL=$URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 @@ -489,8 +489,10 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: ENTRY_NAVBAR_AWK=$ENTRY_NAVBAR_AWK" 1>&2 + echo "$0: debug[3]: AWARD=$AWARD" 1>&2 fi # If -N, time to exit diff --git a/bin/subst.year-index.sh b/bin/subst.year-index.sh index 98504e74d..d57b4c86f 100755 --- a/bin/subst.year-index.sh +++ b/bin/subst.year-index.sh @@ -103,7 +103,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-19" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -302,9 +302,6 @@ if [[ $# -ne 1 ]]; then fi # export YEAR_ARG="$1" -if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: YEAR_ARG=$YEAR_ARG" 1>&2 -fi # verify that we have a topdir directory # @@ -455,20 +452,22 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: VERSION=$VERSION" 1>&2 echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 + echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2 - echo "$0: debug[3]: URL=$URL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 + echo "$0: debug[3]: YEAR_ARG=$YEAR_ARG" 1>&2 + echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2 echo "$0: debug[3]: AUTHOR_DIR=$AUTHOR_DIR" 1>&2 echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2 echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 echo "$0: debug[3]: YEAR_NAVBAR_AWK=$YEAR_NAVBAR_AWK" 1>&2 diff --git a/bin/tar-all.sh b/bin/tar-all.sh index 85058d356..f9562cfd6 100755 --- a/bin/tar-all.sh +++ b/bin/tar-all.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-18" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -353,22 +353,22 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 - echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 + echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 + echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: TARBALL=$TARBALL" 1>&2 echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2 echo "$0: debug[3]: IOCCC_CSS=$IOCCC_CSS" 1>&2 echo "$0: debug[3]: VAR_MK=$VAR_MK" 1>&2 - echo "$0: debug[3]: FILELIST=$FILELIST" 1>&2 + echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2 fi # If -N, time to exit @@ -382,7 +382,7 @@ fi # create a temporary file manifest list # -TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" +export TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2 fi @@ -404,7 +404,7 @@ fi # create a temporary sort list of files to tar # -TMP_TAR_LIST=".$NAME.$$.tar.list" +export TMP_TAR_LIST=".$NAME.$$.tar.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file tar list: $TMP_TAR_LIST" 1>&2 fi @@ -429,7 +429,7 @@ fi # It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file # and read the file (setting EXIT_CODE again) after the loop. A hack, but good enough for our needs. # -TMP_EXIT_CODE=".$NAME.$$.exit.code" +export TMP_EXIT_CODE=".$NAME.$$.exit.code" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary exit code: $TMP_EXIT_CODE" 1>&2 fi @@ -451,7 +451,7 @@ fi # create a temporary tarball # -TMP_TARBALL=".$NAME.$$.tar.bz2" +export TMP_TARBALL=".$NAME.$$.tar.bz2" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary tarball: $TMP_TARBALL" 1>&2 fi diff --git a/bin/tar-entry.sh b/bin/tar-entry.sh index 8d523fcd9..3655aab2a 100755 --- a/bin/tar-entry.sh +++ b/bin/tar-entry.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.3.1 2024-03-25" +export VERSION="1.3.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -320,6 +320,7 @@ if [[ ! -s $DOT_PATH ]]; then exit 5 fi DOT_PATH_CONTENT=$(< "$DOT_PATH") +export DOT_PATH_CONTENT if [[ $ENTRY_PATH != "$DOT_PATH_CONTENT" ]]; then echo "$0: ERROR: arg: $ENTRY_PATH does not match $DOT_PATH contents: $DOT_PATH_CONTENT" 1>&2 exit 5 @@ -473,21 +474,25 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 - echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 + echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 + echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 - echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 + echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 + echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: DOT_PATH=$DOT_PATH" 1>&2 + echo "$0: debug[3]: DOT_PATH_CONTENT=$DOT_PATH_CONTENT" 1>&2 echo "$0: debug[3]: ENTRY_JSON=$ENTRY_JSON" 1>&2 echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2 echo "$0: debug[3]: IOCCC_CSS=$IOCCC_CSS" 1>&2 @@ -695,7 +700,7 @@ fi # create a temporary tarball # -TMP_TARBALL=".$NAME.$$.tar.bz2" +export TMP_TARBALL=".$NAME.$$.tar.bz2" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary tarball: $TMP_TARBALL" 1>&2 fi @@ -764,6 +769,7 @@ if [[ -z $REBUILD_TARBALL ]]; then fi TAR_CONTENTS_DIFFERS=$(TZ=UTC LC_ALL=C "$GTAR_TOOL" --compare --file="$TARBALL" -C . 2>&1 | \ grep -E -v ': (Uid|Gid|Mod time) differs$') + export TAR_CONTENTS_DIFFERS if [[ -n $TAR_CONTENTS_DIFFERS ]]; then REBUILD_TARBALL="true" if [[ $V_FLAG -ge 1 ]]; then @@ -794,6 +800,7 @@ if [[ -n $REBUILD_TARBALL ]]; then # TAR_TIMESTAMP=$(TZ=UTZ date '+%s') status="$?" + export TAR_TIMESTAMP if [[ $status -ne 0 ]]; then echo "$0: ERROR: new TZ=UTC date +%s failed, error: $status" 1>&2 exit 8 diff --git a/bin/tar-year.sh b/bin/tar-year.sh index dbbf3968c..5a88a1f94 100755 --- a/bin/tar-year.sh +++ b/bin/tar-year.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.1.1 2024-03-18" +export VERSION="1.1.2 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -357,17 +357,18 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 - echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 + echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 + echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2 + echo "$0: debug[3]: YYYY=$YYYY" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: BIN_PATH=$BIN_PATH" 1>&2 echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2 - echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: TARBALL=$TARBALL" 1>&2 echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2 echo "$0: debug[3]: IOCCC_CSS=$IOCCC_CSS" 1>&2 @@ -386,7 +387,7 @@ fi # create a temporary file manifest list # -TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" +export TMP_MANIFEST_LIST=".$NAME.$$.manifest.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2 fi @@ -408,7 +409,7 @@ fi # create a temporary sort list of files to tar # -TMP_TAR_LIST=".$NAME.$$.tar.list" +export TMP_TAR_LIST=".$NAME.$$.tar.list" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary file tar list: $TMP_TAR_LIST" 1>&2 fi @@ -433,7 +434,7 @@ fi # It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file # and read the file (setting EXIT_CODE again) after the loop. A hack, but good enough for our needs. # -TMP_EXIT_CODE=".$NAME.$$.exit.code" +export TMP_EXIT_CODE=".$NAME.$$.exit.code" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary exit code: $TMP_EXIT_CODE" 1>&2 fi @@ -455,7 +456,7 @@ fi # create a temporary tarball # -TMP_TARBALL=".$NAME.$$.tar.bz2" +export TMP_TARBALL=".$NAME.$$.tar.bz2" if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: temporary tarball: $TMP_TARBALL" 1>&2 fi diff --git a/bin/untar-entry.sh b/bin/untar-entry.sh index 5381c319f..1aa39efa0 100755 --- a/bin/untar-entry.sh +++ b/bin/untar-entry.sh @@ -83,7 +83,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0 2024-03-25" +export VERSION="1.0.1 2024-03-26" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -338,17 +338,20 @@ if [[ $V_FLAG -ge 3 ]]; then echo "$0: debug[3]: NAME=$NAME" 1>&2 echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2 echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2 - echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2 echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2 + echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 + echo "$0: debug[3]: GTAR_TOOL=$GTAR_TOOL" 1>&2 echo "$0: debug[3]: NOOP=$NOOP" 1>&2 echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2 - echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2 echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2 echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2 + echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2 echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2 echo "$0: debug[3]: ENTRY_DIR=$ENTRY_DIR" 1>&2 echo "$0: debug[3]: ENTRY_ID=$ENTRY_ID" 1>&2 + echo "$0: debug[3]: DOT_YEAR=$DOT_YEAR" 1>&2 + echo "$0: debug[3]: YYYY_DIR=$YYYY_DIR" 1>&2 echo "$0: debug[3]: TARBALL=$TARBALL" 1>&2 fi