Skip to content

Commit

Permalink
support/misc/relocate-sdk.sh: allow relocating to any directory
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
  • Loading branch information
glebm authored and arnout committed Jan 6, 2022
1 parent 9d7abbf commit dd8f8f8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions support/misc/relocate-sdk.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit dd8f8f8

Please sign in to comment.