Introduce tod - Template Open Deploy
diff --git a/module/test1/holder.sh b/module/test1/holder.sh
new file mode 100644
index 0000000..5a868e4
--- /dev/null
+++ b/module/test1/holder.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# holder.sh - test
+#
+# Copyright 2019 Luigi Santivetti <luigi.santivetti@gmail.com>
+
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# Test plain variable
+_TEST1_VAR0_HOLDER_="test1_var0_holder"
+
+# Test variable externally defined within test1 module
+_TEST1_VAR1_MODULE_="$mod_name_clash"
+
+# Test variable externally defined in foreign holder and composite
+_TEST1_VAR2_EXTREF_="${_TEST2_VAR0_HOLDER_}-notnull"
+
+# Test variable externally defined in foreign module and composite
+_TEST1_VAR3_EXTREF_="${_TEST2_VAR1_MODULE_}-notnull"
+
+# Test circular dependencies. Uncomment will cause validation to detect a loop
+#_TEST1_VAR4_EXTREF_="${_TEST2_VAR4_HOLDER_}"
+#_TEST1_VAR5_EXTREF_="${_TEST2_VAR5_MODULE_}"
+
+# Test variable externally defined in foreign holder
+_TEST1_VAR6_EXTREF_="${_TEST2_VAR0_HOLDER_}"
+
+# Test variable externally defined in foreign module
+_TEST1_VAR7_EXTREF_="${_TEST2_VAR1_MODULE_}"
+
+# Test command substitution with unescaped quote symbols
+_TEST1_VAR8_CMDSUB_="text $(dirname "$(basename "$(dirname "$(pwd)")")")"
+
+# Test LHS validation. Uncomment will cause validation to detect invalid LHS
+#_NOVALID_VAR9_LHS_="invalid LHS. First token must match module's name"
+
+# Test RHS validation. Uncomment will cause validation to detect multiple
+# commands in line.
+#_TEST1_VAR10_MULTIPLE_CMD_="legal RHS"; echo "Illegal continuation"
+#_TEST1_VAR11_MULTIPLE_CMD_="legal RHS" && _TEST1_VAR12_="illegal continuation" 
+#_TEST1_VAR13_MULTIPLE_CMD_="legal RHS"; if :;then echo "true"; fi 
+
+# Test if/else
+if true; then
+	_TEST1_VAR14_="true"
+else
+	_TEST1_VAR15_="false"
+fi
+
+# Test incremental assignment
+_TEST1_VAR16_="var15"
+_TEST1_VAR16_+=" + var15"
+
+# FIXME: test for null value. Validation does not pick this up if in the same
+# module. holder.sh will never trigger an error cause RHS isn't checked for
+# local holder variables.
+_TEST1_VAR17_=""
+
+# Test for reference null value. Uncomment will cause validation to detect a null
+# value for a referenced variable.
+#_TEST1_VAR17_="${_TEST2_VAR6_EXTREF_}"
+
+# Test for reference unbound. Uncomment will cause validation to detect an unbound
+# variable.
+#_TEST1_VAR18_="${_TEST2_VAR6_EXTREF_}"
+
+# Test for unknown variable name. Uncomment will cause validation to detect an
+# unknown variable name on the RHS.
+#_TEST1_VAR19_="${this_isn_t_a_valid_reference_name}"
+
+# Test for invalid module name. Uncomment will cause validation to detect an
+# invalid module name.
+#_TEST1_VAR20_="${_MODULEFOO_DOES_NOT_EXISTS_}"
diff --git a/module/test1/module.sh b/module/test1/module.sh
new file mode 100644
index 0000000..00e4360
--- /dev/null
+++ b/module/test1/module.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# module.sh - test1
+#
+# Copyright 2019 Luigi Santivetti <luigi.santivetti@gmail.com>
+
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+declare -r module="test1"
+source $common_sh
+
+module_enable $module
+
+declare -r tmp_d="${mod_rootfs_d}/tmp"
+declare -r test="${module}-testfile.txt"
+declare -r test_f="$tmp_d/$test"
+
+declare -r mod_name_clash="test1_var1_module"
+
+declare -ar mod_more_dirs=( $tmp_d )
+declare -ar mod_more_files=( $test_f )
+declare -ar mod_more_trefs=( test_t )
+
+# Test file removal. Tod should be able to uninstall files by looking at what
+# appears in $instance_d/uninstall.sh. In this case if $test_f was installed,
+# then by uncommenting these lines would exclude it and cause tod to remove it.
+#declare -ar mod_more_files=(  )
+#declare -ar mod_more_trefs=(  )
+
+function tod_watch
+{
+	__watch_module_common || return $s_err
+}
+
+function tod_doins
+{
+	__doins_module_common || return $s_err
+}
+
+function tod_upins
+{
+	__upins_module_common || return $s_err
+}
+
+function tod_clins
+{
+	__clins_module_common || return $s_err
+}
diff --git a/module/test1/scheme.sh b/module/test1/scheme.sh
new file mode 100644
index 0000000..1801fdb
--- /dev/null
+++ b/module/test1/scheme.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# holder.sh - test
+#
+# Copyright 2019 Luigi Santivetti <luigi.santivetti@gmail.com>
+
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+declare -r test_t="\
+
+test1 - scheme.sh - test_t
+
+@@ START >>>>>>>>>>>>>
+${_TEST1_VAR0_HOLDER_}
+${_TEST1_VAR1_MODULE_}
+${_TEST1_VAR2_EXTREF_}
+${_TEST1_VAR3_EXTREF_}
+\${_TEST1_VAR4_EXTREF_}
+\${_TEST1_VAR5_EXTREF_}
+${_TEST1_VAR6_EXTREF_}
+${_TEST1_VAR7_EXTREF_}
+\${_TEST3_VAR7_UNBOUND_}
+@@ END <<<<<<<<<<<<<<<
+"