History

mkimage.sh: initialize and check PLATFORM earlier in script

John Zimmermann committed 5 years ago

Commit 2ea40dc1 parent 48ba5d61 file · +11 −11Browse files

Unified · Split

mkimage.sh.in+11−11
@@ -110,6 +110,17 @@ elif [ ! -r "$ROOTFS_TARBALL" ]; then · 109 unmodified lines
110110 die "Cannot read rootfs tarball: $ROOTFS_TARBALL"
111111 fi
112112
113+# Setup the platform variable. Here we want just the name and
114+# optionally -musl if this is the musl variant.
115+PLATFORM="${ROOTFS_TARBALL#void-}"
116+PLATFORM="${PLATFORM%-PLATFORMFS*}"
117+
118+# Be absolutely certain the platform is supported before continuing
119+case "$PLATFORM" in
120+ bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|rpi4|GCP|pinebookpro|pinephone|*-musl);;
121+ *) die "The $PLATFORM is not supported, exiting..."
122+esac
123+
113124 # By default we build all platform images with a 64MiB boot partition
114125 # formated FAT16, and an approximately 1.9GiB root partition formated
115126 # ext4. More exotic combinations are of course possible, but this
@@ -123,11 +134,6 @@ fi · 7 unmodified lines
123134 readonly REQTOOLS="sfdisk partx losetup mount truncate mkfs.${BOOT_FSTYPE} mkfs.${ROOT_FSTYPE}"
124135 check_tools
125136
126−# Setup the platform variable. Here we want just the name and
127−# optionally -musl if this is the musl variant.
128−PLATFORM="${ROOTFS_TARBALL#void-}"
129−PLATFORM="${PLATFORM%-PLATFORMFS*}"
130−
131137 # This is an awful hack since the script isn't using privesc
132138 # mechanisms selectively. This is a TODO item.
133139 if [ "$(id -u)" -ne 0 ]; then
@@ -141,12 +147,6 @@ if [ -z "$FILENAME" ]; then · 7 unmodified lines
141147 FILENAME="void-${PLATFORM}-$(date +%Y%m%d).img"
142148 fi
143149
144−# Be absolutely certain the platform is supported before continuing
145−case "$PLATFORM" in
146− bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|rpi4|GCP|pinebookpro|pinephone|*-musl);;
147− *) die "The $PLATFORM is not supported, exiting..."
148−esac
149−
150150 # Create the base image. This was previously accomplished with dd,
151151 # but truncate is markedly faster.
152152 info_msg "Creating disk image ($IMGSIZE) ..."

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t