Fix non-portable use of date command

Date is apparently extremely non-portable so limit its use to very
simple printing of current date/time plus timezone instead of trying to
use it to generate date strings.
This commit is contained in:
Jake Bauer 2023-03-12 11:43:10 -04:00
parent ef5a8226bf
commit e74f8b9164
1 changed files with 3 additions and 4 deletions

7
sbs
View File

@ -132,7 +132,7 @@ genfeed()
printf "\t<link href=\"%s\" />\n" "$siteURL"
printf "\t<link rel=\"self\" href=\"%sfeed.xml\" />\n" "${siteURL}"
printf "\t<icon>/favicon.png</icon>\n"
printf "\t<updated>%s</updated>\n" "$(date +"%Y-%m-%dT%H:%M:%S%:z")"
printf "\t<updated>%s</updated>\n" "$(date +"%Y-%m-%dT%H:%M:%S%z")"
printf "\t<id>%s</id>\n" "$siteURL"
printf "\t<generator>sbs</generator>\n\n"
} > static/feed.xml
@ -142,8 +142,7 @@ genfeed()
if [ -n "$(lowdown -X draft "$file" 2>/dev/null)" ]; then
continue
fi
printf "%s %s\n" "$(date -d "$(lowdown -X date "$file")" +"%s")" \
"$file" >> "$tmp"
printf "%s %s\n" "$(lowdown -X date "$file")" "$file" >> "$tmp"
done
sort -rn "$tmp" | cut -d' ' -f2 | while read -r file; do
fileName=$(basename "$file" .md).html
@ -158,7 +157,7 @@ genfeed()
printf "\t\t<author><name>%s</name></author>\n" "$author"
printf "\t\t<link href=\"%s%s/%s\" />\n" "$siteURL" "$subDir" "$fileName"
printf "\t\t<id>%s%s/%s</id>\n" "$siteURL" "$subDir" "$fileName"
printf "\t\t<updated>%s</updated>\n" "$(date -d "$date" +"%Y-%m-%dT%H:%M:%S%:z")"
printf "\t\t<updated>%s</updated>\n" "${date}T00:00:00$(date +%z)"
printf "\t\t<content type=\"html\"><![CDATA[\n%s\n\t\t]]></content>\n" "$(lowdown $buildOptions "$file")"
printf "\t</entry>\n\n"
} >> static/feed.xml