#!/bin/bash
#Share parmeters
echo "Enter \Buh size (MB):"
read buhsizeMB
echo "Enter \Fin size (MB):"
read finsizeMB
echo "Enter \Exchange size (MB):"
read exchangesizeMB
let "buhsizeblock = buhsizeMB*1024"
let "finsizeblock = finsizeMB*1024"
let "exchangesizeblock = exchangesizeMB*1024"
echo $buhsizeblock
echo $finsizeblock
echo $exchangesizeblock
echo "Please Wait"

#DD Files for shares
sudo dd if=/dev/zero of=/home/tempshare/Buh.tempshare bs=1024 count=$buhsizeblock
sudo dd if=/dev/zero of=/home/tempshare/Fin.tempshare bs=1024 count=$finsizeblock
sudo dd if=/dev/zero of=/home/tempshare/Exchange.tempshare bs=1024 count=$exchangesizeblock
sudo chmod 770 /home/tempshare/Buh.tempshare
sudo chmod 770 /home/tempshare/Fin.tempshare
sudo chmod 770 /home/tempshare/Exchange.tempshare
sudo mkfs.ext3 /home/tempshare/Buh.tempshare
sudo mkfs.ext3 /home/tempshare/Fin.tempshare
sudo mkfs.ext3 /home/tempshare/Exchange.tempshare

#Mount Shares
sudo mount -t ext3 -o loop /home/tempshare/Buh.tempshare /home/Buh
sudo mount -t ext3 -o loop /home/tempshare/Fin.tempshare /home/Fin
sudo mount -t ext3 -o loop /home/tempshare/Exchange.tempshare /home/Exchange

#configure autostart /etc/fstab
echo "/home/tempshare/Buh.tempshare        /home/Buh  auto    auto,loop       0 0" >> /etc/fstab
echo "/home/tempshare/Fin.tempshare        /home/Fin  auto    auto,loop       0 0" >> /etc/fstab
echo "/home/tempshare/Exchange.tempshare /home/Exchange  auto    auto,loop     0 0" >> /etc/fstab

echo "Ready"

 
