Created on 2009-03-11.04:11:19 by suntong, last changed 2011-11-07.14:11:46 by mika.
File name |
Uploaded |
Type |
Edit |
Remove |
live-module
|
suntong,
2010-02-28.23:52:05
|
application/octet-stream |
|
|
unnamed
|
suntong,
2010-02-28.23:52:05
|
text/html |
|
|
msg4049 (view) |
Author: mika |
Date: 2011-11-07.14:11:46 |
|
Hi,
thanks for sharing, sadly no one took any actions. :(
Unless someone is stepping up and checking out integration within nowadays' live-boot together with grml-live
I'm afraid this issue won't be resolved in the foreseeable future. :-/
Marking as dead therefore.
regards,
-mika-
|
msg3093 (view) |
Author: suntong |
Date: 2010-02-28.23:52:05 |
|
On Sat, Feb 27, 2010 at 6:16 PM, Michael Prokop <bts@bts.grml.org> wrote:
>
> Hi, any chance you could resend your work in a proper patch message that we
> can
> test/apply? Looking at http://bts.grml.org/grml/issue650 I sadly have no
> idea
> what needs to be applied and what's deprecated nowadays.
>
OK, I'll summit in as one file, as per Ulrich.
It's a standalone script and was working fine before, but I don't have any
time to test it now and in any near future -- I remember that I have to make
one (or two) symlinks of live-initramfs files to make it working before.
Again, Here is the current usage help:
live-module - insert/remove live modules into root aufs
Usage: live-module [options] module
Options:
-i, --ins insert the module into root aufs
-r, --rem remove the module from root aufs
-p, --plug plug-in the module (synonym for insert)
-u, --pull pull-out the module (synonym for remove)
-h, --help Print usage information and exit
cheers
|
msg3026 (view) |
Author: mika |
Date: 2010-02-27.23:16:39 |
|
Hi, any chance you could resend your work in a proper patch message that we can
test/apply? Looking at http://bts.grml.org/grml/issue650 I sadly have no idea
what needs to be applied and what's deprecated nowadays.
Thanks!
|
msg2847 (view) |
Author: suntong |
Date: 2010-01-15.20:16:30 |
|
sorry for responding late, mika.
|
msg2846 (view) |
Author: suntong1 |
Date: 2010-01-15.20:13:17 |
|
- add and utilize functions prog_info, prog_warning & prog_abort
- add support functions echoyellow & echored
---
bin/live-module | 75 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 53 insertions(+), 22 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index 7eb5501..f614d74 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -30,30 +30,61 @@ debug_log()
}
# echogreen will echo $@ in green color
-# $1 = text
-#
echogreen()
{
- echo -ne "[0;32m""$@""[0;39m"
+ echo -ne "\033[1;32m""$@""\033[0;39m"
}
-# echolog
-# $1 = text to show and to write to /var/log/messages
-#
-echolog()
+# echoyellow will echo $@ in yellow color
+echoyellow()
+{
+ echo -ne "\033[1;33m""$@""\033[0;39m"
+}
+
+# echored will echo $@ in red color
+echored()
+{
+ echo -ne "\033[1;31m""$@""\033[0;39m"
+}
+
+# prog_info
+# $@ = text to show and to write to /var/log/messages
+prog_info()
{
- if [ "$1" != "" ]; then
+ if [ ${1:+T} ]; then
echogreen "* "
log "LIVECD:" "$@"
echo "$@"
fi
}
+# prog_warning
+# $@ = text to show and to write to /var/log/messages
+prog_warning()
+{
+ if [ ${1:+T} ]; then
+ echoyellow "! "
+ log "LIVECD:" "$@"
+ echo "$@"
+ fi
+}
+
+# prog_abort
+# $@ = text to show and to write to /var/log/messages
+prog_abort()
+{
+ if [ ${1:+T} ]; then
+ echored "x "
+ log "LIVECD:" "$@"
+ echo "$@"
+ fi
+}
+
# test if the script is started by root user. If not, exit
allow_only_root()
{
if [ "0$UID" -ne 0 ]; then
- echo "Only root can run $(basename $0)"; exit 1
+ prog_abort "Only root can run $(basename $0)"; exit 1
fi
}
@@ -67,7 +98,7 @@ union_insert_dir()
{
debug_log "union_insert_dir $*"
mount -n -o remount,add:1:$2=rr aufs $1
- if [ $? -ne 0 ]; then echo "can't insert module to union" >&2; return 2; fi
+ if [ $? -ne 0 ]; then prog_abort "Can't insert module to union" >&2; return 2; fi
}
mount_image ()
@@ -84,18 +115,17 @@ mount_image ()
if [ "${fstype}" = "unknown" ]
then
- panic "Unknown file system type on ${backdev} (${image})"
+ prog_abort "Unknown file system type on ${backdev} (${image})"; exit 3
fi
mkdir -p "${croot}/${imagename}"
- log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
+ prog_info "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
union_insert_dir / "${croot}/${imagename}"
if [ $? -ne 0 ]; then
- echo "error inserting module to live filesystem" >&2; exit 3;
+ prog_abort "Error inserting module to live filesystem" >&2; exit 3;
fi
}
@@ -126,7 +156,7 @@ Options:
# -V, --version Show version information and exit
parameter_error() {
- echo "Try 'live-module --help' for more information."
+ prog_warning "Try 'live-module --help' for more information."
exit 1
}
@@ -204,7 +234,7 @@ while :; do
shift; break
;;
*)
- echo "Internal getopt error!" ; exit 1
+ prog_abort "Internal getopt error!" ; exit 1
;;
esac
shift
@@ -216,27 +246,27 @@ done
}
[ ${1:+T} ] || {
- echo "Missing the module file specification."
+ prog_warning "Missing the module file specification."
parameter_error
}
# ############################################################## &cs ###
# :::::::::::::::::::::::::::::::::::::::::::::::: Main script begin :::
-allow_only_root
-
# are we even using aufs union?
if [ "$(grep '^aufs / ' /proc/mounts)" = "" ]; then
- echo "not in the live mode, can't continue."
+ prog_abort "Not in the live mode, can't continue."
exit 4
fi
+allow_only_root
+
image="${1}"
imagename=$(basename "${image}")
croot=""
[ -e "$image" ] || {
- echo "The specified module file '$image' does not exist."
+ prog_abort "The specified module file '$image' does not exist."
exit 4
}
@@ -253,10 +283,11 @@ if [ "$_opt_plug" ]; then
elif [ "$_opt_pull" ]; then
remove_module
else
- echo "Missing the operation."
+ prog_abort "Missing the operation."
parameter_error
fi
+prog_info "Done."
exit 0
# ============================================================== &ss ===
--
1.5.6.5
|
msg2845 (view) |
Author: suntong1 |
Date: 2010-01-15.20:13:13 |
|
- tests fine.
- ready for first publish.
---
bin/live-module | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index e38ab29..7eb5501 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -142,8 +142,6 @@ insert_module() {
# remove the module from root aufs
remove_module() {
- set -x
-
# Try to simply remove the dir first. If succeeds, finish
rmdir "${croot}/${imagename}" 2>/dev/null && exit 0
# OK the previous trick didn't work. So we have a real module here.
@@ -237,6 +235,12 @@ image="${1}"
imagename=$(basename "${image}")
croot=""
+[ -e "$image" ] || {
+ echo "The specified module file '$image' does not exist."
+ exit 4
+}
+
+
# FIXME: port the following after bug 506591 has been fixed
# Test whether the module file is stored in union
# if yes, then we must move it somewhere else (to RAM) else it can't be added
--
1.5.6.5
|
msg2844 (view) |
Author: suntong1 |
Date: 2010-01-15.20:13:01 |
|
- add back all the relavent fleshes beside the bare-bone
---
bin/live-module | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index 453800d..e38ab29 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -14,6 +14,49 @@
# FIXME: move the functions from above line and the followings into a central lib file
+# log
+# store given text in /var/log/livedbg
+log()
+{
+ echo "$@" 2>/dev/null >>/var/log/livedbg
+}
+
+debug_log()
+{
+ if [ "$DEBUG_IS_ENABLED" ]; then
+ echo "- debug: $*" >&2
+ log "- debug: $*"
+ fi
+}
+
+# echogreen will echo $@ in green color
+# $1 = text
+#
+echogreen()
+{
+ echo -ne "[0;32m""$@""[0;39m"
+}
+
+# echolog
+# $1 = text to show and to write to /var/log/messages
+#
+echolog()
+{
+ if [ "$1" != "" ]; then
+ echogreen "* "
+ log "LIVECD:" "$@"
+ echo "$@"
+ fi
+}
+
+# test if the script is started by root user. If not, exit
+allow_only_root()
+{
+ if [ "0$UID" -ne 0 ]; then
+ echo "Only root can run $(basename $0)"; exit 1
+ fi
+}
+
# Insert a directory tree $2 to an union specified by $1
# Top-level read-write branch is specified by it's index 0
# Using =rr enables aufs to optimize real readonly branches
@@ -22,9 +65,9 @@
#
union_insert_dir()
{
- log_begin_msg "Union_insert_dir $*"
+ debug_log "union_insert_dir $*"
mount -n -o remount,add:1:$2=rr aufs $1
- log_end_msg
+ if [ $? -ne 0 ]; then echo "can't insert module to union" >&2; return 2; fi
}
mount_image ()
@@ -51,11 +94,14 @@ mount_image ()
union_insert_dir / "${croot}/${imagename}"
+ if [ $? -ne 0 ]; then
+ echo "error inserting module to live filesystem" >&2; exit 3;
+ fi
}
try_remount()
{
- mount -t aufs -o remount,verbose,del:"${croot}/${imagename}" aufs / 2>/dev/null
+ mount -t aufs -o remount,del:"${croot}/${imagename}" aufs / 2>/dev/null
}
# ############################################################## &cs ###
@@ -179,10 +225,22 @@ done
# ############################################################## &cs ###
# :::::::::::::::::::::::::::::::::::::::::::::::: Main script begin :::
+allow_only_root
+
+# are we even using aufs union?
+if [ "$(grep '^aufs / ' /proc/mounts)" = "" ]; then
+ echo "not in the live mode, can't continue."
+ exit 4
+fi
+
image="${1}"
imagename=$(basename "${image}")
croot=""
+# FIXME: port the following after bug 506591 has been fixed
+# Test whether the module file is stored in union
+# if yes, then we must move it somewhere else (to RAM) else it can't be added
+
# == Main dispatch
# business-logic for command line parameter-processing
--
1.5.6.5
|
msg2843 (view) |
Author: suntong1 |
Date: 2010-01-15.20:12:57 |
|
- misc cosmetic fixes
---
bin/live-module | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index 0564bf3..453800d 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -12,7 +12,7 @@
. /usr/share/initramfs-tools/scripts/functions
. /usr/share/initramfs-tools/scripts/live
-# FIXME: move the functions from above line and the followings into a separated lib file
+# FIXME: move the functions from above line and the followings into a central lib file
# Insert a directory tree $2 to an union specified by $1
# Top-level read-write branch is specified by it's index 0
@@ -75,9 +75,9 @@ Options:
-u, --pull pull-out the module (synonym for remove)
-h, --help Print usage information and exit
- -V, --version Show version information and exit
"
}
+# -V, --version Show version information and exit
parameter_error() {
echo "Try 'live-module --help' for more information."
@@ -87,6 +87,10 @@ parameter_error() {
# insert the module into root aufs
insert_module() {
mount_image "$image"
+
+ # FIXME: port the following after bug 506591 has been fixed: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506591
+ # update ld cache if new ld.so.conf/cache exists in the module
+ # 'invoke-rc.d daemon start' for all daemons within this module
}
# remove the module from root aufs
@@ -108,7 +112,7 @@ remove_module() {
# if we are here, the module has been successfuly removed from aufs union
- # so now we have to umount the lzm file and then free the loop device
+ # so now we have to umount the module and then free the loop device
LOOP=$(cat /proc/mounts | grep "${croot}/${imagename} " | cut -d " " -f 1)
umount -n "${croot}/${imagename}" 2>/dev/null
if [ $? -ne 0 ]; then
@@ -121,6 +125,12 @@ remove_module() {
# ============================================================ &pclp ===
# .................................. process command line parameters ...
+# @WARNING:
+# The following is use for the *command line logic* processing. It should be
+# as dumb as possible. I.e., it should NOT be more complicated than
+# copy-paste-and-rename from existing code. All *business-logic* processing
+# should be handled in main, where it belongs.
+
_opt_temp=`getopt --name live-module -o +irpuhV --long \
ins,rem,plug,pull,help,version \
-- "$@"`
@@ -175,6 +185,7 @@ croot=""
# == Main dispatch
+# business-logic for command line parameter-processing
if [ "$_opt_plug" ]; then
insert_module
elif [ "$_opt_pull" ]; then
@@ -186,3 +197,5 @@ fi
exit 0
+# ============================================================== &ss ===
+# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: end :::
--
1.5.6.5
|
msg2842 (view) |
Author: suntong1 |
Date: 2010-01-15.20:12:47 |
|
- add grml code header
- add function usage()
- add function parameter_error()
- add command line parameters handling
- add main dispatch
- command line parameters handling tested fine
---
bin/live-module | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 94 insertions(+), 7 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index c8d9dc6..0564bf3 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -1,9 +1,18 @@
#!/bin/sh
+# Filename: live-module
+# Purpose: Insert/remove live modules into root aufs
+# Authors:
+# Initially ported from Slax to Debian by
+# Tong Sun <http://xpt.sourceforge.net/>
+# Original Slax Author:
+# Tomas M. <http://www.linux-live.org>
+# License: This file is licensed under the GPL.
+################################################################################
. /usr/share/initramfs-tools/scripts/functions
. /usr/share/initramfs-tools/scripts/live
-# FIXME: move the above line and the following functions into a separated lib
+# FIXME: move the functions from above line and the followings into a separated lib file
# Insert a directory tree $2 to an union specified by $1
# Top-level read-write branch is specified by it's index 0
@@ -52,15 +61,36 @@ try_remount()
# ############################################################## &cs ###
# :::::::::::::::::::::::::::::::::::::::::::::::: Subroutines begin :::
+usage() {
+ echo "
+live-module - insert/remove live modules into root aufs
+
+Usage: live-module [options] module
+
+Options:
+
+ -i, --ins insert the module into root aufs
+ -r, --rem remove the module from root aufs
+ -p, --plug plug-in the module (synonym for insert)
+ -u, --pull pull-out the module (synonym for remove)
+
+ -h, --help Print usage information and exit
+ -V, --version Show version information and exit
+"
+}
+
+parameter_error() {
+ echo "Try 'live-module --help' for more information."
+ exit 1
+}
+
# insert the module into root aufs
-insert_module ()
-{
+insert_module() {
mount_image "$image"
}
# remove the module from root aufs
-remove_module ()
-{
+remove_module() {
set -x
@@ -68,6 +98,7 @@ remove_module ()
rmdir "${croot}/${imagename}" 2>/dev/null && exit 0
# OK the previous trick didn't work. So we have a real module here.
+ # FIXME: port this after bug 506591 has been fixed: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506591
# First, try to stop all daemons which may be started by this module
#find_n_run_scripts ${croot}/${imagename} stop deactivate
@@ -87,15 +118,71 @@ remove_module ()
rmdir "${croot}/${imagename}" # if not empty or busy, a message will be shown
}
+# ============================================================ &pclp ===
+# .................................. process command line parameters ...
+
+_opt_temp=`getopt --name live-module -o +irpuhV --long \
+ ins,rem,plug,pull,help,version \
+ -- "$@"`
+if [ $? != 0 ]; then
+ parameter_error
+fi
+eval set -- "$_opt_temp"
+
+while :; do
+ case "$1" in
+
+ # == Options
+ --ins|-i|--plug|-p) # insert the module into root aufs
+ _opt_plug=T
+ ;;
+ --rem|-r|--pull|-u) # remove the module from root aufs
+ _opt_pull=T
+ ;;
+ #
+ --help|-h) # Print usage information and exit
+ _opt_help=T
+ ;;
+ --version|-V) # Show version information and exit
+ _opt_version=T
+ ;;
+ --)
+ shift; break
+ ;;
+ *)
+ echo "Internal getopt error!" ; exit 1
+ ;;
+ esac
+ shift
+done
+
+[ "$_opt_help" ] && {
+ usage
+ exit 0
+}
+
+[ ${1:+T} ] || {
+ echo "Missing the module file specification."
+ parameter_error
+}
+
# ############################################################## &cs ###
# :::::::::::::::::::::::::::::::::::::::::::::::: Main script begin :::
-# == Main dispatch
-
image="${1}"
imagename=$(basename "${image}")
croot=""
+# == Main dispatch
+
+if [ "$_opt_plug" ]; then
+ insert_module
+elif [ "$_opt_pull" ]; then
+ remove_module
+else
+ echo "Missing the operation."
+ parameter_error
+fi
exit 0
--
1.5.6.5
|
msg2841 (view) |
Author: suntong1 |
Date: 2010-01-15.20:12:42 |
|
- move things around
- add my code frame
- nothing else changed
---
bin/live-module | 68 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index 56a3f52..c8d9dc6 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -3,6 +3,8 @@
. /usr/share/initramfs-tools/scripts/functions
. /usr/share/initramfs-tools/scripts/live
+# FIXME: move the above line and the following functions into a separated lib
+
# Insert a directory tree $2 to an union specified by $1
# Top-level read-write branch is specified by it's index 0
# Using =rr enables aufs to optimize real readonly branches
@@ -47,33 +49,53 @@ try_remount()
mount -t aufs -o remount,verbose,del:"${croot}/${imagename}" aufs / 2>/dev/null
}
-image="${1}"
-imagename=$(basename "${image}")
-croot=""
+# ############################################################## &cs ###
+# :::::::::::::::::::::::::::::::::::::::::::::::: Subroutines begin :::
-mount_image "$image"
+# insert the module into root aufs
+insert_module ()
+{
+ mount_image "$image"
+}
-exit 0
-set -x
+# remove the module from root aufs
+remove_module ()
+{
+
+ set -x
-# Try to simply remove the dir first. If succeeds, finish
-rmdir "${croot}/${imagename}" 2>/dev/null && exit 0
-# OK the previous trick didn't work. So we have a real module here.
+ # Try to simply remove the dir first. If succeeds, finish
+ rmdir "${croot}/${imagename}" 2>/dev/null && exit 0
+ # OK the previous trick didn't work. So we have a real module here.
-# First, try to stop all daemons which may be started by this module
-#find_n_run_scripts ${croot}/${imagename} stop deactivate
+ # First, try to stop all daemons which may be started by this module
+ #find_n_run_scripts ${croot}/${imagename} stop deactivate
-# detach it from aufs union. This may take a long time, remounting the
-# root directory is an expensive operation.
-try_remount
+ # detach it from aufs union. This may take a long time, remounting the
+ # root directory is an expensive operation.
+ try_remount
-# if we are here, the module has been successfuly removed from aufs union
-# so now we have to umount the lzm file and then free the loop device
-LOOP=$(cat /proc/mounts | grep "${croot}/${imagename} " | cut -d " " -f 1)
-umount -n "${croot}/${imagename}" 2>/dev/null
-if [ $? -ne 0 ]; then
- exit 4
-fi
-losetup -d "$LOOP" 2>/dev/null # sometimes it's freed by umount automatically
-rmdir "${croot}/${imagename}" # if not empty or busy, a message will be shown
+ # if we are here, the module has been successfuly removed from aufs union
+ # so now we have to umount the lzm file and then free the loop device
+ LOOP=$(cat /proc/mounts | grep "${croot}/${imagename} " | cut -d " " -f 1)
+ umount -n "${croot}/${imagename}" 2>/dev/null
+ if [ $? -ne 0 ]; then
+ exit 4
+ fi
+ losetup -d "$LOOP" 2>/dev/null # sometimes it's freed by umount automatically
+ rmdir "${croot}/${imagename}" # if not empty or busy, a message will be shown
+}
+
+# ############################################################## &cs ###
+# :::::::::::::::::::::::::::::::::::::::::::::::: Main script begin :::
+
+# == Main dispatch
+
+image="${1}"
+imagename=$(basename "${image}")
+croot=""
+
+
+exit 0
+
--
1.5.6.5
|
msg2840 (view) |
Author: suntong1 |
Date: 2010-01-15.20:12:36 |
|
- preliminary coding/testing done.
- porting the bare-bone of the feature proved to be working fine.
- able to insert / remove modules to the aufs system.
---
bin/live-module | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/bin/live-module b/bin/live-module
index 4d5ace0..56a3f52 100755
--- a/bin/live-module
+++ b/bin/live-module
@@ -1,7 +1,21 @@
#!/bin/sh
+. /usr/share/initramfs-tools/scripts/functions
. /usr/share/initramfs-tools/scripts/live
+# Insert a directory tree $2 to an union specified by $1
+# Top-level read-write branch is specified by it's index 0
+# Using =rr enables aufs to optimize real readonly branches
+# $1 = union absolute path (starting with /)
+# $2 = path to data directory
+#
+union_insert_dir()
+{
+ log_begin_msg "Union_insert_dir $*"
+ mount -n -o remount,add:1:$2=rr aufs $1
+ log_end_msg
+}
+
mount_image ()
{
image="${1}"
@@ -23,6 +37,43 @@ mount_image ()
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
+
+ union_insert_dir / "${croot}/${imagename}"
+
+}
+
+try_remount()
+{
+ mount -t aufs -o remount,verbose,del:"${croot}/${imagename}" aufs / 2>/dev/null
}
-mount_image "$1"
+image="${1}"
+imagename=$(basename "${image}")
+croot=""
+
+mount_image "$image"
+
+exit 0
+set -x
+
+# Try to simply remove the dir first. If succeeds, finish
+rmdir "${croot}/${imagename}" 2>/dev/null && exit 0
+# OK the previous trick didn't work. So we have a real module here.
+
+# First, try to stop all daemons which may be started by this module
+#find_n_run_scripts ${croot}/${imagename} stop deactivate
+
+# detach it from aufs union. This may take a long time, remounting the
+# root directory is an expensive operation.
+try_remount
+
+
+# if we are here, the module has been successfuly removed from aufs union
+# so now we have to umount the lzm file and then free the loop device
+LOOP=$(cat /proc/mounts | grep "${croot}/${imagename} " | cut -d " " -f 1)
+umount -n "${croot}/${imagename}" 2>/dev/null
+if [ $? -ne 0 ]; then
+ exit 4
+fi
+losetup -d "$LOOP" 2>/dev/null # sometimes it's freed by umount automatically
+rmdir "${croot}/${imagename}" # if not empty or busy, a message will be shown
--
1.5.6.5
|
msg2839 (view) |
Author: suntong1 |
Date: 2010-01-15.20:12:28 |
|
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
|
msg2398 (view) |
Author: mika |
Date: 2009-08-05.02:35:01 |
|
Hi Tong Sun,
Sadly I can't find your patches in my mailbox anymore. Do you have them
available and any chance you could post them to the BTS (or send them to me via
mail so I can forward them to the BTS)?
Thanks!
regards,
-mika-
|
msg2049 (view) |
Author: mika |
Date: 2009-03-16.23:15:31 |
|
* Tong Sun <bts@bts.grml.org> [20090316 21:32]:
> > Yep, there's some problem with my sendmail at the moment,
> > investigating... and will resend when ok.
> Should be there already. (Somehow my sendmail SMART_HOST stops working
> suddenly).
Thanks, got them and will take a closer look at them ASAP.
regards,
-mika-
|
msg2048 (view) |
Author: suntong |
Date: 2009-03-16.20:32:32 |
|
On Mon, Mar 16, 2009 at 4:17 PM, Tong Sun <suntong001@gmail.com> wrote:
> Yep, there's some problem with my sendmail at the moment,
> investigating... and will resend when ok.
Should be there already. (Somehow my sendmail SMART_HOST stops working
suddenly).
|
msg2047 (view) |
Author: suntong |
Date: 2009-03-16.20:17:34 |
|
Ops, thanks for the heads up.
Yep, there's some problem with my sendmail at the moment,
investigating... and will resend when ok.
On Mon, Mar 16, 2009 at 2:42 PM, Michael Prokop <bts@bts.grml.org> wrote:
> not sure when exactly you sent those mails or if they are just in a local queue
> of any involved MTA, but so far I didn't receive anything yet. ;)
|
msg2046 (view) |
Author: mika |
Date: 2009-03-16.18:42:55 |
|
Hi Tong,
not sure when exactly you sent those mails or if they are just in a local queue
of any involved MTA, but so far I didn't receive anything yet. ;)
regards,
-mika-
|
msg2045 (view) |
Author: suntong |
Date: 2009-03-16.16:35:23 |
|
On Thu, Mar 12, 2009 at 4:53 PM, Michael Prokop <bts@bts.grml.org> wrote:
> Very interesting, please feel free to attach your patch[es] to this
> bugreport so they don't get lost. Thanks!
Just sent the following git patches in email to mika@grml.org:
0001-add-live-module-insert-remove-live-modules-into-ro.patch
0002-live-module-revision-1.2.patch
0003-live-module-revision-1.3.patch
0004-live-module-revision-1.4.patch
0005-live-module-revision-1.5.patch
0006-live-module-revision-1.6.patch
0007-live-module-revision-1.7.patch
0008-live-module-revision-1.8.patch
References:
<1237221077-5329-1-git-send-email-suntong@cpan.org>
<1237221077-5329-2-git-send-email-suntong@cpan.org>
<1237221077-5329-3-git-send-email-suntong@cpan.org>
<1237221077-5329-4-git-send-email-suntong@cpan.org>
<1237221077-5329-5-git-send-email-suntong@cpan.org>
<1237221077-5329-6-git-send-email-suntong@cpan.org>
<1237221077-5329-7-git-send-email-suntong@cpan.org>
<1237221077-5329-8-git-send-email-suntong@cpan.org>
Please check them out.
|
msg2036 (view) |
Author: mika |
Date: 2009-03-12.20:53:01 |
|
* Tong Sun <bts@bts.grml.org> [20090311 05:11]:
> > Regarding the persistence solution, I think I would rather like to have
> > a solution where the installed packages are not forced to be loaded into
> > main memory - as I understand that the live-snapshot would do, or ...?
> > Do grml have some toolchain that will allow me to either add stuff to an
> > existing squashfs or have the system "union mount" additional squashfs
> > files?
> Yes, the "layered module architecture" feature is actually provided by
> live-initramfs itself. Check out it man pages, it is trivial to add layered
> module as you wish.
> So far, I have just been putting the modules that I build for slax on
> top of grml, about 7 layered modules on top of grml. It works perfectly, but
> they are all my home, text or script files though. I.e., no debian packages
> involved in the layered modules yet.
> Ref http://bts.grml.org/grml/issue523
Very interesting, Tong!
> Moreover, I've build a standalone script (by patching live-initramfs) to give
> users the ability to insert modules into live system on the fly, and/or remove
> them as well. I.e., anding/removing layered modules does not have to be on boot
> only, but can happen any time. I've send the patches to mika, but hasn't get
> around to check the latest availability status yet.
> > [x] Definitely interested.
> Oh, thanks a lot, that's very encouraging. . .
> I'll send you the patches right away. It's a standalone script and
> working fine now. Here is the current usage help:
[...]
Very interesting, please feel free to attach your patch[es] to this
bugreport so they don't get lost. Thanks!
> > I don't know how creating those additional modules works in regards
> > to the workflow, but I'm definitely interested in such a feature and
> > appreciate any help and work from you.
> Ok, I'll elaborate more for my previous email, and more over, I'll add
> an option to create squashfs live modules in live-module.
> How about we use
> -c, --create-from=dir create squashfs live modules from the given dir
> ?
I'd like to check your live-module out before talking about further
features. :) I'd love to see it integrated it in official
live-initramfs as well, I think we have pretty good chances if we
provide a well tested and documented patch.
> BTW, This is how I created the split modules manually.
> cd $os_mnt
> mksquashfs . ../001-base.squashfs -noappend -b 256K -lzmadic 256K -e var
> mksquashfs var tmp ../002-vars.squashfs -noappend -b 256K -lzmadic 256K
> You can exclude more in base and include more in var as you wish.
Looking forwarding to receiving and testing your patches. :)
regards,
-mika-
|
msg2035 (view) |
Author: suntong |
Date: 2009-03-11.04:11:15 |
|
[logging the request/messages in bts]
> Regarding the persistence solution, I think I would rather like to have
> a solution where the installed packages are not forced to be loaded into
> main memory - as I understand that the live-snapshot would do, or ...?
> Do grml have some toolchain that will allow me to either add stuff to an
> existing squashfs or have the system "union mount" additional squashfs
> files?
Yes, the "layered module architecture" feature is actually provided by
live-initramfs itself. Check out it man pages, it is trivial to add layered
module as you wish.
So far, I have just been putting the modules that I build for slax on
top of grml, about 7 layered modules on top of grml. It works perfectly, but
they are all my home, text or script files though. I.e., no debian packages
involved in the layered modules yet.
Ref http://bts.grml.org/grml/issue523
Moreover, I've build a standalone script (by patching live-initramfs) to give
users the ability to insert modules into live system on the fly, and/or remove
them as well. I.e., anding/removing layered modules does not have to be on boot
only, but can happen any time. I've send the patches to mika, but hasn't get
around to check the latest availability status yet.
On Fri, Dec 5, 2008 at 5:32 AM, Michael Prokop <mika@grml.org> wrote:
>
>> As you may have known, I have patched live-initramfs (with a
>> standalone script) to give users the ability to insert modules into
>> live system on the fly, and/or remove them as well. . . .
>
>> What do you say?
>
> [x] Definitely interested.
Oh, thanks a lot, that's very encouraging. . .
I'll send you the patches right away. It's a standalone script and
working fine now. Here is the current usage help:
live-module - insert/remove live modules into root aufs
Usage: live-module [options] module
Options:
-i, --ins insert the module into root aufs
-r, --rem remove the module from root aufs
-p, --plug plug-in the module (synonym for insert)
-u, --pull pull-out the module (synonym for remove)
-h, --help Print usage information and exit
> I don't know how creating those additional modules works in regards
> to the workflow, but I'm definitely interested in such a feature and
> appreciate any help and work from you.
Ok, I'll elaborate more for my previous email, and more over, I'll add
an option to create squashfs live modules in live-module.
How about we use
-c, --create-from=dir create squashfs live modules from the given dir
?
BTW, This is how I created the split modules manually.
cd $os_mnt
mksquashfs . ../001-base.squashfs -noappend -b 256K -lzmadic 256K -e var
mksquashfs var tmp ../002-vars.squashfs -noappend -b 256K -lzmadic 256K
You can exclude more in base and include more in var as you wish.
cheers
|
|
Date |
User |
Action |
Args |
2011-11-07 14:11:46 | mika | set | status: need-eg -> dead nosy:
mika, suntong messages:
+ msg4049 |
2010-02-28 23:52:06 | suntong | set | files:
+ unnamed, live-module nosy:
mika, suntong messages:
+ msg3093 |
2010-02-27 23:16:39 | mika | set | nosy:
mika, suntong messages:
+ msg3026 |
2010-01-15 20:16:30 | suntong | set | nosy:
mika, suntong messages:
+ msg2847 title: live-module revision 1.8 -> live-module patches |
2010-01-15 20:13:17 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2846 title: live-module revision 1.7 -> live-module revision 1.8 |
2010-01-15 20:13:13 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2845 title: live-module revision 1.6 -> live-module revision 1.7 |
2010-01-15 20:13:02 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2844 title: live-module revision 1.5 -> live-module revision 1.6 |
2010-01-15 20:12:58 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2843 title: live-module revision 1.4 -> live-module revision 1.5 |
2010-01-15 20:12:47 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2842 title: live-module revision 1.3 -> live-module revision 1.4 |
2010-01-15 20:12:43 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2841 title: live-module revision 1.2 -> live-module revision 1.3 |
2010-01-15 20:12:37 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2840 title: add live-module - insert/remove live modules into root aufs -> live-module revision 1.2 |
2010-01-15 20:12:28 | suntong1 | set | nosy:
mika, suntong messages:
+ msg2839 title: live-initramfs patch -> add live-module - insert/remove live modules into root aufs |
2009-08-05 02:35:01 | mika | set | status: chatting -> need-eg nosy:
mika, suntong messages:
+ msg2398 |
2009-03-16 23:15:33 | mika | set | nosy:
mika, suntong messages:
+ msg2049 |
2009-03-16 20:32:32 | suntong | set | nosy:
mika, suntong messages:
+ msg2048 |
2009-03-16 20:17:36 | suntong | set | nosy:
mika, suntong messages:
+ msg2047 |
2009-03-16 18:42:56 | mika | set | nosy:
mika, suntong messages:
+ msg2046 |
2009-03-16 16:35:23 | suntong | set | nosy:
mika, suntong messages:
+ msg2045 |
2009-03-12 20:57:59 | mika | set | assignedto: mika nosy:
+ mika |
2009-03-12 20:53:07 | mika | set | status: unread -> chatting messages:
+ msg2036 |
2009-03-11 04:11:19 | suntong | create | |
|