|
|
@ -1,5 +1,12 @@ |
|
|
|
#!/bin/bash -e |
|
|
|
#!/bin/bash -e |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file= |
|
|
|
|
|
|
|
if test -e "${!#}"; then |
|
|
|
|
|
|
|
for var in $(sed -n 's,^ *# \+\(-p\|--pwd\) \+\([a-zA-Z][a-zA-Z0-9_]*\),\2,p' "${!#}"); do |
|
|
|
|
|
|
|
export ${var}=$(pwgen 40 1) |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
while test $# -gt 0; do |
|
|
|
while test $# -gt 0; do |
|
|
|
case "$1" in |
|
|
|
case "$1" in |
|
|
|
(-h|--help) if test -e "${!#}"; then |
|
|
|
(-h|--help) if test -e "${!#}"; then |
|
|
@ -20,6 +27,10 @@ OPTIONS |
|
|
|
-v, --var name=value Set environment variable to be used in the template. |
|
|
|
-v, --var name=value Set environment variable to be used in the template. |
|
|
|
|
|
|
|
|
|
|
|
-p, --pwd name Generate a random password with the given name. |
|
|
|
-p, --pwd name Generate a random password with the given name. |
|
|
|
|
|
|
|
If a password is documented, then it does not |
|
|
|
|
|
|
|
need to be specified. But automated |
|
|
|
|
|
|
|
generation can be overwritten assigning a |
|
|
|
|
|
|
|
value using option -v. |
|
|
|
|
|
|
|
|
|
|
|
FILE |
|
|
|
FILE |
|
|
|
|
|
|
|
|
|
|
@ -115,8 +126,8 @@ EOF |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi;; |
|
|
|
fi;; |
|
|
|
(*) if test $# -ne 1 -o ! -e "$1"; then |
|
|
|
(*) if test $# -ne 1 -o ! -e "$1"; then |
|
|
|
echo "ERROR please specify exactly one template file $*" 1>&2 |
|
|
|
echo "ERROR please specify exactly one template file" 1>&2 |
|
|
|
echo " this not a template file: $*" 1>&2 |
|
|
|
echo " this not one template file: $*" 1>&2 |
|
|
|
echo " see: $0 --help" 1>&2 |
|
|
|
echo " see: $0 --help" 1>&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|