From 1a5760c14031405e20286c97be44aec454335243 Mon Sep 17 00:00:00 2001 From: Staubgeborener Date: Fri, 19 Jan 2024 15:18:41 +0100 Subject: [PATCH] update check possible wherever you are --- script.sh | 8 ++++---- version | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 version diff --git a/script.sh b/script.sh index fe5af43..f9455dd 100755 --- a/script.sh +++ b/script.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash -# Check for updates -[ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | \ -sed 's/\// /g') | cut -f1) ] && echo -e "Klipper-backup is up to date\n" || echo -e "Klipper-backup is $(tput setaf 1)not$(tput sgr0) up to date, consider making a $(tput setaf 1)git pull$(tput sgr0) to update\n" - # Set parent directory path parent_path=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P) @@ -13,6 +9,10 @@ source "$parent_path"/.env backup_folder="config_backup" backup_path="$HOME/$backup_folder" +# Check for updates +[ $(git -C "$parent_path" rev-parse HEAD) = $(git -C "$parent_path" ls-remote $(git -C "$parent_path" rev-parse --abbrev-ref @{u} | \ +sed 's/\// /g') | cut -f1) ] && echo -e "Klipper-backup is up to date\n" || echo -e "Klipper-backup is $(tput setaf 1)not$(tput sgr0) up to date, consider making a $(tput setaf 1)git pull$(tput sgr0) to update\n" + # Check if backup folder exists, create one if it does not if [ ! -d "$backup_path" ]; then mkdir -p "$backup_path" diff --git a/version b/version deleted file mode 100644 index 1cc5f65..0000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -1.1.0 \ No newline at end of file