rc.d: Add mounttmpfs to support tmpfs at /var/run and /tmp
authorAaron LI <aly@aaronly.me>
Wed, 29 Apr 2020 04:47:23 +0000 (12:47 +0800)
committerAaron LI <aly@aaronly.me>
Wed, 29 Apr 2020 13:27:07 +0000 (21:27 +0800)
commit80d125ead8e978ee0bbb457e6ca8c13577a15660
tree956b881c0afba3120ca9c4f0176b46cc702cac33
parent7e7735b8f4f5b670d6a348144fcce2ed18f7b3b4
rc.d: Add mounttmpfs to support tmpfs at /var/run and /tmp

We are already mounting a tmpfs at /var/run/shm to support shm_open()
etc functions.  However, this makes it harder for a user to make
/var/run on a tmpfs.  Actually, using a tmpfs for /var/run is a good
idea, though the deamons/system need to create necessary folders, and
Linux has adopted such a model for /run (symlink to /var/run) for years.

Introduce the 'mounttmpfs' rc script to support mounting tmpfs at
/var/run and /tmp, which is enabled by setting 'tmpfs_var_run=YES'
and 'tmpfs_tmp=YES' in /etc/rc.conf, respectively.  The default values
for these two new configurations are both 'NO'.

The new 'mounttmpfs' rc script is ordered *after* 'mountcritremote', so
that NFS-mounted /var is also properly handled, although I think
NFS-mounted /var is not a good idea and I don't know anyone really need
to do so.

Also move the tmpfs mounting at /var/run/shm from 'mountcritlocal' to
the new 'mounttmpfs' script.

Reviewed-by: tuxillo
etc/defaults/rc.conf
etc/rc.d/Makefile
etc/rc.d/SERVERS
etc/rc.d/mountcritlocal
etc/rc.d/mounttmpfs [new file with mode: 0644]
share/man/man5/rc.conf.5