summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2018-07-25 17:03:06 +0800
committerBen Hutchings <ben@decadent.org.uk>2018-07-26 01:16:30 +0800
commit71f5d615a2c9f970375b129719b76471d60af97b (patch)
treea82d43c5e7680d82f6f04d5465504ab57388886f
parentea88876e87364edfa155d4c7ba37c7bd9686bea9 (diff)
mkinitramfs: Create usr-merged filesystem layout
On a usr-merged filesystem /bin, /lib*, /sbin are symlinks to the corresponding subdirectories of /usr. When the host filesystem looks like this, copy_file may be asked to copy both /lib/foo and /usr/lib/foo. It's too late at this point to make /lib a symlink in the initramfs, and copy_file isn't general enough to do that. Avoid this by setting up the initramfs as usr-merged. This could possibly cause file conflicts, but it's unlikely because: * Policy forbids such conflicts on the host filesystem * Few executables and libraries that go into the initramfs are explicitly installed in /usr on the host filesystem, because of historical support for having the init system mount /usr * mkinitramfs never used to create /usr/bin or /usr/lib Closes: #874523 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rwxr-xr-xmkinitramfs8
1 files changed, 7 insertions, 1 deletions
diff --git a/mkinitramfs b/mkinitramfs
index 58a9ff7..4394a3c 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -215,7 +215,13 @@ export __TMPCPIOGZ
# Private, used by 'prepend_earlyinitramfs'.
export __TMPEARLYCPIO
-for d in bin conf/conf.d etc lib/modules run sbin scripts ${MODULESDIR}; do
+# Create usr-merged filesystem layout, to avoid duplicates if the host
+# filesystem is usr-merged.
+for d in /bin /lib* /sbin; do
+ mkdir -p "${DESTDIR}/usr${d}"
+ ln -s "usr${d}" "${DESTDIR}${d}"
+done
+for d in conf/conf.d etc run scripts ${MODULESDIR}; do
mkdir -p "${DESTDIR}/${d}"
done