syspunktdateien/bin/updatechecker

33 lines
1.3 KiB
Text
Raw Normal View History

2024-03-15 01:32:32 +01:00
#!/bin/bash
cd "/etc/sysdotfiles"
export "COLOR=31"
export "COLOR_REGULAR=\e[0;${COLOR}m"
export "COLOR_BOLD=\e[1;${COLOR}m"
export "COLOR_RESET=\e[0m"
export "COMMIT=$(env PAGER= git log -n 1 --pretty=format:\"%H\")"
export "LATEST_COMMIT=$(curl -sX 'GET' 'https://git.staropensource.de/api/v1/repos/JeremyStarTM/syspunktdateien/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/syspunktdateien/branches/develop' -H 'accept: application/json'|jq --monochrome-output '.commit.message'|sed 's/\\n//g')"
if [ "$COMMIT" == "$LATEST_COMMIT" ] || [ -z "$LATEST_COMMIT" ]; then
export "UPDATE=false"
else
export "UPDATE=true"
fi
if [ ! "$SCRIPTED" == "true" ]; then
if [ "$UPDATE" == "true" ]; then
2024-03-15 02:52:41 +01:00
echo -e "${COLOR_BOLD}An update for jstm's syssyspunktdateien is available."
2024-03-15 01:32:32 +01:00
echo -e "${COLOR_REGULAR}Latest commit: ${LATEST_COMMIT}"
echo " -> Message: ${LATEST_COMMIT_MESSAGE}"
echo ""
echo -e "${COLOR_BOLD}Update by executing \"sysdotfiles-updater\""
echo -en "${COLOR_RESET}"
elif [ ! "${BASHRC}" == "true" ]; then
echo -e "${COLOR_BOLD}No update available"
fi
else
if [ "$UPDATE" == "true" ]; then
echo "$LATEST_COMMIT_MESSAGE"
fi
fi