Created
August 22, 2011 00:34
-
-
Save Ludo6431/1161395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "`dirname $0`" | |
BASESRC="fsroot" | |
IMGFILE="fsimg.img" | |
IMGSIZE="256" # in MB | |
TMPDIR="`mktemp -d`" | |
# <-- verifying mandatory things | |
if [ ! -d ${BASESRC} ] | |
then | |
echo "Can't find the input directory : ${BASESRC}" | |
exit 1 | |
fi | |
# --> | |
# <- create a new blank FAT partition | |
echo "Creating ${IMGSIZE}MB FAT16 image..." | |
dd if=/dev/zero of=${IMGFILE} bs=1048576 count=${IMGSIZE} | |
mkdosfs -F16 ${IMGFILE} | |
echo "OK" | |
# --> | |
# <-- mount it | |
echo -n "Mounting image..." | |
sudo mount -o loop -o uid=1000 ${IMGFILE} ${TMPDIR} | |
echo "OK" | |
# --> | |
# <-- copy files in it | |
echo -n "Copying files..." | |
cp -R ${BASESRC}/* ${TMPDIR}/ | |
echo "OK" | |
# --> | |
# <-- unmount it | |
echo -n "Unmounting image..." | |
sudo umount ${TMPDIR} | |
rmdir ${TMPDIR} | |
echo "OK" | |
# --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment