@@ -116,6 +116,12 @@ function help {
116
116
echo -e " \t\t able to run bitbake commands."
117
117
echo -e " \t\t Default: no."
118
118
119
+ echo -e " \t-t | --templates-path"
120
+ echo -e " \t\t Provide a custom absolute path to the layer containing custom sample templates."
121
+ echo -e " \t\t For example, if local.conf.sample and bblayers.conf.sample"
122
+ echo -e " \t\t are in a /path/to/layer/conf/samples directory, the template path would be /path/to/layer."
123
+ echo -e " \t\t Default: Use the ones in the integration BSP layer."
124
+
119
125
echo -e " \t--rm-work"
120
126
echo -e " \t\t Inherit rm_work in local.conf."
121
127
echo -e " \t\t Default: no."
@@ -289,6 +295,15 @@ while [[ $# -ge 1 ]]; do
289
295
SHARED_SSTATE=$2
290
296
shift
291
297
;;
298
+ -t|--templates-path)
299
+ # Argument needs to be non-empty
300
+ if [ -z " $2 " ]; then
301
+ log ERROR " \" $1 \" argument is invalid."
302
+ fi
303
+ LAYERSCONF_PATH=$2
304
+ log WARN " LAYERSCONF_PATH: $LAYERSCONF_PATH "
305
+ shift
306
+ ;;
292
307
-l|--log)
293
308
LOG=yes
294
309
;;
@@ -371,6 +386,16 @@ while [[ $# -ge 1 ]]; do
371
386
;;
372
387
esac
373
388
389
+ read -p " Custom templates path? yes/[no] " yn
390
+ case $yn in
391
+ [Yy]* )
392
+ read -p " Templated path? " LAYERSCONF_PATH
393
+ if [ -z " $LAYERSCONF_PATH " ]; then
394
+ log ERROR " Provided path is invalid."
395
+ fi
396
+ ;;
397
+ esac
398
+
374
399
read -p " Generate log? yes/[no] " yn
375
400
case $yn in
376
401
[Yy]* ) LOG=yes;;
@@ -418,6 +443,7 @@ if [ "z$LOG" == "zyes" ]; then
418
443
echo " Compressed image? $COMPRESS " >> $LOGFILE
419
444
echo " Shared downloads directory: $SHARED_DOWNLOADS " >> $LOGFILE
420
445
echo " Shared sstate directory: $SHARED_SSTATE " >> $LOGFILE
446
+ echo " Custom templates path: $LAYERSCONF_PATH " >> $LOGFILE
421
447
echo " Development image? $DEVELOPMENT_IMAGE " >> $LOGFILE
422
448
echo " Forced supervisor image release version: $SUPERVISOR_VERSION " >> $LOGFILE
423
449
echo " Inherit rm_work? $RM_WORK " >> $LOGFILE
@@ -431,18 +457,27 @@ if [ "x$REMOVEBUILD" == "xyes" ]; then
431
457
rm -rf $SCRIPTPATH /../../$BUILD_DIR
432
458
fi
433
459
434
- LAYERSCONF_PATH= $( find " ${SCRIPTPATH} /../../layers/meta-balena " * -name bblayers.conf.sample )
435
- if [ " $( dirname LAYERSCONF_PATH ) " = " samples " ] ; then
436
- BALENA_MACHINE_LAYER= $( echo " ${LAYERSCONF_PATH} " | awk -F ' / ' ' {print $(NF-3)} ' )
460
+ if [ -z " ${LAYERSCONF_PATH} " ] ; then
461
+ # Look on the BSP integration layer meta-balena-*
462
+ LAYERSCONF_PATH= " ${SCRIPTPATH} /../../layers/meta-balena " *
437
463
else
438
- BALENA_MACHINE_LAYER=$( echo " ${LAYERSCONF_PATH} " | awk -F' /' ' {print $(NF-4)}' )
464
+ if [ " ${LAYERSCONF_PATH#/ } " = " ${LAYERSCONF_PATH} " ]; then
465
+ if [ " ${LAYERSCONF_PATH# layers/ } " != " ${LAYERSCONF_PATH} " ]; then
466
+ LAYERSCONF_PATH=" ${SCRIPTPATH} /../../${LAYERSCONF_PATH} "
467
+ else
468
+ log ERROR " The custom templates layer path needs to be either absolute or relative to the build directoty, i.e layers/meta-custom. "
469
+ fi
470
+ fi
471
+ fi
472
+ TEMPLATECONF_PATH=$( dirname $( find ${LAYERSCONF_PATH} -name bblayers.conf.sample) )
473
+ if [ " $( echo " ${TEMPLATECONF_PATH} " | wc -w) " -gt " 1" ]; then
474
+ log ERROR " Multiple bblayers.conf.sample files found in BSP integration layer. Please provide a custom path."
439
475
fi
440
476
441
477
# Configure build
478
+ $SCRIPTPATH /generate-conf-notes.sh " ${TEMPLATECONF_PATH%/ samples} " ${DEVICE_TYPES_JSONS}
442
479
443
- $SCRIPTPATH /generate-conf-notes.sh $SCRIPTPATH /../../layers/${BALENA_MACHINE_LAYER} /conf/ ${DEVICE_TYPES_JSONS}
444
-
445
- export TEMPLATECONF=" $( dirname ${LAYERSCONF_PATH} ) "
480
+ export TEMPLATECONF=" ${TEMPLATECONF_PATH} "
446
481
# scarthgap expects templates to be contained in a subdirectory inside templates/
447
482
if [ -d " ${TEMPLATECONF} /default" ]; then
448
483
TEMPLATECONF=" ${TEMPLATECONF} /default"
0 commit comments