#!/bin/sh
disk=/dev/mmcblk0
disk_umount_path=/dev/mmcblk0p*
disk_p1=/dev/mmcblk0p1
disk_p2=/dev/mmcblk0p2

mount_p1=/media/card/
mount_p2=/media/card1/


#1:umount sd
umount $disk_umount_path
umount $mount_p1
umount $mount_p2

#2:partition sd
fdisk $disk <<EOF
d

d

d

d

d


n
p
1

+10M

n
p
2



w
EOF

#3:umount sd
sleep 2
umount $disk_umount_path
umount $mount_p1
umount $mount_p2

#4:mkfs sd
mkfs.ext4 -F $disk_p1
mkfs.ext4 -F $disk_p2

#5:mount sd
mount $disk_p1 $mount_p1
mount $disk_p2 $mount_p2

#6:create file system
cd $mount_p1
#mkdir -p  database
touch hrc650sd.file
echo "heron" >> hrc650sd.file

cd $mount_p2
mkdir -p curve
cd curve
mkdir -p curveall curvesimple curveenvelope

sync



