1
0
Fork 0
mirror of synced 2024-06-18 21:51:10 -04:00

Allow override of OS/Host/User (#21)

This commit is contained in:
Tim Byrne 2017-01-18 19:51:28 -06:00
parent 1534420106
commit 3b4c405d7f
No known key found for this signature in database
GPG key ID: 6CBE24C2FD8CF76E

22
yadm
View file

@ -108,14 +108,26 @@ function alt() {
require_repo
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
match_system=$(uname -s)
match_system="$(config alt.os)"
if [ -z "$match_system" ] ; then
match_system=$(uname -s)
fi
match_system="(%|$match_system)"
match_host=$(hostname)
match_host=${match_host%%.*} #; trim any domain from hostname
match_host="$(config alt.host)"
if [ -z "$match_host" ] ; then
match_host=$(hostname)
match_host=${match_host%%.*} #; trim any domain from hostname
fi
match_host="(%|$match_host)"
match_user=$(id -u -n)
match_user="$(config alt.user)"
if [ -z "$match_user" ] ; then
match_user=$(id -u -n)
fi
match_user="(%|$match_user)"
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
match="^(.+)##($match_system|$match_system\.$match_host|$match_system\.$match_host\.$match_user|())$"
#; process relative to YADM_WORK