rc.d: Add mounttmpfs to support tmpfs at /var/run and /tmp
[dragonfly.git] / etc / rc.d / mounttmpfs
1 #!/bin/sh
2
3 # PROVIDE: mounttmpfs
4 # REQUIRE: mountcritremote
5
6 . /etc/rc.subr
7
8 name="mounttmpfs"
9 start_cmd="mounttmpfs_start"
10 stop_cmd=":"
11
12 mounttmpfs_start()
13 {
14         if checkyesno tmpfs_var_run; then
15                 echo -n "Mounting tmpfs at /var/run"
16                 mount_tmpfs dummy /var/run
17                 echo "."
18
19                 echo "Recreating filesystem hierarchy in /var/run:"
20                 mtree -deiqU -f /etc/mtree/BSD.var.dist -p /var
21                 echo "."
22         else
23                 echo -n "Mounting tmpfs at /var/run/shm"
24                 mount_tmpfs -m 01777 dummy /var/run/shm
25                 mkdir -p -m 01777 /var/run/shm/tmp
26                 echo "."
27         fi
28
29         if checkyesno tmpfs_tmp; then
30                 echo -n "Mounting tmpfs at /tmp"
31                 mount_tmpfs -m 01777 dummy /tmp
32                 echo "."
33         fi
34 }
35
36 load_rc_config $name
37 run_rc_command "$1"