initial commit
This commit is contained in:
commit
3053f89410
39 changed files with 4567 additions and 0 deletions
63
scripts/install_openbsd.sh
Normal file
63
scripts/install_openbsd.sh
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
groupadd _cachefs
|
||||
useradd -d /var/empty -g _cachefs _cachefs
|
||||
|
||||
cat <<"EOF">/etc/rc.d/cachefs
|
||||
#!/bin/sh
|
||||
|
||||
daemon="/usr/local/sbin/cachefs"
|
||||
daemon_flags="-src /mnt/nfs -dst /mnt/cache -data /mnt/cache/md.json -listen :9090 -v 2"
|
||||
daemon_logger="daemon.info"
|
||||
daemon_user="_cachefs"
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
pexp="${daemon}.*"
|
||||
rc_bg=YES
|
||||
rc_reload=NO
|
||||
|
||||
rc_pre() {
|
||||
if ! mount | grep -q /mnt/cache; then
|
||||
bioctl -c C -p /root/sd1_key -l sd1a softraid0 && { sleep 1; fsck /dev/sd2a && mount /mnt/cache; }
|
||||
fi
|
||||
}
|
||||
|
||||
rc_cmd $1
|
||||
EOF
|
||||
chmod 555 /etc/rc.d/cachefs
|
||||
|
||||
mkdir -p /mnt/cache
|
||||
|
||||
fdisk -iy sd1
|
||||
|
||||
disklabel -E sd1 <<EOF
|
||||
a a
|
||||
|
||||
|
||||
RAID
|
||||
w
|
||||
q
|
||||
EOF
|
||||
dd if=/dev/urandom bs=1 count=256 2>/dev/null|sha256 >/root/sd1_key
|
||||
chmod 600 /root/sd1_key
|
||||
bioctl -c C -p /root/sd1_key -l sd1a softraid0
|
||||
|
||||
fdisk -iy sd2
|
||||
disklabel -E sd2 <<EOF
|
||||
a a
|
||||
|
||||
|
||||
|
||||
w
|
||||
q
|
||||
EOF
|
||||
newfs sd2a
|
||||
|
||||
echo "/dev/sd2a /mnt/cache ffs rw,nodev,nosuid,softdep,noauto 1 0" >>/etc/fstab
|
||||
echo "sync; umount /mnt/cache && bioctl -d sd2" >>/etc/rc.shutdown
|
||||
chmod 700 /etc/rc.shutdown
|
||||
|
||||
mount /mnt/cache
|
||||
chown _cachefs:_cachefs /mnt/cache
|
||||
|
||||
rcctl enable cachefs
|
||||
rcctl start cachefs
|
||||
Loading…
Add table
Add a link
Reference in a new issue