-
Notifications
You must be signed in to change notification settings - Fork 0
/
ainstall
136 lines (109 loc) · 3.26 KB
/
ainstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
#prelim setup
loadkeys "us"
timedatectl set-ntp true
pacman -Sy archlinux-keyring
#check network
ping archlinux.org -c 4
#partition drives
while :
do
lsblk
echo "Enter drive to partition or 'done' to continue (ex: sda, sdb, nvme0n1, mmcblk0):/nDouble check your partition table type by running cfdisk -z on your drive before running this script."
read drivePath
if [ "$drivePath" == "done" ]
then
break
else
echo "Now partitioning $drivePath, Remember to add a boot partition if using UEFI. (And a 1MB legacy boot partition after if making a portable install.)"
echo "Press enter to run cfdisk:"
cfdisk /dev/$drivePath
echo "Do any more drives need partitioning?"
fi
done
clear
#format other partitions (root, home)
while :
do
lsblk
echo "Enter a partition to format or 'done' to continue (ex: sda1, sda3, sdb2, nvme0n1, mmcblk0)"
read fullPath
if [ "$fullPath" == "done" ]
then
break
else
echo "Which filesystem should $fullPath be formatted as? (ex: ext3, ext4, brtrfs, or fat)"
read fSystem
mkfs.$fSystem /dev/$fullPath
fi
done
#Mount root partition
lsblk
echo "Which partition will be the root partition?"
read root
echo "Mounting /dev/$root as /mnt/"
mount /dev/$root /mnt
#format boot partition (done separately because mkfs pattern is not obvious for efi)
while :
do
echo "Did you make a boot partition? (yes, no)"
read bootYN
#bootYN=$(echo "$bootYN" | tr '[:upper:]' '[:lower:]')
if [ "$bootYN" == "no" ]
then
break
elif [ "$bootYN" == "yes" ]
then
lsblk
echo "which partiton should be the UEFI boot partition?"
read bootPartition
mkfs.fat -F32 /dev/$bootPartition
mkdir -p /mnt/boot/efi
mount /dev/$bootPartition /mnt/boot/efi
echo "boot partition /dev/$bootPartition formatted and mounted at /mnt/boot"
break
else
echo "Error: Answer not valid"
fi
done
#mount other directories (home)
lsblk
cd /
ls --color
while :
do
echo "Are there any additional directories to mount to its own partition? (If so type the directory name, if not write 'no'.)"
read dir
if [ "$dir" == "no" ]
then
break
else
lsblk
echo "What partition should $dir be mounted to?"
read partition
mkdir /mnt/$dir
mount /dev/$partition /mnt/$dir
echo "/dev/$partition mounted as /mnt/$dir"
fi
done
clear
echo "Installing base and base-devel \n"
pacstrap -K /mnt base base-devel linux linux-firmware
echo "Generating fstab:"
genfstab -U -p /mnt >> /mnt/etc/fstab
#add lazytime to all entries
sed -i 's/rw,relatime/rw,relatime,lazytime/g' /mnt/etc/fstab
echo "Review the fstab and add any partitons that you've created in addition to the root partition."
lsblk -f
read -p "Press enter to continue:"
nano /mnt/etc/fstab
clear
echo "Chrooting into installation\:"
echo "Run aconfig inside the chroot environment to finish installation."
cd /
sleep 1s
cp ainstall /mnt
cp aconfig /mnt
systemctl daemon-reload
sleep 1s
arch-chroot /mnt