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

Support YADM_DISTRO in Jinja templates (#68)

This commit is contained in:
Tim Byrne
2017-07-03 16:21:27 -05:00
parent 280b1179f7
commit 5293db986a
4 changed files with 64 additions and 3 deletions

10
yadm
View File

@@ -34,6 +34,7 @@ GPG_PROGRAM="gpg"
GIT_PROGRAM="git"
LS_PROGRAM="/bin/ls"
ENVTPL_PROGRAM="envtpl"
LSB_RELEASE_PROGRAM="lsb_release"
PROC_VERSION="/proc/version"
OPERATING_SYSTEM="Unknown"
@@ -230,6 +231,7 @@ function alt() {
YADM_OS="$local_system" \
YADM_HOSTNAME="$local_host" \
YADM_USER="$local_user" \
YADM_DISTRO=$(query_distro) \
"$ENVTPL_PROGRAM" < "$tracked_file" > "$real_file"
else
debug "envtpl not available, not creating $real_file from template $tracked_file"
@@ -698,6 +700,14 @@ function version() {
#; ****** Utility Functions ******
function query_distro() {
distro=""
if command -v "$LSB_RELEASE_PROGRAM" >/dev/null 2>&1; then
distro=$($LSB_RELEASE_PROGRAM -si 2>/dev/null)
fi
echo "$distro"
}
function process_global_args() {
#; global arguments are removed before the main processing is done