diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/make_mdkinst_stage2 | 79 | ||||
-rwxr-xr-x | tools/mdkinst_stage2_tool | 44 |
2 files changed, 44 insertions, 79 deletions
diff --git a/tools/make_mdkinst_stage2 b/tools/make_mdkinst_stage2 deleted file mode 100755 index e0b287f99..000000000 --- a/tools/make_mdkinst_stage2 +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -[ $# != 2 ] && { - echo "usage: make_mdkinst_stage2 <live dir> <output image>" ; - echo " example: misc/make_mdkinst_stage2 install/stage2/live install/stage2/mdkinst_stage2" - exit -} - -TMPDIR=${TMPDIR=/tmp} -STAGE2TMP=$TMPDIR/stage2_tmp -MKE2FS="/sbin/mke2fs -q -m 0 -F -s 1" -MNTPOINT=$TMPDIR/stage2_img -REP4PMS=/usr/bin/perl-install -DEST=$1 -STAGE2=$2 - -testandset() { [ -x $1/packdrake ] && BUILD_ARCHIVE=$1/packdrake; } -testandset `pwd`/misc -testandset `pwd`/. -testandset /$DEST/../../../misc -testandset `pwd`/$DEST/../../../misc -[ -z "$BUILD_ARCHIVE" ] && { echo "can't find packdrake"; exit 1; } - -if [ $EUID != "0" ]; then - SUDO="sudo" - PATH="/sbin:/usr/sbin:$PATH" -fi - -$SUDO rm -rf $STAGE2TMP -install -d $STAGE2TMP -$SUDO cp -a $DEST/* $STAGE2TMP || exit 1 - -#mkdir -p $MNTPOINT 2>/dev/null -#for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done -#dd if=/dev/zero of=$STAGE2 bs=1k count=24000 -#$MKE2FS -N 1000 $STAGE2 -#$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop -# hack to reduce the STAGE2 image (do not edit without modifying in DrakX) -# be sure to keep the biggest server -rm -f $STAGE2TMP/usr/X11R6/bin/XF86_{VGA16,3DLabs,TGA,S3} -rm -f `ls --sort=size $STAGE2TMP/lib/modules.cz-* | perl -ne 'print if $i++'` -rm -f $STAGE2TMP/usr/bin/{pv*,vg*,lv*} $STAGE2TMP/lib/liblvm* -rm -f $STAGE2TMP/usr/bin/{resize_reiserfs,fsck.jfs} -#- we can't simply remove those files, because when pango will start, -#- if it doesn't see them it will recompute the fonts.cache-1 :/ ->$STAGE2TMP/usr/X11R6/lib/X11/fonts/12x13mdk.pcf.gz ->$STAGE2TMP/usr/X11R6/lib/X11/fonts/18x18mdk.pcf.gz -touch $STAGE2TMP/usr/X11R6/lib/X11/fonts/fonts.cache-1 -rm -f $STAGE2TMP/usr/*/pango/*/modules/pango-{arabic,hangul,hebrew,indic,thai}-xft.so - -rm -rf $STAGE2TMP{/usr/bin/brltty,/etc/brltty,/lib/brltty} -rm -rf $STAGE2TMP/usr/share/locale_special - -for i in /usr/share/keymaps /usr/share/xmodmap; do - name=`basename $i` - (cd $STAGE2TMP/$i ; ls * | $BUILD_ARCHIVE -b9s ../$name.cz2 400000) - rm -rf $STAGE2TMP/$i -done - -eval `find $STAGE2TMP | perl -MMDK::Common -lne '-l or $s += round_up(-s, 1024); $i++; END { print "size=",int($s/1024),";inodes=$i" }'`; - -mkdir -p $MNTPOINT 2>/dev/null -for i in $MNTPOINT $STAGE2; do $SUDO umount $i 2>/dev/null ; done -dd if=/dev/zero of=$STAGE2 bs=1k count=$[ $size + 1024 + 200 ] -$MKE2FS -N $[$inodes + 200] $STAGE2 -$SUDO mount -t ext2 $STAGE2 $MNTPOINT -o loop - -rmdir $MNTPOINT/lost+found -$SUDO cp -a $STAGE2TMP/* $MNTPOINT || exit 1 -$SUDO rm -rf $STAGE2TMP - -df $MNTPOINT -df -i $MNTPOINT -$SUDO umount $MNTPOINT -rmdir $MNTPOINT - -echo bzipping $STAGE2 - -bzip2 -v -f -9 $STAGE2 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 |