1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Split discovery of alternates test data into a testable function

This commit is contained in:
Tim Byrne
2019-08-17 15:20:56 -05:00
parent c29292d02b
commit e4e956fe21
2 changed files with 78 additions and 9 deletions

25
yadm
View File

@@ -135,34 +135,41 @@ function alt() {
require_repo
parse_encrypt
# gather values for processing alternates
local local_class
local local_system
local local_host
local local_user
set_local_alt_values
if [ "$YADM_COMPATIBILITY" = "1" ]; then
alt_past
else
alt_future
fi
}
function set_local_alt_values() {
local_class="$(config local.class)"
local local_system
local_system="$(config local.os)"
if [ -z "$local_system" ] ; then
local_system="$OPERATING_SYSTEM"
fi
local local_host
local_host="$(config local.hostname)"
if [ -z "$local_host" ] ; then
local_host=$(hostname)
local_host=${local_host%%.*} # trim any domain from hostname
fi
local local_user
local_user="$(config local.user)"
if [ -z "$local_user" ] ; then
local_user=$(id -u -n)
fi
if [ "$YADM_COMPATIBILITY" = "1" ]; then
alt_past
else
alt_future
fi
}
function alt_future() {