summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-04-07 19:23:17 +0100
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-04-08 12:30:32 +0100
commit9603cfee926e5b010a16463ff765a655382585e8 (patch)
treef5ba8cdc99d28664199757763f4aa289d04358e2
parent88e05d0f4291fc09e89a510c433fbf20ee6f1ae3 (diff)
downloaddefinitions-9603cfee926e5b010a16463ff765a655382585e8.tar.gz
Create kmod symlinks in sbin
iSCSI kernel modules and open-iscsi expect modprobe and the rest of the module kernel utils to be in /sbin. This patch create the links in /sbin instead of /bin if /sbin is not a symlink of /usr/bin; if it is a symlink it will create the links in /usr/bin. Also it installs kmod in "$PREFIX" instead of / Change-Id: I89226d0ee7956e294caa66d60101a35daeccf9a1
-rw-r--r--strata/foundation/kmod.morph48
1 files changed, 39 insertions, 9 deletions
diff --git a/strata/foundation/kmod.morph b/strata/foundation/kmod.morph
index fdfb971f..8f158e8e 100644
--- a/strata/foundation/kmod.morph
+++ b/strata/foundation/kmod.morph
@@ -5,15 +5,45 @@ configure-commands:
- sed -i -e'/SUBDIRS/{s/\S*doc\S*//;s/\S*man\S*//}' Makefile.am
- sed -i -e'/AC_CONFIG_FILES(\[/,/])/{/docs/d}' configure.ac
- autoreconf -fiv
-- ./configure --prefix=/usr --bindir=/bin --libdir=/lib --sysconfdir=/etc --without-xz
- --with-zlib --disable-manpages --enable-python
+- |
+ ./configure --prefix="$PREFIX" --bindir="$PREFIX"/bin \
+ --libdir="$PREFIX"/lib --sysconfdir=/etc \
+ --without-xz --with-zlib \
+ --disable-manpages --enable-python
build-commands:
- make
install-commands:
-- make DESTDIR="$DESTDIR" pkgconfigdir=/usr/lib/pkgconfig install
-- ln -s kmod "$DESTDIR"/bin/modprobe
-- ln -s kmod "$DESTDIR"/bin/lsmod
-- ln -s kmod "$DESTDIR"/bin/rmmod
-- ln -s kmod "$DESTDIR"/bin/insmod
-- ln -s kmod "$DESTDIR"/bin/modinfo
-- ln -s kmod "$DESTDIR"/bin/depmod
+- make DESTDIR="$DESTDIR" pkgconfigdir="$PREFIX"/lib/pkgconfig install
+
+# WARNING with the following command:
+# if the staging area when kmod is built is sufficiently different to the
+# staging area that kmod is included in, then these symlinks may not work.
+#
+# i.e. if /sbin isn't a symlink when this is built (fhs-dirs isn't included or
+# doesn't symlink /sbin to /usr/bin) then we get symlinks in /sbin which point
+# to ../usr/bin, but if /sbin is itself a symlink to /usr/bin, then the symlinks
+# would end up in /usr/bin, which would point to ../usr/bin, which would evaluate
+# to /usr/usr/bin.
+#
+# The alternatives to this are:
+#
+# 1. Use hardlinks instead, which has the problem of ssh-rsync upgrades duplicating
+# the binary
+#
+# 2. Use an absolute path for the symlink, which makes things interesting when
+# inspecting a chroot
+#
+# 3. Use a wrapper script to invoke kmod with a different name, which isn't
+# possible in busybox ash without making a temporary directory, which means
+# you need an extra process to hang around to clean that directory up.
+- |
+ if [ -h /sbin ]; then
+ for app in modprobe lsmod rmmod insmod modinfo depmod; do
+ ln -sf kmod "$DESTDIR$PREFIX/bin/$app"
+ done
+ else
+ install -d "$DESTDIR"/sbin
+ for app in modprobe lsmod rmmod insmod modinfo depmod; do
+ ln -sf ../"$PREFIX"/bin/kmod "$DESTDIR/sbin/$app"
+ done
+ fi