-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta-bsp-imx8mq: tools: Added user configuration script
Added user configuration script. Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
- Loading branch information
Showing
2 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash -xv | ||
|
||
user_local_conf=$(mktemp --dry-run --tmpdir=/tmp userXXX) | ||
local_conf="conf/local.conf" | ||
|
||
mem=( d1 d2 cfg ) | ||
cfg_mem() { | ||
cat << EOP >> ${user_local_conf} | ||
UBOOT_CONFIG = "$1" | ||
EOP | ||
} | ||
|
||
chrome=( yes no ) | ||
cfg_chrome() { | ||
if [[ $1 == "yes" ]];then | ||
cat << EOP >> ${user_local_conf} | ||
# Add Chromium | ||
IMAGE_INSTALL_append = \\ | ||
"\${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' chromium-ozone-wayland', \\ | ||
bb.utils.contains('DISTRO_FEATURES', 'x11', ' chromium-x11', \\ | ||
'', d), d)}" | ||
EOP | ||
fi | ||
} | ||
|
||
rootfs=( ro rw ) | ||
cfg_rootfs() { | ||
if [[ $1 == "ro" ]];then | ||
cat << EOP >> ${user_local_conf} | ||
IMAGE_FEATURES += "read-only-rootfs" | ||
EOP | ||
fi | ||
} | ||
|
||
declare -A ARRAYNAME=( [mem]="cfg" [chrome]="yes" [rootfs]="rw" ) | ||
|
||
cat << EOG | ||
--- Users' Configurations started --- | ||
EOG | ||
|
||
for ARRAY in ${!ARRAYNAME[@]}; do | ||
select_string='default ' | ||
eval array=\${${ARRAY}[@]} | ||
for value in ${array[@]}; do | ||
select_string+=${value}" " | ||
done | ||
PS3="${ARRAY} configuration [ ${ARRAYNAME[${ARRAY}]} ] (Ctrl^C -- exit) : " | ||
select i in $select_string; do | ||
[[ -z ${i} ]] && echo "Invalid option -(" || case $i in | ||
default) | ||
break | ||
;; | ||
*) | ||
ARRAYNAME[${ARRAY}]=${i} | ||
break | ||
;; | ||
esac | ||
done # select | ||
done # for | ||
|
||
for ARRAY in ${!ARRAYNAME[@]}; do | ||
command -v cfg_${ARRAY} &>/dev/null | ||
[[ $? -eq 0 ]] && cfg_${ARRAY} ${ARRAYNAME[${ARRAY}]} | ||
done | ||
|
||
if [[ -f ${local_conf} ]];then | ||
cat << EOH >> ${local_conf} | ||
# Users' Configurations | ||
EOH | ||
cat ${user_local_conf} >> ${local_conf} | ||
fi | ||
|
||
rm -rf ${user_local_conf} |