Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions setup_gentoo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ sed -e '\#Disk /dev/loop#,+5d' -i devices

cat devices
while true; do
printf ${CYAN}"Enter the device name you want to install gentoo on (ex, sda for /dev/sda)\n>"
printf ${CYAN}"Enter the device name you want to install gentoo on (ex, sda for /dev/sda and nvme0n1 for /dev/nvme0n1)\n>"
read disk
disk="${disk,,}"

printf ${CYAN}"Does this script need to add a \"p\" character before the partition number\nFor example this is needed for NVMe drives (Wrong: /dev/nvme0n11) (Correct: /dev/nvme0n1p1)\n\nEnter y to add the character or n to not add it\n>"
read add_p
if [ "$add_p" != "y" ] && [ "$add_p" != "n" ]; then
printf ${LIGHTRED}"%s is an invalid answer, do it correctly" $add_p
printf ${WHITE}".\n"
sleep 2
continue
fi
partition_count="$(grep -o $disk devices | wc -l)"
disk_chk=("/dev/${disk}")
if grep "$disk_chk" devices; then
Expand All @@ -41,10 +50,17 @@ while true; do
parted $disk_chk --script -- mkpart primary 4227MiB -1
parted $disk_chk --script name 4 rootfs
parted $disk_chk --script set 2 boot on
part_1=("${disk_chk}1")
part_2=("${disk_chk}2")
part_3=("${disk_chk}3")
part_4=("${disk_chk}4")
if [ "$add_p" = "y" ]; then
part_1=("${disk_chk}p1")
part_2=("${disk_chk}p2")
part_3=("${disk_chk}p3")
part_4=("${disk_chk}p4")
else
part_1=("${disk_chk}1")
part_2=("${disk_chk}2")
part_3=("${disk_chk}3")
part_4=("${disk_chk}4")
fi
mkfs.fat -F 32 $part_2
#mkfs.ext4 $part_2
mkfs.ext4 $part_4
Expand All @@ -55,7 +71,7 @@ while true; do
sleep 2
break
elif [ "$auto_prov_ans" = "n" ]; then
printf ${CYAN}"Enter the partition number for root (ex, 2 for /dev/sda2)\n>"
printf ${CYAN}"Enter the partition number for root (ex, 2 for /dev/sda2 or /dev/nvme0n1p2)\n>"
read num
rootpart="$disk$num"
if grep "$rootpart" devices; then
Expand All @@ -70,7 +86,7 @@ while true; do
part_3="no"
else
while true; do
printf "enter swap partition (ex, /dev/sda3)\n>"
printf "enter swap partition (ex, /dev/sda3 or /dev/nvme0n1p3)\n>"
read part_3
part_3="${part_3,,}"
if grep "$part_3" devices; then
Expand Down