From b64692ddd130c43f3b0ba9665bb3945bc46ff485 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 6 Nov 2003 21:33:17 +0000 Subject: add mdk_totem & mdk_behind_totem --- move/tree/mdk_behind_totem | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 move/tree/mdk_behind_totem (limited to 'move/tree/mdk_behind_totem') diff --git a/move/tree/mdk_behind_totem b/move/tree/mdk_behind_totem new file mode 100755 index 000000000..11ef2ae22 --- /dev/null +++ b/move/tree/mdk_behind_totem @@ -0,0 +1,71 @@ +#!/bin/bash + +ok=1 + +boot_loop=loop0 +main_loop=loop3 + +while [ -n "$1" ]; do + case "$1" in + --boot-loop) + boot_loop="$1" + shift + shift + ;; + --main-loop) + main_loop="$2" + shift + shift + ;; + --totem-pid) + totem_pid="$2" + shift + shift + ;; + *) + ok='' + shift + esac +done + +if [ -z "$totem_pid" -o -z "$ok" ]; then + printf "Usage: mdk_behind_totem [--boot-loop ] [--main-loop ] --totem-pid \n" + exit 1 +fi + +exec 2> /tmp/mdk_behind_totem.log + +trap 'umount_cd' USR1 + +umount_cd() { + echo umount_cd + busy-files | grep /image/ + busy-files | grep /image_boot/ + + umount /image_boot + losetup -d /dev/$boot_loop + + ln -sf /image_always/lib / + umount /image + /image_always/sbin/losetup -d /dev/$main_loop +} + +mount_cd() { + echo mount_cd + /image_always/sbin/losetup -r -e gz /image_raw/live_tree.clp /dev/$main_loop + /image_always/bin/mount /dev/$main_loop /image + + losetup -r -e gz /image_raw/live_tree_boot.clp /dev/$boot_loop + mount /dev/$boot_loop /image_boot + + ln -sf /image/lib / + + mdk_move_loop to_cdrom always totem +} + +while [ -e "/proc/$totem_pid" ]; do + echo "waiting..." + sleep 1 +done + +mount_cd -- cgit v1.2.1