summaryrefslogtreecommitdiffstats
path: root/tools/mdkinst_stage2_tool
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-11-16 10:23:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-11-16 10:23:59 +0000
commit0c5037279ed0c5bbfee2576ab51f15b1e68d7fae (patch)
tree270657cae4ab1348ffcf22b628a985910e5bbcee /tools/mdkinst_stage2_tool
parent880405c99d5e3724dda995fe136a6124545006c7 (diff)
downloaddrakx-backup-do-not-use-0c5037279ed0c5bbfee2576ab51f15b1e68d7fae.tar
drakx-backup-do-not-use-0c5037279ed0c5bbfee2576ab51f15b1e68d7fae.tar.gz
drakx-backup-do-not-use-0c5037279ed0c5bbfee2576ab51f15b1e68d7fae.tar.bz2
drakx-backup-do-not-use-0c5037279ed0c5bbfee2576ab51f15b1e68d7fae.tar.xz
drakx-backup-do-not-use-0c5037279ed0c5bbfee2576ab51f15b1e68d7fae.zip
major switch from ramdisk to clp
- make_mdkinst_stage2 is now mdkinst_stage2_tool (we don't keep the live when building the clp, mdkinst_stage2_tool is able to create the clp from the live, or the live from the clp)
Diffstat (limited to 'tools/mdkinst_stage2_tool')
-rwxr-xr-xtools/mdkinst_stage2_tool44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/mdkinst_stage2_tool b/tools/mdkinst_stage2_tool
new file mode 100755
index 000000000..f383cdf1c
--- /dev/null
+++ b/tools/mdkinst_stage2_tool
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+[ $# != 1 ] && {
+ echo "usage: mdkinst_stage2_tool <stage2 dir>" ;
+ echo " example: misc/mdkinst_stage2_tool install/stage2"
+ exit
+}
+
+STAGE2_DIR="$1"
+LIVE_DIR="$STAGE2_DIR/live"
+CLP="$STAGE2_DIR/mdkinst.clp"
+
+if [ -d $LIVE_DIR ]; then
+ echo "Creating $CLP from $LIVE_DIR"
+ rm -f $STAGE2_DIR/.room
+ mkisofs -quiet -D -R $LIVE_DIR | create_compressed_fs - 65536 $CLP 200 2>/dev/null
+ echo foo > $STAGE2_DIR/.room
+ if [ -s $STAGE2_DIR/.room ]; then
+ rm -rf $LIVE_DIR $STAGE2_DIR/.room
+ else
+ echo "not enough space"
+ rm -f $CLP
+ exit 1
+ fi
+else
+ echo "Creating $LIVE_DIR from $CLP"
+
+ TMPDIR=${TMPDIR=/tmp}
+ MNTPOINT=$TMPDIR/stage2_img
+
+ if [ $EUID != "0" ]; then
+ SUDO="sudo"
+ PATH="/sbin:/usr/sbin:$PATH"
+ fi
+
+ $SUDO umount $MNTPOINT 2>/dev/null
+ mkdir -p $MNTPOINT
+ extract_compressed_fs $CLP > $CLP.iso 2>/dev/null
+ mkdir $LIVE_DIR || { echo "not enough space"; exit 1; }
+ $SUDO mount -o loop $CLP.iso $MNTPOINT || { echo "can not loopback mount $CLP"; exit 1; }
+ cp -a $MNTPOINT/* $LIVE_DIR/ || { rm -rf $LIVE_DIR; exit 1; }
+ $SUDO umount $MNTPOINT
+ rm -f $CLP.iso $CLP
+fi