﻿#!/bin/bash
Core () {
           echo 'Disco GPT o MBR? '
           read type
           if [ $type = MBR ]
           then
            echo 'Sorgente: '
            read src
            echo 'Destinazione: '
            read dest
            dd if=$src of=$dest status=progress
            dd if=$src of=/tmp/mbr.bak bs=512 count=1 status=progress
            dd if=/tmp/mbr.bak of=$dest bs=446 count=1 status=progress
            rm /tmp/mbr.bak
            echo Done
           fi
           if [ $type = GPT ]
           then
            echo 'Sorgente: '
            read src
            echo 'Destinazione: '
            read dest
            dd if=$src of=$dest status=progress
            echo Done
           fi
}
echo "Disk Cloning Utility dell'\INPS"
echo 'Premi L per listare i dischi'
echo 'Premi S per iniziare'
read var1
if [ $var1 = L ]
then
 lsblk && Core
fi
if [ $var1 = S ]
then
 Core
fi

