|author||Richard Maw <firstname.lastname@example.org>||2014-03-18 16:42:03 +0000|
|committer||Richard Maw <email@example.com>||2014-03-20 16:33:34 +0000|
Add write extension for making a package that allows deferred instansiationbaserock/richardmaw/S10721-img-pkg
This is a write extension for making a package that can be used to install the produced system. Ideally we'd instead have Baserock everywhere to do the deployment, but we need to support this workflow until that is possible. It gets configured with a script templates that get filled in with the paths to the rootfs tarball as @@ROOTFS_TAR_PATH@@, script directory as @@SCRIPT_DIR@@ and copied boot-files as @@IMAGE_DIR@@. Scripts to include are specified as a relative path to your morphologies repository, separated by : characters in the INCLUDE_SCRIPTS variable. If another separator is convenient, it can be specified in the INCLUDE_SCRIPTS_SEPARATOR variable, which has the same semantics as the shell IFS variable. Other files needed to create the disk image, such as bootloader image files can be specified in BOOTLOADER_BLOBS, relative to the root of the rootfs, separated with similar rules to INCLUDE_SCRIPTS. The name of the rootfs tarball, the scripts subdirectory and the bootloader blobs subdirectory can be changed with the ROOTFS_TAR, SCRIPT_SUBDIR and IMAGE_SUBDIR variables, but the default should be sufficient. The compression of the rootfs tarball, and the package tarball can be specified by specifying a shell command that reads the uncompressed tarball from stdin and writes to stdout in the ROOTFS_COMPRESS and OUTPUT_COMPRESS variables.
Diffstat (limited to 'imgpkg/disk-install.sh.in')
1 files changed, 47 insertions, 0 deletions
diff --git a/imgpkg/disk-install.sh.in b/imgpkg/disk-install.sh.in
new file mode 100644
@@ -0,0 +1,47 @@
+ cat <<EOF
+usage: $0 DISK [TARGET_DISK]
+DISK: Where the disk appears on your development machine
+TARGET_DISK: What the disk will appear as on the target machine
+if [ "$#" -lt 1 -o "$#" -gt 2 ]; then
+ exit 1
+status Formatting "$DISK" as ext4
+ info Mounting "$DISK"
+ MP="$(temp_mount -t ext4 "$DISK")"
+ info Mounted "$DISK" to "$MP"
+ set +e
+ set -e
+ info Copying rootfs onto disk
+ extract_rootfs "$MP"
+ info Configuring disk paths
+ install_fs_config "$MP" "$TARGET_DISK"
+ info Installing bootloader
+ install_bootloader "$DISK" "$MP"
+ if [ "$ret" != 0 ]; then
+ warn Filling rootfs failed with "$ret"
+ info Unmounting "$DISK" from "$MP" and removing "$MP"
+ untemp_mount "$MP"
+ exit "$ret"