commit - 4459883d8ca3c9af335b35ea63ee6866b09b4ba3
commit + 6e5647975cb89abf6656cd1bfe1467c304b0eb2d
blob - 6242c53c4573abc37e21c294645aae32fcda26a8
blob + 8023de07f5d861918ae4294d1582a2a5d0a63e40
--- Makefile
+++ Makefile
for node in $(SSH_TEST_NODES); do \
. $(UTILITY) && import "$$node"; \
done
+ cd testdir/workdir2/ && . $(UTILITY) && import notfound || :
find testdir/workdir2/nodes | grep sshd_config
find testdir/workdir2/nodes
- cd testdir/workdir2/ && . $(UTILITY) && import notfound || :
@echo _________________________________________________________
blob - ebe25be32e1f9982fa1092b78ad73df33ea22d22
blob + 5a1a83a77b6f849d8d304f55c06a40d09caaf067
--- README.md
+++ README.md
13. [source](#source)
14. [groupsource](#groupsource)
15. [nodesource](#groupsource)
+16. [template](#template)
+17. [grouptemplate](#grouptemplate)
+18. [nodetemplate](#nodetemplate)
---
name as argument, produces an error if filename is not found from the group
directory
+***Usage:***
```sh
groupsource filename
```
Change directory to the current group directory then call node and source with the file
name as argument without producing an error if the filename is not found
+***Usage:***
```sh
nodesource filename
```
+### template
+
+***Description:***
+Template the files passed as arguments with the current environment or by
+sourcing a specified file
+
+***Usage:***
+```sh
+template [-s sourcefile] [file...]
+```
+
+### grouptemplate
+
+***Description:***
+Change directory to the current group directory before calling template
+
+***Usage:***
+```sh
+grouptemplate [-s sourcefile] [file...]
+```
+
+### nodetemplate
+
+***Description:***
+Change directory to the current node directory before calling template
+
+***Usage:***
+```sh
+nodetemplate [-s sourcefile] [file...]
+```
+
# r7 library
Usable from the r7 `site-config` file or sourced in the current shell using:
blob - f303425ed9db1b5f5305b45a40fae3ba6a6c9700
blob + 506b189c4bf29c0d7ff86c5a67b2aa63e94976c9
--- r7
+++ r7
# Global configuration
# ====================
-VERSION=0.1.4
+VERSION=0.1.5
: "${HOSTNAME:=$(uname -n)}"
# shellcheck disable=SC2031
r7_install -o "$fileowner" -m "$filemode" "$file" "$target/$newfile"
done
)
+ template() (
+ set -x
+ while getopts "s:" arg; do
+ case $arg in
+ s) source=$OPTARG ;;
+ *) : ;;
+ esac
+ done
+ shift $((OPTIND - 1))
+ set -a
+ test -n "$source" && sh -n "$source" && . "./$source"
+ for file; do
+ sh > "${file%%.tpl}" <<-.
+ cat <<-..
+ $(cat "$file")
+ ..
+ .
+ done
+ )
+ grouptemplate() ( cd "$(groupdir)" && template "$@" ; )
+ nodetemplate() ( cd "$(nodedir)" && template "$@" ; )
set -e
cd /tmp/r7 && umask 027
set +e
# ====
# TODO: WIP
+# shellcheck disable=SC2120
md() {
pandoc -t html -f markdown+smart "$@"
}
blob - 420ef7d964e2998f946cc88e2f476908c81cecdc
blob + 5d7a7965b262bd86effc191733ee091a68d7a35a
--- testdir/grouplib
+++ testdir/grouplib
grouplib_unreachable() {
error goodby2
}
+
+grouplib_template() {
+ cat >myvars <<-'eof'
+ name=Corentin
+ nodename=$nodename
+ eof
+ cat >myfile.tpl <<-'eof'
+ Hello $name !
+ Welcome on the server $nodename !
+ eof
+ template -s myvars myfile.tpl
+ cat myfile
+}