[issue650] add live-module - insert/remove live modules into root aufs

Tong Sun bts at bts.grml.org
Fri Jan 15 21:12:28 CET 2010


Tong Sun <suntong at cpan.org> added the comment:

revision 1.1
- first draft
---
 bin/live-module |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100755 bin/live-module

diff --git a/bin/live-module b/bin/live-module
new file mode 100755
index 0000000..4d5ace0
--- /dev/null
+++ b/bin/live-module
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. /usr/share/initramfs-tools/scripts/live
+
+mount_image ()
+{
+  image="${1}"
+
+  if losetup --help 2>&1 | grep -q -- "-r\b"
+    then
+    backdev=$(get_backing_device "${image}" "-r")
+  else
+    backdev=$(get_backing_device "${image}")
+  fi
+  fstype=$(get_fstype "${backdev}")
+
+  if [ "${fstype}" = "unknown" ]
+    then
+    panic "Unknown file system type on ${backdev} (${image})"
+  fi
+
+  mkdir -p "${croot}/${imagename}"
+  log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
+  mount -n -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
+  log_end_msg
+}
+
+mount_image "$1"
-- 
1.5.6.5

----------
assignedto: mika
messages: 2035, 2036, 2045, 2046, 2047, 2048, 2049, 2398, 2839
nosy: mika, suntong
priority: feature
status: need-eg
title: add live-module - insert/remove live modules into root aufs

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue650>
_____________________________________


More information about the Bugs-changes mailing list