#!/bin/bash
pacman -Sy parted
echo "running lsblk..."
lsblk
echo "Press Enter Key to install; Ctrl+C to cancel if results are not as expected" 
read
echo -n "Enter blockdev to install on or m for manual partitioning: " 
read blockdevtemp
blockdev = ""
if [ "$blockdevtemp" != 'm' ]; then 

#	echo "Partitioning with default layout"
#	echo 'Layout: 4Gb efi partition \n       20Gb swap\n       Rest btrfs root'
    #    (
    #        
    #    echo g
    #    echo n
    #    echo 1

    #    echo +4G


    #    echo n
    #    echo 2

    #    echo +20G




    #    echo n
    #    echo 3







    #    echo w


    #) | fdisk $blockdevtemp
    
    parted --script $blockdevtemp \
	mklabel gpt \
	mkpart primary 1MiB 1GiB \
	mkpart primary 1GiB 15GiB \
	mkpart primary 100MiB 100% \
	quit
    $blockdev=$blockdevtemp
     
fi
 

if [ "$blockdev" == "m" ]; then
    echo -n "Enter blockdev to install on: " 
    read blockdevnew
    parted $blockdev
    $blockdev = $blockdevnew
fi

echo "Formatting Complete"
