Files
pi-hosted/build/pre-commit
Rafael Blumberg 7f7773fbe9 Add Document LIst and improve build folder (#261)
* Rename generateList to generateAppList
* Add DocumenList with Generator
* Rename Template files
* Use template file for AppList.md
* Ignore case when sorting AppList
* Organize build folder
* Add dependencies check to pre-commit script
* Add wget install collumn to tools/README.md and sort by title
* Remove Document table from README and add a link to DocumentList.md
* Remove tools table from README and add a link to the list
* Hightlight AppList on Readme
2022-01-01 13:21:13 -05:00

47 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
# Check dependencies
jq --version &> /dev/null || error "jq is required, please install it with 'sudo apt install jq'"
git --version &> /dev/null || error "git is required, please install it with 'sudo apt install git'"
sha256sum --version &> /dev/null || error "sha256sum is required, please install it with 'sudo apt install coreutils'"
# Check if script from build or script from hook and cd into build folder
scriptDir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || pwd )"
if [ "$( echo "$scriptDir" | rev | cut -d/ -f1 | rev )" == "build" ]; then
cd -- "$scriptDir" &> /dev/null || exit
else
cd -- "$(git rev-parse --show-toplevel)/build" &> /dev/null || exit
fi
# Get file location (Variables) from env file
homedir='../'
. env.sh
# Check if Template or appinfo has changed
if ! sha256sum -c --quiet "$verificationFile" &> /dev/null ; then
# Make sure tmp folder exists
mkdir -p "$( dirname -- "$verificationFile" )"
echo "Updating documentation..."
# Run all scripts
./generators/generateAppList.sh
./generators/generateDocList.sh
./generators/generateREADME.sh
./generators/generateToolsREADME.sh
echo "Update finished"
# Update lastrun.sha256
sha256sum "$appinfo" "$pt32" "$pt64" > "$verificationFile"
# Add files to stagging
git add -- "$README"
git add -- "$TOOLSREADME"
git add -- "$AppList"
git add -- "$DocList"
fi