|
@@ -52,41 +52,37 @@ cleanup() {
|
|
|
[ -d "$ROOTFS" ] && rmdir "$ROOTFS"
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-# This script is designed to take in a complete platformfs and spit
|
|
|
-# out an image that is suitable for writing with dd. The image is
|
|
|
-# configurable in terms of the filesystem layout, but not in terms of
|
|
|
-# the installed system itself. Customization to the installed system
|
|
|
-# should be made during the mkplatformfs step.
|
|
|
usage() {
|
|
|
- cat <<_EOF
|
|
|
-Usage: $PROGNAME [options] <rootfs-tarball>
|
|
|
-
|
|
|
-The <rootfs-tarball> argument expects a tarball generated by void-mkrootfs.
|
|
|
-The platform is guessed automatically by its name.
|
|
|
-
|
|
|
-Accepted sizes suffixes: KiB, MiB, GiB, TiB, EiB.
|
|
|
-
|
|
|
-OPTIONS
|
|
|
- -b <fstype> Set /boot filesystem type (defaults to FAT)
|
|
|
- -B <bsize> Set /boot filesystem size (defaults to 64MiB)
|
|
|
- -r <fstype> Set / filesystem type (defaults to EXT4)
|
|
|
- -s <totalsize> Set total image size (defaults to 2GB)
|
|
|
- -o <output> Set image filename (guessed automatically)
|
|
|
- -x <num> Use <num> threads to compress the image (dynamic if unset)
|
|
|
- -h Show this help
|
|
|
- -V Show version
|
|
|
-
|
|
|
-Resulting image will have 2 partitions, /boot and /.
|
|
|
-_EOF
|
|
|
- exit 0
|
|
|
+ cat <<-EOH
|
|
|
+ Usage: $PROGNAME [options] <platformfs-tarball>
|
|
|
+
|
|
|
+ Generates a filesystem image suitable for writing with dd from a PLATFORMFS
|
|
|
+ tarball generated by mkplatformfs.sh. The filesystem layout is configurable,
|
|
|
+ but customization of the installed system should be done when generating the
|
|
|
+ PLATFORMFS. The resulting image will have 2 partitions, /boot and /.
|
|
|
+
|
|
|
+ OPTIONS
|
|
|
+ -b <fstype> /boot filesystem type (default: vfat)
|
|
|
+ -B <bsize> /boot filesystem size (default: 64MiB)
|
|
|
+ -r <fstype> / filesystem type (default: ext4)
|
|
|
+ -s <totalsize> Total image size (default: 2GiB)
|
|
|
+ -o <output> Image filename (default: guessed automatically)
|
|
|
+ -x <num> Number of threads to use for image compression (default: dynamic)
|
|
|
+ -h Show this help and exit
|
|
|
+ -V Show version and exit
|
|
|
+
|
|
|
+ Accepted size suffixes: KiB, MiB, GiB, TiB, EiB.
|
|
|
+
|
|
|
+ The <platformfs-tarball> argument expects a tarball generated by mkplatformfs.sh.
|
|
|
+ The platform is guessed automatically by its name.
|
|
|
+ EOH
|
|
|
}
|
|
|
|
|
|
# ########################################
|
|
|
# SCRIPT EXECUTION STARTS HERE
|
|
|
# ########################################
|
|
|
|
|
|
-while getopts "b:B:o:r:s:x:h:V" opt; do
|
|
|
+while getopts "b:B:o:r:s:x:hV" opt; do
|
|
|
case $opt in
|
|
|
b) BOOT_FSTYPE="$OPTARG";;
|
|
|
B) BOOT_FSSIZE="$OPTARG";;
|
|
@@ -95,14 +91,17 @@ while getopts "b:B:o:r:s:x:h:V" opt; do
|
|
|
s) IMGSIZE="$OPTARG";;
|
|
|
x) COMPRESSOR_THREADS="$OPTARG" ;;
|
|
|
V) version; exit 0;;
|
|
|
- *) usage;;
|
|
|
+ h) usage; exit 0;;
|
|
|
+ *) usage >&2; exit 1;;
|
|
|
esac
|
|
|
done
|
|
|
shift $((OPTIND - 1))
|
|
|
ROOTFS_TARBALL="$1"
|
|
|
|
|
|
if [ -z "$ROOTFS_TARBALL" ]; then
|
|
|
- usage
|
|
|
+ echo "$PROGNAME: no ROOTFS tarball specified" >&2
|
|
|
+ usage >&2
|
|
|
+ exit 1
|
|
|
elif [ ! -r "$ROOTFS_TARBALL" ]; then
|
|
|
# In rare cases the tarball can wind up owned by the wrong user.
|
|
|
# This leads to confusing failures if execution is allowed to
|