Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Gerardo Exequiel Pozzi <vmlinuz386-/E1597aS9LQMlKAeRRkD2Q <at> public.gmane.org>
Subject: [PATCH 1/5] [archiso] Rework omit pid logic for NBD
Newsgroups: gmane.linux.arch.releng
Date: Sunday 19th August 2012 03:57:16 UTC (over 4 years ago)
The only way to do this from systemd is via setting "@" in argv[0][0] [#1]

nbd-client does not support this at this moment, but doing via dirty hack:
just install nbd-client as @nbd-client in initramfs image ;)

PS: I will ask to nbd author, to support it via some switch.

[#1] http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons

Signed-off-by: Gerardo Exequiel Pozzi

---
 Makefile                        |  2 --
 archiso/archiso_pxe_nbd         |  6 ------
 archiso/archiso_shutdown        |  4 ++--
 archiso/hooks/archiso_pxe_nbd   | 10 +++-------
 archiso/install/archiso_pxe_nbd |  4 +---
 configs/releng/build.sh         |  1 -
 6 files changed, 6 insertions(+), 21 deletions(-)
 delete mode 100644 archiso/archiso_pxe_nbd

diff --git a/Makefile b/Makefile
index 309f890..cb5ec1d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,6 @@ install-hooks:
 	install -D -m 755 archiso/archiso_shutdown
$(DESTDIR)/usr/lib/initcpio/archiso_shutdown
 	install -D -m 644 archiso/hooks/archiso_shutdown
$(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown
 	install -D -m 644 archiso/install/archiso_shutdown
$(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown
-	install -D -m 644 archiso/archiso_pxe_nbd
$(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd
 	install -D -m 644 archiso/hooks/archiso_pxe_common
$(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common
 	install -D -m 644 archiso/install/archiso_pxe_common
$(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common
 	install -D -m 644 archiso/hooks/archiso_pxe_nbd
$(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd
@@ -42,7 +41,6 @@ uninstall:
 	rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown
 	rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown
 	rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown
-	rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd
 	rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common
 	rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common
 	rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd
diff --git a/archiso/archiso_pxe_nbd b/archiso/archiso_pxe_nbd
deleted file mode 100644
index e6b9872..0000000
--- a/archiso/archiso_pxe_nbd
+++ /dev/null
@@ -1,6 +0,0 @@
-omit_kill_nbd_client() {
-    add_omit_pids $(< /run/archiso/nbd_client.pid)
-}
-
-add_hook shutdown_prekillall omit_kill_nbd_client
-add_hook single_prekillall omit_kill_nbd_client
diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown
index 85cce59..b252c16 100644
--- a/archiso/archiso_shutdown
+++ b/archiso/archiso_shutdown
@@ -27,8 +27,8 @@ if [[ ! -d /oldrun/archiso/copytoram ]]; then
     else
         umount /oldrun/archiso/bootmnt
     fi
-    if [[ -f /oldrun/archiso/nbd_client.pid ]]; then
-        nbd-client -d /dev/nbd0
+    if @nbd-client -c /dev/nbd0; then
+        @nbd-client -d /dev/nbd0
     fi
 fi
 
diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd
index 6147d06..6c81459 100644
--- a/archiso/hooks/archiso_pxe_nbd
+++ b/archiso/hooks/archiso_pxe_nbd
@@ -25,9 +25,9 @@ archiso_pxe_nbd_mount_handler () {
 
     msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0"
     if [[ "${copytoram}" = "y" ]]; then
-        nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
+        @nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
     else
-        nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
-persist
+        @nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
-persist
     fi
 
     archisodevice=/dev/nbd0
@@ -36,10 +36,6 @@ archiso_pxe_nbd_mount_handler () {
 
     if [[ "${copytoram}" = "y" ]]; then
         msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0"
-        nbd-client -d /dev/nbd0
-    else
-        mkdir -p /run/archiso
-        pidof nbd-client > /run/archiso/nbd_client.pid
-        cp /archiso_pxe_nbd ${newroot}/etc/rc.d/functions.d/
+        @nbd-client -d /dev/nbd0
     fi
 }
diff --git a/archiso/install/archiso_pxe_nbd
b/archiso/install/archiso_pxe_nbd
index 8d9552a..55adba4 100644
--- a/archiso/install/archiso_pxe_nbd
+++ b/archiso/install/archiso_pxe_nbd
@@ -5,9 +5,7 @@ build() {
 
     add_runscript
 
-    add_binary nbd-client
-
-    add_file /usr/lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd
+    add_binary nbd-client [email protected]
 }
 
 help() {
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 795f217..7aad14e 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -43,7 +43,6 @@ make_setup_mkinitcpio() {
         done
         cp /usr/lib/initcpio/install/archiso_kms
${work_dir}/root-image/usr/lib/initcpio/install
         cp /usr/lib/initcpio/archiso_shutdown
${work_dir}/root-image/usr/lib/initcpio
-        cp /usr/lib/initcpio/archiso_pxe_nbd
${work_dir}/root-image/usr/lib/initcpio
         cp ${script_path}/mkinitcpio.conf
${work_dir}/root-image/etc/mkinitcpio-archiso.conf
         : > ${work_dir}/build.${FUNCNAME}
    fi
-- 
1.7.11.5
 
CD: 3ms