Skip to content

Commit 6dd3e26

Browse files
alexeicolingalak
authored andcommitted
scripts: template_dir: setup: add -[no]rc arg
Needed for unattended setups that do not want to answer yes (with -y) to the prompt about creating ~/.zephyrrc.
1 parent 399e79d commit 6dd3e26

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/template_dir

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
target_sdk_dir=""
33
post_install_cleanup=1
44
confirm=0
5-
rc_confirm=0
5+
rc_confirm=""
66

77
usage () {
88
cat << EOF
@@ -19,6 +19,9 @@ Options:
1919
-y
2020
Automatic yes to prompts; assume "yes" as answer to all prompts.
2121

22+
-[no]rc
23+
Whether to create/update the ~/.zerphyrc file (prompt if not given)
24+
2225
EOF
2326
}
2427

@@ -65,6 +68,12 @@ while [ "$1" != "" ]; do
6568
confirm="y";
6669
rc_confirm="y";
6770
;;
71+
-rc )
72+
rc_confirm="y";
73+
;;
74+
-norc )
75+
rc_confirm="n";
76+
;;
6877
* )
6978
echo "Error: Invalid argument \"$1\""
7079
usage
@@ -115,7 +124,7 @@ do_zephyrrc()
115124
echo " export ZEPHYR_TOOLCHAIN_VARIANT=zephyr"
116125
echo " export ZEPHYR_SDK_INSTALL_DIR=$target_sdk_dir"
117126
echo
118-
if [ "$rc_confirm" != "y" ]; then
127+
if [ -z "$rc_confirm" ]; then
119128
echo "Update/Create $HOME/.zephyrrc with environment variables setup for you (y/n)? "
120129
while read rc_confirm; do
121130
[ "$rc_confirm" = "Y" -o "$rc_confirm" = "y" \

0 commit comments

Comments
 (0)