diff --git a/bin/updatechecker b/bin/updatechecker new file mode 100755 index 00000000..26e9b2c4 --- /dev/null +++ b/bin/updatechecker @@ -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 diff --git a/install.sh b/install.sh index bd52c9ae..f7d67322 100755 --- a/install.sh +++ b/install.sh @@ -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" diff --git a/lone-files/bashrc b/lone-files/bashrc index 4d3764aa..714955e1 100644 --- a/lone-files/bashrc +++ b/lone-files/bashrc @@ -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 diff --git a/uninstall.sh b/uninstall.sh index 8158a886..e2a4c277 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -55,3 +55,6 @@ unlink ".config/fontconfig" unlink ".config/konsolerc" unlink ".local/share/konsole" unlink ".config/dolphinrc" + +# punktdateien scripts +unlink ".local/bin/dotfiles-updatechecker"