Commit 98cdda23 authored by Brian Conway's avatar Brian Conway

Merge branch 'mount_resflash_stdout' into 'master'

Improve formatting of mount_resflash.sh output to be more consumable

See merge request !4
parents f13ab7a7 d0373045
# resflash
### Resilient OpenBSD images for USB flash memory
### Resilient OpenBSD images for flash memory
Resflash is a tool for building reproducible OpenBSD images for embedded and cloud platforms with easy, single-file upgrades. Resflash uses read-only and memory-backed filesystems, and because the filesystems are written to only during system upgrades, they are not subject to corruption or fsck due to power loss - and even cheap USB flash drives can last virtually forever. Resflash images can be written to any bootable media (flash or conventional) and **make great firewall, NAS, or VM server boot drives.** Resflash was written from scratch, with inspiration drawn from [NanoBSD](https://www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/) and [flashrd](http://www.nmedia.net/flashrd/).
Resflash is a tool for building reproducible OpenBSD images for embedded and cloud platforms with easy, single-file upgrades. Resflash uses read-only and memory-backed filesystems, and because the filesystems are written to only during system upgrades, they are not subject to corruption or fsck due to power loss - and even cheap USB flash drives can last virtually forever. Resflash images can be written to any bootable media (flash or conventional) and make **great boot drives for firewalls, NAS, or VM servers.** Resflash was written from scratch, with inspiration drawn from [NanoBSD](https://www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/) and [flashrd](http://www.nmedia.net/flashrd/).
## Features
......@@ -59,7 +59,7 @@ Resflash images contain two main data partitions, one active and one inactive. D
[--pkg_path path1:path2 --pkg_list pkg1,pkg2]
img_size_in_mb openbsd_base_dir
3. Write the .img file (not the .fs file) to the drive: `dd if=resflash-amd64-1906MB-com0_115200-20181019_1520.img of=/dev/rsd3c bs=1m`
3. Write the .img file (not the .fs file) to the drive: `dd if=resflash-amd64-1906MB-com0_115200-20181126_0323.img of=/dev/rsd3c bs=1m`
## Sample usage
......@@ -68,11 +68,11 @@ Sample usage with `[--pkg_path path1:path2 --pkg_list pkg1,pkg2]`:
# ./build_resflash.sh -s 115200 --pkg_path https://stable.mtier.org/updates/$(un
ame -r)/$(arch -s)/:https://mirror.leaseweb.com/pub/OpenBSD/$(uname -r)/packages
/$(arch -s)/ --pkg_list go-- 1906 /usr/rdest
resflash 6.4.0
resflash 6.4.1
Validating OpenBSD base dir: /usr/rdest
Creating disk image: resflash-amd64-1906MB-com0_115200-20181019_1520.img
Creating filesystem: resflash-amd64-1906MB-com0_115200-20181019_1520.fs
Creating disk image: resflash-amd64-1906MB-com0_115200-20181126_0323.img
Creating filesystem: resflash-amd64-1906MB-com0_115200-20181126_0323.fs
Populating filesystem and configuring fstab
Running fw_update
Installing packages: https://stable.mtier.org/updates/6.4/amd64/:https://mirror.
......@@ -82,20 +82,20 @@ Sample usage with `[--pkg_path path1:path2 --pkg_list pkg1,pkg2]`:
Build complete!
File sizes:
886M resflash-amd64-1906MB-com0_115200-20181019_1520.fs
1.9G resflash-amd64-1906MB-com0_115200-20181019_1520.img
886M resflash-amd64-1906MB-com0_115200-20181126_0323.fs
1.9G resflash-amd64-1906MB-com0_115200-20181126_0323.img
Disk usage:
749M resflash-amd64-1906MB-com0_115200-20181019_1520.fs
752M resflash-amd64-1906MB-com0_115200-20181019_1520.img
749M resflash-amd64-1906MB-com0_115200-20181126_0323.fs
752M resflash-amd64-1906MB-com0_115200-20181126_0323.img
Same usage with `[-p pkg_dir]`:
# ./build_resflash.sh -s 115200 -p /usr/rpkg 1906 /usr/rdest
resflash 6.4.0
resflash 6.4.1
Validating OpenBSD base dir: /usr/rdest
Creating disk image: resflash-amd64-1906MB-com0_115200-20181019_1520.img
Creating filesystem: resflash-amd64-1906MB-com0_115200-20181019_1520.fs
Creating disk image: resflash-amd64-1906MB-com0_115200-20181126_0323.img
Creating filesystem: resflash-amd64-1906MB-com0_115200-20181126_0323.fs
Populating filesystem and configuring fstab
Running fw_update
Installing packages: /usr/rpkg
......@@ -104,22 +104,22 @@ Same usage with `[-p pkg_dir]`:
Build complete!
File sizes:
886M resflash-amd64-1906MB-com0_115200-20181019_1520.fs
1.9G resflash-amd64-1906MB-com0_115200-20181019_1520.img
886M resflash-amd64-1906MB-com0_115200-20181126_0323.fs
1.9G resflash-amd64-1906MB-com0_115200-20181126_0323.img
Disk usage:
749M resflash-amd64-1906MB-com0_115200-20181019_1520.fs
752M resflash-amd64-1906MB-com0_115200-20181019_1520.img
749M resflash-amd64-1906MB-com0_115200-20181126_0323.fs
752M resflash-amd64-1906MB-com0_115200-20181126_0323.img
## Upgrades
Unlike the initial installation, upgrades use .fs filesystem files. Upgrades take place by piping the .fs file through the /resflash/upgrade.sh script. This can be accomplished in many ways:
- The more secure, doas-enabled ssh way:
1. On the build system, connect to the system to be upgraded: `ssh -C root@10.0.x.y 'doas /resflash/upgrade.sh' < resflash-amd64-1906MB-com0_115200-20181019_1520.fs`
1. On the build system, connect to the system to be upgraded: `ssh -C root@10.0.x.y 'doas /resflash/upgrade.sh' < resflash-amd64-1906MB-com0_115200-20181126_0323.fs`
2. Review the output, confirm the filesystem checksum, and reboot.
- The less secure, trusted LAN-only way:
1. On the system to be upgraded, run as **root**: `nc -v -l 1234|gzip -d|/resflash/upgrade.sh`
2. On the build system, run: `gzip -5c resflash-amd64-1906MB-com0_115200-20181019_1520.fs|nc -Nv 10.0.x.y 1234`
2. On the build system, run: `gzip -5c resflash-amd64-1906MB-com0_115200-20181126_0323.fs|nc -Nv 10.0.x.y 1234`
3. Review the output, confirm the filesystem checksum, and reboot.
Sample output:
......
......@@ -13,7 +13,7 @@ BINDIR=$(dirname ${0})
. ${BINDIR}/resflash.sub
. ${BINDIR}/build_resflash.sub
VERSION=6.4.0
VERSION=6.4.1
BYTESECT=512
if [ ${#} -eq 0 ]; then
......
......@@ -17,4 +17,4 @@ if [ ${#} -ne 1 ]; then
fi
mount_img_or_fs ${1}
echo ${MNTPATH}
......@@ -54,8 +54,6 @@ mount_img_or_fs() {
esac
mount -t mfs -o async,noatime,nodev,noexec,-s256M swap ${MNTPATH}/fs/tmp
${ESCECHO} "Mounted:\n$(df -h|fgrep ${MNTPATH})"
}
# Args: 1 - MACHINE
......
......@@ -14,4 +14,3 @@ fi
umount_all
rm -r /tmp/resflash.??????
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment