Allow override of OS/Host/User (#21)
This commit is contained in:
parent
1534420106
commit
3b4c405d7f
1 changed files with 17 additions and 5 deletions
14
yadm
14
yadm
|
@ -108,14 +108,26 @@ function alt() {
|
||||||
|
|
||||||
require_repo
|
require_repo
|
||||||
|
|
||||||
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
|
match_system="$(config alt.os)"
|
||||||
|
if [ -z "$match_system" ] ; then
|
||||||
match_system=$(uname -s)
|
match_system=$(uname -s)
|
||||||
|
fi
|
||||||
match_system="(%|$match_system)"
|
match_system="(%|$match_system)"
|
||||||
|
|
||||||
|
match_host="$(config alt.host)"
|
||||||
|
if [ -z "$match_host" ] ; then
|
||||||
match_host=$(hostname)
|
match_host=$(hostname)
|
||||||
match_host=${match_host%%.*} #; trim any domain from hostname
|
match_host=${match_host%%.*} #; trim any domain from hostname
|
||||||
|
fi
|
||||||
match_host="(%|$match_host)"
|
match_host="(%|$match_host)"
|
||||||
|
|
||||||
|
match_user="$(config alt.user)"
|
||||||
|
if [ -z "$match_user" ] ; then
|
||||||
match_user=$(id -u -n)
|
match_user=$(id -u -n)
|
||||||
|
fi
|
||||||
match_user="(%|$match_user)"
|
match_user="(%|$match_user)"
|
||||||
|
|
||||||
|
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
|
||||||
match="^(.+)##($match_system|$match_system\.$match_host|$match_system\.$match_host\.$match_user|())$"
|
match="^(.+)##($match_system|$match_system\.$match_host|$match_system\.$match_host\.$match_user|())$"
|
||||||
|
|
||||||
#; process relative to YADM_WORK
|
#; process relative to YADM_WORK
|
||||||
|
|
Loading…
Reference in a new issue