summaryrefslogtreecommitdiff
path: root/distrib/common/zfsroot.rc
blob: 03183464e75f99d034a7eb03098f893aaa746165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#/bin/sh
#
#	$NetBSD: zfsroot.rc,v 1.5 2020/04/14 12:14:59 roy Exp $

# Assumption - boot.cfg loads this ramdisk.
# Assumption - The needed kernel modules: solaris and zfs; are either on this
#              ramdisk OR loaded by boot.cfg.
#              Finding the correct dev node to mount to get them is too magic.
#              NetBSD cannot build and distribute a kernel with ZFS builtin.
# Assumption - the root pool is set to legacy mount.

# Configurable - define the ZFS root pool and ROOT.
# XXX Can these be set in boot.cfg?
rpool=rpool
rroot=ROOT

# Setup some stuff incase things go south and we drop to the shell
export HOME=/
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022

echo "Importing $rpool"
/sbin/zpool import -f -N "$rpool"

echo "Mounting $rpool/$rroot to /altroot"
/sbin/mount -t zfs "$rpool/$rroot" /altroot;

/sbin/sysctl -w init.root=/altroot