punktdateien/bin/updatechecker

18 lines
967 B
Text
Raw Normal View History

2023-12-13 19:32:24 +01:00
#!/bin/bash
cd "$HOME/.dotfiles"
export "COLOR=31"
export "COLOR_REGULAR=\e[0;${COLOR}m"
export "COLOR_BOLD=\e[1;${COLOR}m"
export "COLOR_RESET=\e[0m"
export "LATEST_COMMIT=$(curl -sX 'GET' 'https://git.staropensource.de/api/v1/repos/JeremyStarTM/punktdateien/branches/develop' -H 'accept: application/json'|jq --monochrome-output '.commit.id')"
export "LATEST_COMMIT_MESSAGE=$(curl -sX 'GET' 'https://git.staropensource.de/api/v1/repos/JeremyStarTM/punktdateien/branches/develop' -H 'accept: application/json'|jq --monochrome-output '.commit.message'|sed 's/\\n//g')"
if [ ! "$(env PAGER= git log -n 1 --pretty=format:\"%H\")" == "$LATEST_COMMIT" ]; then
echo -e "${COLOR_BOLD}An update for jstm's punkdateien is available."
echo -e "${COLOR_REGULAR}Latest commit: ${LATEST_COMMIT}"
echo -e "${COLOR_REGULAR} -> Message: ${LATEST_COMMIT_MESSAGE}"
echo -en "${COLOR_RESET}"
elif [ ! "${BASHRC}" == "true" ]; then
echo -e "${COLOR_BOLD}No update available"
fi