From dd8f8f8e89b9e2fdfe3262bc685368ad77d96e2a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 28 Mar 2020 23:49:44 +0000 Subject: [PATCH] support/misc/relocate-sdk.sh: allow relocating to any directory 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 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- 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