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
110 die "Cannot read rootfs tarball: $ROOTFS_TARBALL"110 die "Cannot read rootfs tarball: $ROOTFS_TARBALL"
111fi111fi
112 112
113# Setup the platform variable. Here we want just the name and
114# optionally -musl if this is the musl variant.
115PLATFORM="${ROOTFS_TARBALL#void-}"
116PLATFORM="${PLATFORM%-PLATFORMFS*}"
117
118# Be absolutely certain the platform is supported before continuing
119case "$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..."
122esac
123
113# By default we build all platform images with a 64MiB boot partition124# By default we build all platform images with a 64MiB boot partition
114# formated FAT16, and an approximately 1.9GiB root partition formated125# formated FAT16, and an approximately 1.9GiB root partition formated
115# ext4. More exotic combinations are of course possible, but this126# ext4. More exotic combinations are of course possible, but this
@@ -123,11 +134,6 @@ fi · 7 unmodified lines
123readonly REQTOOLS="sfdisk partx losetup mount truncate mkfs.${BOOT_FSTYPE} mkfs.${ROOT_FSTYPE}"134readonly REQTOOLS="sfdisk partx losetup mount truncate mkfs.${BOOT_FSTYPE} mkfs.${ROOT_FSTYPE}"
124check_tools135check_tools
125 136
126# Setup the platform variable. Here we want just the name and
127# optionally -musl if this is the musl variant.
128PLATFORM="${ROOTFS_TARBALL#void-}"
129PLATFORM="${PLATFORM%-PLATFORMFS*}"
130
131# This is an awful hack since the script isn't using privesc137# This is an awful hack since the script isn't using privesc
132# mechanisms selectively. This is a TODO item.138# mechanisms selectively. This is a TODO item.
133if [ "$(id -u)" -ne 0 ]; then139if [ "$(id -u)" -ne 0 ]; then
@@ -141,12 +147,6 @@ if [ -z "$FILENAME" ]; then · 7 unmodified lines
141 FILENAME="void-${PLATFORM}-$(date +%Y%m%d).img"147 FILENAME="void-${PLATFORM}-$(date +%Y%m%d).img"
142fi148fi
143 149
144# Be absolutely certain the platform is supported before continuing
145case "$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..."
148esac
149
150# Create the base image. This was previously accomplished with dd,150# Create the base image. This was previously accomplished with dd,
151# but truncate is markedly faster.151# but truncate is markedly faster.
152info_msg "Creating disk image ($IMGSIZE) ..."152info_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