Add restore script, use it to move the latest lock file to the destinations

This commit is contained in:
Martin Larsson 2024-01-23 13:38:47 +01:00
parent 0a91afa541
commit 9cb44a8932
3 changed files with 60 additions and 7 deletions

View file

@ -2,6 +2,9 @@
LOCK_ROOT=".lock"
# Enable the NULL_GLOB option to handle cases where no subdirectories exist
setopt NULL_GLOB
# Define a function to create key-value pairs
create_mapping() {
local input="$1"
@ -31,3 +34,18 @@ function get_latest_lock() {
echo $latest_lock
}
function has_lock() {
local latest_lock=$1
# if first parameter does not exist, call get_latest_lock
if [[ -z $latest_lock ]]; then
latest_lock=$(get_latest_lock)
fi
if [[ $latest_lock -ne 0 ]]; then
echo 1
else
echo 0
fi
}