Handle systems with new /run tmpfs

Modern systems today use a RAM disk for /run and /run/lock, with
symlinks to the FHS locations in /var/run and /var/lock.  See the
following link for details http://lwn.net/Articles/436012/

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-07-20 17:30:29 +02:00
parent a67350ebf6
commit aced97c2e6
3 changed files with 46 additions and 11 deletions
+10 -2
View File
@@ -44,12 +44,20 @@ static void setup(void *UNUSED(arg))
makedir("/var/lib/misc", 0755);
makedir("/var/lib/alarm", 0755);
makedir("/var/lib/urandom",0755);
makedir("/var/lock", 0755);
if (fisdir("/run")) {
_d("System with new /run tmpfs ...");
makedir("/run/lock", 1777);
symlink("/run/lock", "/var/lock");
symlink("/run", "/var/run");
symlink("/dev/shm", "/run/shm");
} else {
makedir("/var/lock", 1777);
makedir("/var/run", 0755);
}
makedir("/var/lock/subsys",0755); /* Needed by D-Bus plugin */
makedir("/var/log", 0755);
makedir("/var/mail", 0755);
makedir("/var/opt", 0755);
makedir("/var/run", 0755);
makedir("/var/spool", 0755);
makedir("/var/spool/cron", 0755);
makedir("/var/tmp", 0755);