Skip to content

Commit

Permalink
deploy.sh: try to fix shellcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ia committed Jul 9, 2023
1 parent 1efe0ac commit 7f18a42
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ docs_readme()
yml="scripts/IronOS-mkdocs.yml"
md="Documentation/README.md"
# ^^^^ hardcoded paths relative to IronOS/ to make this func very trivial
echo > "${md}"
echo "<!-- THIS FILE IS AUTOGENERATED by \"scripts/deploy.sh docs_readme\" based on nav section in ${yml} config -->" >> "${md}"
echo "<!-- THIS FILE IS NOT SUPPOSED TO BE EDITED MANUALLY -->" >> "${md}"
echo >> "${md}"
echo "#### This is autogenerated README for brief navigation through github over official documentation for IronOS project" >> "${md}"
echo "#### This documentation is also available [here online](https://ralim.github.io/IronOS)" >> "${md}"
echo >> "${md}"
# file overwritten section looks out of style but hoping to make shellcheck happy
cat << EOF > "${md}"
<!-- THIS FILE IS AUTOGENERATED by "scripts/deploy.sh docs_readme" based on nav section in ${yml} config -->
<!-- THIS FILE IS NOT SUPPOSED TO BE EDITED MANUALLY -->
#### This is autogenerated README for brief navigation through github over official documentation for IronOS project
#### This documentation is also available [here online](https://ralim.github.io/IronOS)
EOF
# it probably will become unexplainable in a few months but so far it works:
cat "${yml}" | sed '1,/^nav/d; /^ *$/,$d; s,- ,- [,; s,: ,](../Documentation/,; s,.md,.md),; s,:$,],; s,/Pinecil ,/Pinecil%20,; /^ - \[.*\]$/ s,\[,,; s,]$,,' >> "${md}"
sed '1,/^nav/d; /^ *$/,$d; s,- ,- [,; s,: ,](../Documentation/,; s,.md,.md),; s,:$,],; s,/Pinecil ,/Pinecil%20,; /^ - \[.*\]$/ s,\[,,; s,]$,,' "${yml}" >> "${md}"
echo ""
echo "${yml} is updated. Do not forget to commit & push changes:"
echo ""
Expand Down Expand Up @@ -76,7 +79,7 @@ cmd="${1}"
# if only README.md for Documentation update is required then run it & exit

if [ "docs_readme" = "${cmd}" ]; then
${cmd}
docs_readme
exit "${?}"
fi;

Expand Down

0 comments on commit 7f18a42

Please sign in to comment.