changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: provide /n and /mnt early in bootrc to allow consistent use in /lib/namespace

changeset 5091: f0545a5cf223
parent 5090: 38542f18992f
child 5092: 6f3169667f70
author: cinap_lenrek@felloff.net
date: Sun, 14 Feb 2016 01:42:32 +0100
files: lib/namespace rc/bin/cpurc rc/bin/termrc sys/src/9/boot/bootfs.proto sys/src/9/boot/bootrc sys/src/9/port/devroot.c
description: provide /n and /mnt early in bootrc to allow consistent use in /lib/namespace

theres a bootstrap problem:

when /bin/init is run, it processes /lib/namespace where we might want to
mount or bind resources to /n or /mnt. but mntgen was run later in
cpurc/termrc so these mounts would be ignored.

we already have mntgen in bootfs, so we can provide these mountpoints early.

i keep the termrc/cpurc mntgens where they are, but ignore the error
prints. this way old kernels will continue to work.
     1.1--- a/lib/namespace
     1.2+++ b/lib/namespace
     1.3@@ -31,8 +31,8 @@ mount -a /srv/cs /net
     1.4 mount -a /srv/dns /net
     1.5 mount -a /srv/net /net
     1.6 
     1.7-mount -qC /srv/boot /n/other other
     1.8-bind -qc /n/other/usr/$user/tmp /usr/$user/tmp
     1.9+mount -C /srv/boot /n/other other
    1.10+bind -c /n/other/usr/$user/tmp /usr/$user/tmp
    1.11 
    1.12 bind -c /usr/$user/tmp /tmp
    1.13 cd /usr/$user
     2.1--- a/rc/bin/cpurc
     2.2+++ b/rc/bin/cpurc
     2.3@@ -8,10 +8,11 @@ for(i in m i P S t u '$')
     2.4 
     2.5 mount -qb /srv/cons /dev
     2.6 
     2.7-# mount points
     2.8-mntgen -s slashn && chmod 666 /srv/slashn
     2.9+# mount points (if not done by bootrc already)
    2.10+>[2]/dev/null {
    2.11+mntgen -s slashn /n && chmod 666 /srv/slashn
    2.12 mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
    2.13-mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
    2.14+mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport}
    2.15 
    2.16 # move factotum from /mnt to /mnt/factotum
    2.17 mount /srv/factotum /mnt/temp
     3.1--- a/rc/bin/termrc
     3.2+++ b/rc/bin/termrc
     3.3@@ -9,10 +9,11 @@ rm -f /env/i
     3.4 
     3.5 mount -qb /srv/cons /dev
     3.6 
     3.7-# mount points 
     3.8-mntgen -s slashn && chmod 666 /srv/slashn
     3.9+# mount points (if not done by bootrc already)
    3.10+>[2]/dev/null {
    3.11+mntgen -s slashn /n && chmod 666 /srv/slashn
    3.12 mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
    3.13-mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
    3.14+mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport}
    3.15 
    3.16 # move factotum from /mnt to /mnt/factotum
    3.17 mount /srv/factotum /mnt/temp
     4.1--- a/sys/src/9/boot/bootfs.proto
     4.2+++ b/sys/src/9/boot/bootfs.proto
     4.3@@ -10,6 +10,7 @@
     4.4 		bind
     4.5 		cat
     4.6 		cfs
     4.7+		chmod
     4.8 		cryptsetup
     4.9 		dd
    4.10 		disk
     5.1--- a/sys/src/9/boot/bootrc
     5.2+++ b/sys/src/9/boot/bootrc
     5.3@@ -1,6 +1,10 @@
     5.4 #!/bin/rc
     5.5 
     5.6-mntgen -s slash /mnt
     5.7+# mount points
     5.8+mntgen -s slashn /n && chmod 666 /srv/slashn
     5.9+mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
    5.10+mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
    5.11+
    5.12 bind /root /mnt/broot
    5.13 unmount /root
    5.14 
    5.15@@ -229,5 +233,5 @@ while(){
    5.16 
    5.17 	# cleanup so it can be restarted
    5.18 	nobootprompt=()
    5.19-	rm -f /srv/^(cfs boot slashn cs dns)
    5.20+	rm -f /srv/^(cfs boot cs dns)
    5.21 } </dev/cons
     6.1--- a/sys/src/9/port/devroot.c
     6.2+++ b/sys/src/9/port/devroot.c
     6.3@@ -101,6 +101,7 @@ rootreset(void)
     6.4 	addrootdir("env");
     6.5 	addrootdir("fd");
     6.6 	addrootdir("mnt");
     6.7+	addrootdir("n");
     6.8 	addrootdir("net");
     6.9 	addrootdir("net.alt");
    6.10 	addrootdir("proc");