summaryrefslogtreecommitdiff
path: root/yadm
diff options
context:
space:
mode:
authorTim Byrne <sultan@locehilios.com>2019-10-10 08:23:36 -0500
committerTim Byrne <sultan@locehilios.com>2019-10-12 09:59:02 -0500
commit4ea3ed9e2af11421d8fc029a8438ce74c1bbdd1c (patch)
tree648f650068d0a1f61216efc17fdbbd1c5bca9d32 /yadm
parentaeb6a54ad7e417d4732a3dc1e36a5663b3b860de (diff)
Allow storing alternates elsewhere (#90)
This change allows alternates to be stored in "$YADM_DIR/alt". The correct path within the work tree will be symlinked. Storing alternates within the work tree is still allowed. Both locations will be considered when choosing an appropriate alternate file.
Diffstat (limited to 'yadm')
-rwxr-xr-xyadm7
1 files changed, 7 insertions, 0 deletions
diff --git a/yadm b/yadm
index 1529785..687264a 100755
--- a/yadm
+++ b/yadm
@@ -33,6 +33,7 @@ YADM_ENCRYPT="encrypt"
YADM_ARCHIVE="files.gpg"
YADM_BOOTSTRAP="bootstrap"
YADM_HOOKS="hooks"
+YADM_ALT="alt"
HOOK_COMMAND=""
FULL_COMMAND=""
@@ -137,6 +138,11 @@ function score_file() {
target="$1"
filename="${target%%##*}"
conditions="${target#*##}"
+
+ if [ "${filename#$YADM_ALT/}" != "${filename}" ]; then
+ filename="${YADM_WORK}/${filename#$YADM_ALT/}"
+ fi
+
score=0
IFS=',' read -ra fields <<< "$conditions"
for field in "${fields[@]}"; do
@@ -1223,6 +1229,7 @@ function configure_paths() {
YADM_ARCHIVE="$YADM_DIR/$YADM_ARCHIVE"
YADM_BOOTSTRAP="$YADM_DIR/$YADM_BOOTSTRAP"
YADM_HOOKS="$YADM_DIR/$YADM_HOOKS"
+ YADM_ALT="$YADM_DIR/$YADM_ALT"
# independent overrides for paths
if [ -n "$YADM_OVERRIDE_REPO" ]; then