Skip to content

Commit ac77d85

Browse files
tejlmandgalak
authored andcommitted
template_dir: improved help text for toolchain install dir
This commit reduces number of recommended folders when user is installing outside any of the default paths. For example, is user uses a path under /usr/ but not a default search path, such as /usr/mysdk, then only the /usr/ based recommended paths are printed. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 098dd43 commit ac77d85

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

scripts/template_dir

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,25 @@ if [ "$sdk_dirname" != "/opt" \
246246
-a "$sdk_dirname" != "$HOME/bin" ] ||\
247247
[[ "${sdk_basename}" != "zephyr-sdk"* ]]; then
248248
echo
249-
echo "It is recommended to install Zephyr SDK at one of the following locations:"
250-
echo " ${HOME}/zephyr-sdk[-${SDK_VERSION}]"
251-
echo " ${HOME}/.local/zephyr-sdk[-${SDK_VERSION}]"
252-
echo " ${HOME}/.local/opt/zephyr-sdk[-${SDK_VERSION}]"
253-
echo " ${HOME}/bin/zephyr-sdk[-${SDK_VERSION}]"
254-
echo " /opt/zephyr-sdk[-${SDK_VERSION}]"
255-
echo " /usr/zephyr-sdk[-${SDK_VERSION}]"
256-
echo " /usr/local/zephyr-sdk[-${SDK_VERSION}]"
249+
echo "It is recommended to install Zephyr SDK at one of the following locations for automatic discoverability in CMake:"
250+
251+
if [ ${sdk_dirname:0:4} == "/usr" ]; then
252+
echo " /usr/zephyr-sdk-$SDK_VERSION"
253+
echo " /usr/local/zephyr-sdk-$SDK_VERSION"
254+
elif [ ${sdk_dirname:0:4} == "/opt" ]; then
255+
echo " /opt/zephyr-sdk-${SDK_VERSION}"
256+
elif [ ${sdk_dirname:0:$((${#HOME}+7))} == "$HOME/.local" ]; then
257+
echo " ${HOME}/.local/zephyr-sdk-${SDK_VERSION}"
258+
echo " ${HOME}/.local/opt/zephyr-sdk-${SDK_VERSION}"
259+
elif [ ${sdk_dirname:0:${#HOME}} == "$HOME" ]; then
260+
echo " ${HOME}/zephyr-sdk-${SDK_VERSION}"
261+
echo " ${HOME}/bin/zephyr-sdk-${SDK_VERSION}"
262+
else
263+
echo " ${HOME}/zephyr-sdk-${SDK_VERSION}"
264+
echo " /opt/zephyr-sdk-${SDK_VERSION}"
265+
fi
266+
echo
267+
echo Note: The version number \'-$SDK_VERSION\' can be omitted.
257268
echo
258269

259270
read_confirm "installing to ${target_sdk_dir} "

0 commit comments

Comments
 (0)