system: separate sysv and systemd parts of the skeleton
authorYann E. MORIN <yann.morin.1998@free.fr>
Tue, 1 Aug 2017 22:52:21 +0000 (00:52 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 2 Aug 2017 18:04:29 +0000 (20:04 +0200)
For systemd, we create a simple /etc/fstab with only an entry for /, as
systemd otherwise automatically mounts what it needs where it needs it.

systemd does not like that the content of /var be symlinks to /tmp,
especially journald that starts before /tmp is mounted, and thus the
journal files are hidden from view, which causes quite a bit of fuss...

Instead, move the current /var to a sysv-only skeleton.

systemd at install time will create the /var content it needs, so we
just create an empty /var for systemd.

systemd would create /home and /srv at runtime if they are missing, but
it is better to create them right now, to simplify supporting systemd on
a RO filesystem in the (near) future.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
25 files changed:
package/skeleton-systemd/skeleton-systemd.mk
package/skeleton-sysv/skeleton-sysv.mk
package/skeleton-sysv/skeleton/dev/log [new symlink]
package/skeleton-sysv/skeleton/dev/pts/.empty [new file with mode: 0644]
package/skeleton-sysv/skeleton/dev/shm/.empty [new file with mode: 0644]
package/skeleton-sysv/skeleton/etc/fstab [new file with mode: 0644]
package/skeleton-sysv/skeleton/var/cache [new symlink]
package/skeleton-sysv/skeleton/var/lib/misc [new symlink]
package/skeleton-sysv/skeleton/var/lock [new symlink]
package/skeleton-sysv/skeleton/var/log [new symlink]
package/skeleton-sysv/skeleton/var/run [new symlink]
package/skeleton-sysv/skeleton/var/spool [new symlink]
package/skeleton-sysv/skeleton/var/tmp [new symlink]
system/skeleton/dev/.empty [new file with mode: 0644]
system/skeleton/dev/log [deleted symlink]
system/skeleton/dev/pts/.empty [deleted file]
system/skeleton/dev/shm/.empty [deleted file]
system/skeleton/etc/fstab [deleted file]
system/skeleton/var/cache [deleted symlink]
system/skeleton/var/lib/misc [deleted symlink]
system/skeleton/var/lock [deleted symlink]
system/skeleton/var/log [deleted symlink]
system/skeleton/var/run [deleted symlink]
system/skeleton/var/spool [deleted symlink]
system/skeleton/var/tmp [deleted symlink]

index cec63590071d8d2ebde7be49e4bfffdeae8fdddf..384715e1c961e5322830f3d242e7fd87c71009a4 100644 (file)
@@ -15,4 +15,11 @@ SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common
 
 SKELETON_SYSTEMD_PROVIDES = skeleton
 
+define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS
+       mkdir -p $(TARGET_DIR)/home
+       mkdir -p $(TARGET_DIR)/srv
+       mkdir -p $(TARGET_DIR)/var
+       echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab
+endef
+
 $(eval $(generic-package))
index b0c2b6bac1713950d720cc2a8d3f5ed6c73f73a8..b5fa396ac2e52b0b12f45c50d62100bbd0923408 100644 (file)
@@ -15,4 +15,8 @@ SKELETON_SYSV_DEPENDENCIES = skeleton-common
 
 SKELETON_SYSV_PROVIDES = skeleton
 
+define SKELETON_SYSV_INSTALL_TARGET_CMDS
+       $(call SYSTEM_RSYNC,$(SKELETON_SYSV_PKGDIR)/skeleton,$(TARGET_DIR))
+endef
+
 $(eval $(generic-package))
diff --git a/package/skeleton-sysv/skeleton/dev/log b/package/skeleton-sysv/skeleton/dev/log
new file mode 120000 (symlink)
index 0000000..d96b3b1
--- /dev/null
@@ -0,0 +1 @@
+../tmp/log
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/dev/pts/.empty b/package/skeleton-sysv/skeleton/dev/pts/.empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/package/skeleton-sysv/skeleton/dev/shm/.empty b/package/skeleton-sysv/skeleton/dev/shm/.empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/package/skeleton-sysv/skeleton/etc/fstab b/package/skeleton-sysv/skeleton/etc/fstab
new file mode 100644 (file)
index 0000000..169054b
--- /dev/null
@@ -0,0 +1,8 @@
+# <file system>        <mount pt>      <type>  <options>       <dump>  <pass>
+/dev/root      /               ext2    rw,noauto       0       1
+proc           /proc           proc    defaults        0       0
+devpts         /dev/pts        devpts  defaults,gid=5,mode=620,ptmxmode=0666   0       0
+tmpfs          /dev/shm        tmpfs   mode=0777       0       0
+tmpfs          /tmp            tmpfs   mode=1777       0       0
+tmpfs          /run            tmpfs   mode=0755,nosuid,nodev  0       0
+sysfs          /sys            sysfs   defaults        0       0
diff --git a/package/skeleton-sysv/skeleton/var/cache b/package/skeleton-sysv/skeleton/var/cache
new file mode 120000 (symlink)
index 0000000..1431b0e
--- /dev/null
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/lib/misc b/package/skeleton-sysv/skeleton/var/lib/misc
new file mode 120000 (symlink)
index 0000000..f1fde8c
--- /dev/null
@@ -0,0 +1 @@
+../../tmp
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/lock b/package/skeleton-sysv/skeleton/var/lock
new file mode 120000 (symlink)
index 0000000..1431b0e
--- /dev/null
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/log b/package/skeleton-sysv/skeleton/var/log
new file mode 120000 (symlink)
index 0000000..1431b0e
--- /dev/null
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/run b/package/skeleton-sysv/skeleton/var/run
new file mode 120000 (symlink)
index 0000000..84ba55b
--- /dev/null
@@ -0,0 +1 @@
+../run
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/spool b/package/skeleton-sysv/skeleton/var/spool
new file mode 120000 (symlink)
index 0000000..1431b0e
--- /dev/null
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-sysv/skeleton/var/tmp b/package/skeleton-sysv/skeleton/var/tmp
new file mode 120000 (symlink)
index 0000000..1431b0e
--- /dev/null
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/system/skeleton/dev/.empty b/system/skeleton/dev/.empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/system/skeleton/dev/log b/system/skeleton/dev/log
deleted file mode 120000 (symlink)
index d96b3b1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp/log
\ No newline at end of file
diff --git a/system/skeleton/dev/pts/.empty b/system/skeleton/dev/pts/.empty
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/system/skeleton/dev/shm/.empty b/system/skeleton/dev/shm/.empty
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/system/skeleton/etc/fstab b/system/skeleton/etc/fstab
deleted file mode 100644 (file)
index 169054b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# <file system>        <mount pt>      <type>  <options>       <dump>  <pass>
-/dev/root      /               ext2    rw,noauto       0       1
-proc           /proc           proc    defaults        0       0
-devpts         /dev/pts        devpts  defaults,gid=5,mode=620,ptmxmode=0666   0       0
-tmpfs          /dev/shm        tmpfs   mode=0777       0       0
-tmpfs          /tmp            tmpfs   mode=1777       0       0
-tmpfs          /run            tmpfs   mode=0755,nosuid,nodev  0       0
-sysfs          /sys            sysfs   defaults        0       0
diff --git a/system/skeleton/var/cache b/system/skeleton/var/cache
deleted file mode 120000 (symlink)
index 1431b0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp
\ No newline at end of file
diff --git a/system/skeleton/var/lib/misc b/system/skeleton/var/lib/misc
deleted file mode 120000 (symlink)
index f1fde8c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../tmp
\ No newline at end of file
diff --git a/system/skeleton/var/lock b/system/skeleton/var/lock
deleted file mode 120000 (symlink)
index 1431b0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp
\ No newline at end of file
diff --git a/system/skeleton/var/log b/system/skeleton/var/log
deleted file mode 120000 (symlink)
index 1431b0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp
\ No newline at end of file
diff --git a/system/skeleton/var/run b/system/skeleton/var/run
deleted file mode 120000 (symlink)
index 84ba55b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../run
\ No newline at end of file
diff --git a/system/skeleton/var/spool b/system/skeleton/var/spool
deleted file mode 120000 (symlink)
index 1431b0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp
\ No newline at end of file
diff --git a/system/skeleton/var/tmp b/system/skeleton/var/tmp
deleted file mode 120000 (symlink)
index 1431b0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../tmp
\ No newline at end of file