Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titlemultiSDcard_partition
collapsetrue
# This code is for partitioning and image flashing into multiple SD cards

echo Please enter the input arguments in this order : bash partition.sh bb_image video_image SDcardDetail_filename
echo Please keep the script extract.sh in the same folder

# Get user input for Broadband and Video image and SD card partition names and their respective sizes
echo Broadband image : $1
echo Video image : $2
echo SDcard details filename : $3

echo Deleting few folders if they are pre-existing...
sudo rm -rf videomnt/
sudo rm -rf extblock/

echo Video image is going to be extracted...
sudo sh extract.sh $2
sudo mkdir videomnt

loopcnt=1
while IFS=' ' read -r part_name sdcard_size
do
  sudo mkdir videomnt/videomnt'_'$loopcnt
  dir_name='videomnt/videomnt''_'$loopcnt
  echo $dir_name
  echo Calling the thread script which will paralleley execute for multiple SD cards...
  sudo bash threadSD.sh $1 $part_name $sdcard_size $dir_name &
  loopcnt=`expr $loopcnt + 1`
done < $3

# Check file inside videomnt is empty or not
cd videomnt

while true
do
  for file in *; do
     echo Check for file present in the directory...
  done

  if [ "$file" == "*" ]
  then
       echo All SD card partitioning and image flashing are completed !!
       # Deleting temporary folders.
       cd ..
       sudo rm -rf videomnt
       sudo rm -rf extblock/
       exit 1
   fi

  sleep 60
  sleep_cnt=`expr $sleep_cnt + 1`

  if [ "$sleep_cnt" == "10" ]
  then
     echo Multisd card flashing failed due to slow processing or error. Increase sleep count thresold sleep_cnt.
     exit 1
  fi

done


  1.      threadSD.sh

     vi) Create a file (For ex. sudo vi sd_part_size) where all the SD card partition names and their respective sizes are mentioned

...