summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-12-20 12:45:15 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-12-20 12:45:15 +0100
commit440e64fc28c4bb22782bc9eb2842c773707ab49a (patch)
tree8cadb534446423c0ad72f8a34c6b8ab87df0b513
parent7e52204f8bb45e45fbeb9020fda0b7b86a28094f (diff)
enhanced arg parsing + automatic procedure can read configs now
-rwxr-xr-xsrc/aif.sh4
-rw-r--r--src/core/procedures/automatic14
2 files changed, 15 insertions, 3 deletions
diff --git a/src/aif.sh b/src/aif.sh
index 4ef130e..2386992 100755
--- a/src/aif.sh
+++ b/src/aif.sh
@@ -275,7 +275,7 @@ procedure=
# in that case -p needs to be the first option, but that's doable imho
# an alternative would be to provide an argumentstring for the profile. eg aif -p profile -a "-a a -b b -c c"
-var_OPTS_STRING=":i:dlp:" # you can override this variable in your procedure.
+var_OPTS_STRING="" # you can override this variable in your procedure.
# Processes args that were not already matched by the basic rules.
@@ -320,7 +320,7 @@ load_module core
load_procedure "$module" "$procedure"
-while getopts $var_OPTS_STRING OPTION
+while getopts ":i:dlp:$var_OPTS_STRING" OPTION
do
case $OPTION in
i)
diff --git a/src/core/procedures/automatic b/src/core/procedures/automatic
index 0e47f7b..cdda847 100644
--- a/src/core/procedures/automatic
+++ b/src/core/procedures/automatic
@@ -3,12 +3,24 @@
# This is a procedure for automatic deployment/installation/configuration of systems. # TODO: document! (readme, notes about deployment profiles, examples, ...)
# In theory, the only manual thing should maybe be configuring the runtime network
-# TODO: implement profile reading
# TODO: I don't know if you can do non-interactive dm_crypt stuff.. maybe by pulling luks keyfiles from svn/git/..?
depend_module yaourt
depend_procedure core base
+var_OPTS_STRING="c:"
+process_args ()
+{
+ [ "$1" = '-c' ]
+ then
+ [ -z "$2" ] && die_error "You must specify a config"
+ source $2 || die_error "Could not source config $2"
+ else
+ usage
+ exit 5
+ fi
+}
+
phase_preparation=(\
configure \
intro \