#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: $0 <root file system path>"
exit 1
fi
if [ ! -d "$1" ]
then
echo "$1 is not a directory"
exit 2
fi
# Create the disk file of 'zero'
dd if=/dev/zero of=rd-ext2.bin bs=1k count=8192
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=16384
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=32768
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=65536
# Create the empty filesystem
mke2fs -F -m 0 rd-ext2.bin
# Fill the filesytem with contents
mount -t ext2 rd-ext2.bin /mnt -o loop
tar -C "$1" -cf - . | tar -C /mnt -xf -
umount /mnt
if [ $# -ne 1 ]
then
echo "Usage: $0 <root file system path>"
exit 1
fi
if [ ! -d "$1" ]
then
echo "$1 is not a directory"
exit 2
fi
# Create the disk file of 'zero'
dd if=/dev/zero of=rd-ext2.bin bs=1k count=8192
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=16384
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=32768
#dd if=/dev/zero of=rd-ext2.bin bs=1k count=65536
# Create the empty filesystem
mke2fs -F -m 0 rd-ext2.bin
# Fill the filesytem with contents
mount -t ext2 rd-ext2.bin /mnt -o loop
tar -C "$1" -cf - . | tar -C /mnt -xf -
umount /mnt
No comments:
Post a Comment