Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Mazovetskiy <glex.spb@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] relocate-sdk: Allow relocating to any location
Date: Sat, 28 Mar 2020 23:49:44 +0000	[thread overview]
Message-ID: <20200328234945.12552-1-glex.spb@gmail.com> (raw)

Previously, the script could only relocate to the current location.

This caused issues for SDK maintainers, as the default target location
(e.g. /opt/my-sdk) would need to be created and the content copied
to it during the build process, which is error-prone.

With this change you can now pass a target location argument to
./relocate-sdk.sh (this does not move the directory).
---
 support/misc/relocate-sdk.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/support/misc/relocate-sdk.sh b/support/misc/relocate-sdk.sh
index caabeaa6f6..981d272425 100755
--- a/support/misc/relocate-sdk.sh
+++ b/support/misc/relocate-sdk.sh
@@ -1,15 +1,20 @@
 #!/bin/sh
-#
-if [ "$#" -ne 0 ]; then
-    echo "Run this script to relocate the buildroot SDK at that location"
+
+if [ "$#" -gt 1 ]; then
+    echo "Usage: $0 [path]"
+    echo "Run this script to relocate the buildroot SDK to the current location"
+    echo "If [path] is given, sets the location to [path] (without moving it)"
     exit 1
 fi
 
-LOCFILE="share/buildroot/sdk-location"
-FILEPATH="$(readlink -f "$0")"
-NEWPATH="$(dirname "${FILEPATH}")"
+cd "$(dirname "$(readlink -f "$0")")"
+if [ "$#" -eq 1 ]; then
+    NEWPATH="$1"
+else
+    NEWPATH="${PWD}"
+fi
 
-cd "${NEWPATH}"
+LOCFILE="share/buildroot/sdk-location"
 if [ ! -r "${LOCFILE}" ]; then
     echo "Previous location of the buildroot SDK not found!"
     exit 1
-- 
2.20.1

             reply	other threads:[~2020-03-28 23:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-28 23:49 Gleb Mazovetskiy [this message]
2021-07-17  9:39 ` [Buildroot] [PATCH] relocate-sdk: Allow relocating to any location Yann E. MORIN
2021-07-17 10:08   ` Gleb Mazovetskiy
2021-07-17 10:08     ` Gleb Mazovetskiy
2021-07-17 10:26     ` Yann E. MORIN
2021-07-17 10:33       ` Gleb Mazovetskiy
2021-07-17 10:33         ` Gleb Mazovetskiy
2022-01-06 21:28 ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200328234945.12552-1-glex.spb@gmail.com \
    --to=glex.spb@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox