# $NetBSD: usermode.conf,v 1.6.2.1 2023/10/02 13:26:04 martin Exp $ # NetBSD/usermode customization script used by mkimage # XXX: BROKEN, needs to be converted to makefs custom=custom image=usermode.img overhead=8 # in MB sets="base etc modules" setsdir=/usr/build/release/$(uname -m)/binary/sets size=0 # in MB usermodedirs="/var.cow /etc.cow /root.cow /pkgs" make_fstab() { cat > ${mnt}/etc/fstab << EOF # NetBSD/usermode /etc/fstab /dev/ld0a / ffs ro 1 1 /dev/ld1a /pkgs ffs ro 1 2 ptyfs /dev/pts ptyfs rw procfs /proc procfs rw # mount /root as tmpfs on top of existing dir tmpfs /root.cow tmpfs rw,-s2M 0 0 /root.cow /root union rw,hidden 0 0 # mount /etc as tmpfs on top of existing dir tmpfs /etc.cow tmpfs rw,-s12M 0 0 /etc.cow /etc union rw,hidden 0 0 # mount /var as tmpfs on top of existing dir tmpfs /var.cow tmpfs rw,-s32M 0 0 /var.cow /var union rw,hidden - - tmpfs /tmp tmpfs rw,-s32M 0 0 /dev/cd0a /cdrom cd9660 ro,noauto EOF } customize() { cat >> ${mnt}/etc/rc.conf << EOF # make sure we have the right rw filesystem at boot critical_filesystems_local="/var.cow /var /etc.cow /etc /root.cow /root" # Add local overrides below # dhcpcd=YES sshd=YES certctl_init=YES EOF echo "${bar} making extra directories ${bar}" for d in ${usermodedirs}; do mkdir -p ${mnt}/${d} done echo "${bar} customising /var/tmp ${bar}" rm -rf ${mnt}/var/tmp (cd ${mnt}/var && ln -s /tmp tmp) # package-related stuff (cat ${mnt}/etc/csh.cshrc;echo "setenv PKG_DBDIR /usr/pkg/.dbdir") > ${tmp} mv ${tmp} ${mnt}/etc/csh.cshrc (cat ${mnt}/etc/profile;echo "export PKG_DBDIR=/usr/pkg/.dbdir") > ${tmp} mv ${tmp} ${mnt}/etc/profile (echo "PKG_DBDIR=/usr/pkg/.dbdir") > ${tmp} mv ${tmp} ${mnt}/etc/mk.conf (cd ${mnt}/usr && ln -s /pkgs/usr/pkg pkg) # last, customisation stage if [ -d ${custom} ]; then echo "${bar} user customisations from files in ${custom} ${bar}" (cd ${custom} && pax -rwpe . ${mnt}) fi df ${mnt} } cleanup() { }