BTS

Message2839

Author suntong1
Recipients mika, suntong, suntong1
Date 2010-01-15.20:12:28
Content
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
History
Date User Action Args
2010-01-15 20:12:28suntong1setrecipients: + mika
2010-01-15 20:12:28suntong1linkissue650 messages
2010-01-15 20:12:28suntong1create