kern

diff mkdiskimg @ 84:4dd35ccceba1

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 07 Dec 2011 04:26:18 +0000
parents 4ef83db5f4cd
children 5fb7ad5967a8
line diff
     1.1 --- a/mkdiskimg	Tue Dec 06 15:53:57 2011 +0200
     1.2 +++ b/mkdiskimg	Wed Dec 07 04:26:18 2011 +0000
     1.3 @@ -19,17 +19,34 @@
     1.4  echo 'creating image file ...'
     1.5  dd if=/dev/zero of=$imgfile bs=1M count=$sizemb || exit 1
     1.6  
     1.7 +mkpart_linux()
     1.8 +{
     1.9 +	sfdisk -q $imgfile <<EOF
    1.10 +,,cc
    1.11 +EOF
    1.12 +}
    1.13 +
    1.14 +mkpart_fbsd()
    1.15 +{
    1.16 +	fdisk -f - $imgfile <<EOF
    1.17 +p 1 204 * *
    1.18 +EOF
    1.19 +}
    1.20 +
    1.21 +sys=`uname -s`
    1.22 +
    1.23  # create partition table
    1.24 -if ! sfdisk --version | grep linux; then
    1.25 -	echo "failed to find the linux sfdisk program."
    1.26 -	echo "please install it, or create a partition on the disk image ($imgfile) manually."
    1.27 +echo 'creating partition table with a single partition ...'
    1.28 +if [ $sys = Linux ]; then
    1.29 +	mkpart_linux
    1.30 +#elif [ $sys = FreeBSD ]; then
    1.31 +#	mkpart_fbsd
    1.32 +else
    1.33 +	echo "don't know how to partition the image on your system."
    1.34 +	echo "please create a partition in the disk image ($imgfile) manually."
    1.35  	exit 0
    1.36  fi
    1.37 -
    1.38 -echo 'creating partition table with a single partition ...'
    1.39 -sfdisk -q $imgfile <<EOF
    1.40 -,,cc
    1.41 -EOF
    1.42 +	
    1.43  if [ $? != 0 ]; then
    1.44  	echo 'failed to create partition' >&2
    1.45  	exit 1