diff options
author | Stephanie Wilde-Hobbs | 2022-09-08 15:55:26 +0200 |
---|---|---|
committer | Stephanie Wilde-Hobbs | 2022-09-08 15:55:26 +0200 |
commit | 0061bab884f98f9695951fbbc8943cad562117a7 (patch) | |
tree | b02554b55e1260edadb680016c6550f9c3b91e31 /0003-scripts-template_dir-re-use-common-prompting-code.patch | |
parent | c274d1454567be4f11a4a20db67332530f3741c8 (diff) | |
download | aur-0061bab884f98f9695951fbbc8943cad562117a7.tar.gz |
0.15.0
Diffstat (limited to '0003-scripts-template_dir-re-use-common-prompting-code.patch')
-rw-r--r-- | 0003-scripts-template_dir-re-use-common-prompting-code.patch | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/0003-scripts-template_dir-re-use-common-prompting-code.patch b/0003-scripts-template_dir-re-use-common-prompting-code.patch deleted file mode 100644 index 7b9cdef2b55a..000000000000 --- a/0003-scripts-template_dir-re-use-common-prompting-code.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 03933375277558f939a12990cae3ee372511d87e Mon Sep 17 00:00:00 2001 -From: Alexei Colin <ac@alexeicolin.com> -Date: Sat, 18 Jul 2020 12:14:07 -0400 -Subject: [PATCH 3/4] scripts/template_dir: re-use common prompting code - ---- - scripts/template_dir | 56 ++++++++++++++++++++++++-------------------- - 1 file changed, 31 insertions(+), 25 deletions(-) - -diff --git a/scripts/template_dir b/scripts/template_dir -index b03d4b5..0a0d69e 100644 ---- a/scripts/template_dir -+++ b/scripts/template_dir -@@ -131,15 +131,10 @@ do_zephyrrc() - echo " export ZEPHYR_SDK_INSTALL_DIR=$target_sdk_dir" - echo - if [ -z "$rc_confirm" ]; then -- echo "Update/Create $HOME/.zephyrrc with environment variables setup for you (y/n)? " -- while read rc_confirm; do -- [ "$rc_confirm" = "Y" -o "$rc_confirm" = "y" \ -- -o "$rc_confirm" = "n" \ -- -o "$rc_confirm" = "N" ] && break -- echo "Invalid input \"$rc_confirm\", please input 'y' or 'n': " -- done -+ prompt "creating/updating $HOME/.zephyrrc with environment variables setup for you " -+ rc_confirm=$answer - fi -- if [ "$rc_confirm" = "y" -o "$rc_confirm" = "Y" ]; then -+ if [ "$rc_confirm" = "y" ]; then - if [ -f $HOME/.zephyrrc ]; then - sed -i "s#ZEPHYR_SDK_INSTALL_DIR=.*#ZEPHYR_SDK_INSTALL_DIR=${target_sdk_dir}#" $HOME/.zephyrrc - sed -i "s#ZEPHYR_TOOLCHAIN_VARIANT=.*#ZEPHYR_TOOLCHAIN_VARIANT=zephyr#" $HOME/.zephyrrc -@@ -163,8 +158,8 @@ do_cmake_package() - return - fi - -- read_confirm "registering Zephyr-sdk CMake module with path $target_sdk_dir " -- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then -+ query "registering Zephyr-sdk CMake module with path $target_sdk_dir " -+ if [ "$answer" = "y" ]; then - if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then - mkdir -p $ZEPHYR_SDK_REGISTRY_DIR - fi -@@ -176,17 +171,28 @@ do_cmake_package() - - # Read the input "y" - # $1 is optional, but allows the caller to provide additional text. --read_confirm () { -- if [ "$confirm" != "y" ]; then -- echo "Do you want to continue $1(y/n)? " -- while read confirm; do -- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \ -- -o "$confirm" = "N" ] && break -- echo "Invalid input \"$confirm\", please input 'y' or 'n': " -- done -- else -- echo -- fi -+prompt () { -+ echo "Do you want to continue $1(y/n)? " -+ while read answer; do -+ if [ "$answer" = "Y" -o "$answer" = "y" ]; then -+ answer="y" -+ break -+ elif [ "$answer" = "N" -o "$answer" = "n" ]; then -+ answer="n" -+ break -+ else -+ echo "Invalid input \"$answer\", please input 'y' or 'n': " -+ fi -+ done -+} -+# Like prompt, but only if prompts were not pre-answered by -y argument -+query () { -+ if [ "$confirm" != "y" ]; then -+ prompt "$1" -+ else -+ answer="y" -+ echo -+ fi - } - - verify_os -@@ -261,8 +267,8 @@ if [ "$sdk_dirname" != "/opt" \ - echo Note: The version number \'-$SDK_VERSION\' can be omitted. - echo - -- read_confirm "installing to ${target_sdk_dir} " -- if [ "$confirm" = "n" -o "$confirm" = "N" ]; then -+ query "installing to ${target_sdk_dir} " -+ if [ "$answer" = "n" ]; then - # Abort the installation - echo "SDK installation aborted!" - exit 1 -@@ -282,8 +288,8 @@ if [ -d $target_sdk_dir ]; then - # wipe the directory first - if [ -d $target_sdk_dir/sysroots ]; then - echo "The directory $target_sdk_dir/sysroots will be removed! " -- read_confirm -- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then -+ query -+ if [ "$answer" = "y" ]; then - rm -rf $target_sdk_dir/sysroots/ - rm -rf $target_sdk_dir/info-zephyr-sdk*/ - rm -fr $target_sdk_dir/sdk_version --- -2.27.0 - |