mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From f30de70c1cb828a4fe20d46946bf8779a7707dc3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 26 Sep 2013 10:47:17 +0100
Subject: [PATCH] appliance: Create /dev/loop-control and similar devices.

When 'mount -o loop' and similar commands are used, the loop module is
loaded automatically by the kernel when /dev/loop-control is accessed.

/dev/loop-control is created semi-statically by an unholy and
overcomplex combination of kmod static-nodes and systemd-tmpfiles
(instead of using, say, just udev or even just a simple series of
mknod commands).

(cherry picked from commit e2895b19bb2be67c01172cdd0634553c21923605)
---
 appliance/init | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/appliance/init b/appliance/init
index 79083a4..bd383c3 100755
--- a/appliance/init
+++ b/appliance/init
@@ -83,6 +83,13 @@ if grep -sq selinux=1 /proc/cmdline; then
   mount -t selinuxfs none /sys/fs/selinux
 fi
 
+# Set up kmod static-nodes (RHBZ#1011907).
+mkdir -p /run/tmpfiles.d
+kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
+
+# Set up tmpfiles (must run after kmod.conf is created above).
+systemd-tmpfiles --prefix=/dev --create
+
 # Disk optimizations.
 # Increase the SCSI timeout so we can read remote images.
 for f in /sys/block/sd*/device/timeout; do echo 300 > $f; done
-- 
1.8.3.1