Subject: [alpine-aports] [PATCH] scripts/bootstrap.sh: Make script usage display

From: Anthony Davies <[email-masked]>
Date: Mon, 8 Jul 2019 23:55:33 +1000

---
 scripts/bootstrap.sh | 46 ++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh
index 6a23e98cfc..5e0b496a47 100755
--- a/scripts/bootstrap.sh
+++ b/scripts/bootstrap.sh
@@ -8,6 +8,29 @@ SUDO_APK=abuild-apk
 # optional cross build packages
 KERNEL_PKG="linux-firmware linux-vanilla"
 
+if [ -z "$TARGET_ARCH" ]; then
+	program=$(basename $0)
+	cat <<EOF
+usage: $program TARGET_ARCH
+
+This script creates a local cross-compiler, and uses it to
+cross-compile an Alpine Linux base system for new architecture.
+
+Steps for introducing new architecture include:
+- adding the compiler triplet and arch type to abuild
+- adding the arch type detection to apk-tools
+- adjusting build rules for packages that are arch aware:
+  gcc, openssl, linux-headers
+- create new kernel config for linux-vanilla
+
+After these steps the initial cross-build can be completed
+by running this with the target arch as parameter, e.g.:
+	./$program aarch64
+
+EOF
+	return 1
+fi
+
 # get abuild configurables
 [ -e /usr/share/abuild/functions.sh ] || (echo "abuild not found" ; exit 1)
 CBUILDROOT="$(CTARGET=$TARGET_ARCH . /usr/share/abuild/functions.sh ; echo $CBUILDROOT)"
@@ -33,29 +56,6 @@ msg() {
         printf "${prompt} ${name}: %s\n" "$1" >&2
 }
 
-if [ -z "$TARGET_ARCH" ]; then
-	program=$(basename $0)
-	cat <<EOF
-usage: $program TARGET_ARCH
-
-This script creates a local cross-compiler, and uses it to
-cross-compile an Alpine Linux base system for new architecture.
-
-Steps for introducing new architecture include:
-- adding the compiler triplet and arch type to abuild
-- adding the arch type detection to apk-tools
-- adjusting build rules for packages that are arch aware:
-  gcc, openssl, linux-headers
-- create new kernel config for linux-vanilla
-
-After these steps the initial cross-build can be completed
-by running this with the target arch as parameter, e.g.:
-	./$program aarch64
-
-EOF
-	return 1
-fi
-
 if [ ! -d "$CBUILDROOT" ]; then
 	msg "Creating sysroot in $CBUILDROOT"
 	mkdir -p "$CBUILDROOT/etc/apk/keys"
-- 
2.22.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---