diff options
author | 2017-05-11 01:06:09 +0200 | |
---|---|---|
committer | 2017-05-11 01:06:09 +0200 | |
commit | a7bf03217af780f4245af555efdbfdc7ca9e2935 (patch) | |
tree | 66698dc80d43d3ff023560bc483acf66a964212d /INSTALL/setup_image.sh | |
parent | f32036a025d8ae7e6ef02aca8b080e5bca60fc11 (diff) |
Introduce flavours for containers
Multiple variations over a common base must be supported when creating AGL containers.
This commit introduces 'flavours' to achive this goal (see README.md for details).
Current supported flavours:
* generic : same image as before
* xds : new image dedicated to AGL DevKit
Change-Id: I0aa65a1d9e83a2d7aed43e0b135dc43c5537bc53
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'INSTALL/setup_image.sh')
-rwxr-xr-x | INSTALL/setup_image.sh | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/INSTALL/setup_image.sh b/INSTALL/setup_image.sh index b7df59d..7f2099b 100755 --- a/INSTALL/setup_image.sh +++ b/INSTALL/setup_image.sh @@ -33,6 +33,9 @@ fi # source variables in conf file . $INSTDIR/image.conf +# source flavour config file (generated by top Makefile) +. $INSTDIR/flavour.conf + ################################## install docker endpoint ##################### # install the entrypoint script in /usr/bin @@ -80,16 +83,32 @@ ln -sf ../usr/share/zoneinfo/$TIMEZONE /etc/localtime ################################## run other scripts in turn ############## -for script in $INSTDIR/setup.d/*; do - case $(basename $script) in - [0-9][0-9]_*) - echo "--------------------- start script $script ---------------------" - . $script - echo "--------------------- end of script $script ---------------------" - ;; - *) - ;; - esac +function enumerate_tasks() { + for script in $INSTDIR/common.d/*; do + case $(basename $script) in + [0-9][0-9]_*) + echo $(basename $script):$script + ;; + esac + done + + for tsk in $(cat $INSTDIR/flavours/$FLAVOUR.tasks | sed 's/#.*$//g'); do + if [[ -f $INSTDIR/tasks.d/$tsk ]]; then + echo $tsk:$INSTDIR/tasks.d/$tsk + else + # fail to find task + echo "$INSTDIR/flavours/$FLAVOUR.tasks: invalid task '$tsk'" >&2 + return 1 + fi + done + return 0 +} + + +for script in $(enumerate_tasks | sort -k1 -t':' | cut -f2 -d':'); do + echo "--------------------- start script $script ---------------------" + . $script + echo "--------------------- end of script $script ---------------------" done ############################### cleanup ################################### |