Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 13. december 2024

Súbor: [Platon] / scripts / shell / sysadmin / mkext2fs (stiahnutie)

Revízia 1.1, Wed Mar 9 15:32:05 2005 UTC (19 years, 9 months ago) by nepto

Very useful utility added into CVS repository.

#!/bin/bash
# similar to mkcramfs (for use with debian mkinitrd)
# mkext2fs dirname outfile
# 
# no options are parsed
#
#     Written by: Fabian Franz <mkext2fs@fabian-franz.de>
#
# GPL v.2 - See: `locate gpl.txt`

if [ $# -lt 2 ]
then
  echo "Usage: $(basename $0) dirname outfile"
  exit 1
fi

TMPDIR=/tmp/$(basename $0).$$
mkdir $TMPDIR
function clean_exit
{
  umount $TMPDIR 2>/dev/null
  rm -rf $TMPDIR
}

trap clean_exit EXIT

COUNT=$[$(du -s $1 | awk '{ print $1 }' )*2+1000]
dd if=/dev/zero of=$TMPDIR/image count=$COUNT
mke2fs -F $TMPDIR/image
mount -o loop $TMPDIR/image $TMPDIR
cp -a $1/* $TMPDIR
umount $TMPDIR
cat $TMPDIR/image | gzip - > $2


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok