Add update checker script

This commit is contained in:
JeremyStar™ 2023-12-13 19:32:24 +01:00
parent 4cd30d3ccf
commit a46a9fed79
4 changed files with 26 additions and 2 deletions

17
bin/updatechecker Executable file
View file

@ -0,0 +1,17 @@
#!/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

View file

@ -76,6 +76,9 @@ link "lone-files/konsolerc" ".config/konsolerc"
link "konsole" ".local/share/konsole"
link "lone-files/dolphinrc" ".config/dolphinrc"
# punktdateien scripts
link "bin/updatechecker" ".local/bin/dotfiles-updatechecker"
# write install file
echo "pls don't remove" > "$HOME/.config/.jstm_dotfiles"

View file

@ -1,5 +1,7 @@
#!/bin/bash
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
source "/usr/share/icons-in-terminal/icons_bash.sh"
source "${HOME}/.jstmbash/init.source"
eval "$(starship init bash)"
@ -10,5 +12,4 @@ function cleanhome() {
}
alias "quote=fortune -s linux debian|cowsay"
quote
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
env "BASHRC=true" dotfiles-updatechecker

View file

@ -55,3 +55,6 @@ unlink ".config/fontconfig"
unlink ".config/konsolerc"
unlink ".local/share/konsole"
unlink ".config/dolphinrc"
# punktdateien scripts
unlink ".local/bin/dotfiles-updatechecker"