Skip to content

Instantly share code, notes, and snippets.

@jwatzman

jwatzman/dd.sh Secret

Created June 2, 2022 21:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwatzman/8a53dcdd3084d595c6d5918f4a2a0527 to your computer and use it in GitHub Desktop.
Save jwatzman/8a53dcdd3084d595c6d5918f4a2a0527 to your computer and use it in GitHub Desktop.
zpi
#!/bin/sh
set -e
set -x
dd if=FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img of=/dev/da1 bs=4M iflag=direct oflag=direct status=progress
gpart resize -i 2 da1
gpart resize -i 1 da1s2
#!/bin/sh
if [ ! -f /mnt/COPYRIGHT ]
then
echo "Forgot to mount disk image"
exit 1
fi
set -e
set -x
zpool destroy zpi || true
zpool create -O compress=lz4 -O atime=off -o altroot=/zpialt -m none zpi da1s2
zfs create -o mountpoint=none zpi/ROOT
zfs create -o mountpoint=/ zpi/ROOT/default
zfs create -o mountpoint=/tmp -o exec=on -o setuid=off zpi/tmp
zfs create -o mountpoint=/usr -o canmount=off zpi/usr
zfs create zpi/usr/home
zfs create -o setuid=off zpi/usr/ports
zfs create zpi/usr/src
zfs create -o mountpoint=/var -o canmount=off zpi/var
zfs create -o exec=off -o setuid=off zpi/var/audit
zfs create -o exec=off -o setuid=off zpi/var/crash
zfs create -o exec=off -o setuid=off zpi/var/log
zfs create -o atime=on zpi/var/mail
zfs create -o setuid=off zpi/var/tmp
zfs set mountpoint=/zpi zpi
chmod 1777 /zpialt/tmp
chmod 1777 /zpialt/var/tmp
zpool set bootfs=zpi/ROOT/default zpi
zfs set canmount=noauto zpi/ROOT/default
cd /mnt
tar cf - . | ( cd /zpialt && tar xvf - )
echo 'zfs_load="YES"' >> /zpialt/boot/loader.conf
echo 'kern.geom.label.disk_ident.enable=0' >> /zpialt/boot/loader.conf
#echo 'kern.geom.label.gptid.enable=0' >> /zpialt/boot/loader.conf
sed -i '' '/boot_serial/ s/^/#/' /zpialt/boot/loader.conf
sed -i '' '/beastie_disable/ s/^/#/' /zpialt/boot/loader.conf
echo 'zfs_enable="YES"' >> /zpialt/etc/rc.conf
sed -i '' /ufs/d /zpialt/etc/fstab
zpool export zpi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment