Skip to content

Commit

Permalink
update check possible wherever you are
Browse files Browse the repository at this point in the history
  • Loading branch information
Staubgeborener committed Jan 19, 2024
1 parent 8089fa0 commit 1a5760c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions script.sh
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion version

This file was deleted.

0 comments on commit 1a5760c

Please sign in to comment.