All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
To: buildroot@buildroot.org
Subject: [Buildroot] [git commit] support/misc/relocate-sdk.sh: allow relocating to any directory
Date: Thu, 6 Jan 2022 22:27:56 +0100	[thread overview]
Message-ID: <20220106212331.A4B96829F5@busybox.osuosl.org> (raw)

commit: https://git.buildroot.net/buildroot/commit/?id=dd8f8f8e89b9e2fdfe3262bc685368ad77d96e2a
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Currently, relocate-sdk.sh must be run _after_ relocating the SDK. There
are cases where it is useful to already prepare the SDK _before_
relocating. For example, it allows to prepare a tarball that the user
has to extract to a specific, pre-defined location and nothing more than
that, which is simpler for the user than requiring the script to be run.
In addition, it hides the build directory that was used by the SDK
builder (somewhat).

Add an optional argument to relocate-sdk.sh that gives the target
directory.

Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 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
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

                 reply	other threads:[~2022-01-06 21:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220106212331.A4B96829F5@busybox.osuosl.org \
    --to=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.