-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.sh
executable file
·164 lines (122 loc) · 2.52 KB
/
boot.sh
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
echo Freeing System
umount /dev/vda1
sleep 2
umount /dev/vda3
sleep 2
umount /dev/vda3
sleep 2
umount /dev/vda4
sleep 2
swapoff /dev/vda2
sleep 2
echo Setting vi
ln -s /usr/bin/vim /usr/bin/vi
echo Mirrors
reflector -c NL > /etc/pacman.d/mirrorlist
pacman -Syy
MEMTOTAL=$(grep MemTotal /proc/meminfo | awk ' { print $2 }')
echo Partitioning disk
sgdisk --zap-all /dev/vda
sleep 2
sfdisk --delete /dev/vda
sleep 2
fdisk -l
fdisk /dev/vda <<EOF
g
n
+500M
Y
t
1
n
+${MEMTOTAL}k
Y
t
19
n
+30G
t
20
n
t
28
w
EOF
echo Swap
mkswap /dev/vda2
swapon /dev/vda2
echo Formatting disks
mkfs.fat -F 32 /dev/vda1
mkfs.ext4 -F -F /dev/vda3
mkfs.ext4 -F -F /dev/vda4
echo Mounting
mount /dev/vda3 /mnt
mkdir /mnt/boot
mkdir /mnt/home
mount /dev/vda1 /mnt/boot
sleep 2
mount /dev/vda4 /mnt/home
echo Pacstrap
pacstrap /mnt base base-devel linux linux-firmware vim openssh dhclient networkmanager neofetch wget
echo FSTAB
genfstab -U /mnt >> /mnt/etc/fstab
cp yay-11.0.2-1-x86_64.pkg.tar.zst /mnt/root
cp yay-11.0.2-1-x86_64.pkg.tar.zst /mnt/
#echo Preparing Bootloader
#PARTUUID=$(blkid -o value -s PARTUUID /dev/vda3)
#cat <<BOOT > /root/CI/arch.conf
#title Arch Linux
#linux /vmlinuz-linux
#initrd /initramfs-linux.img
#options root=PARTUUID=$PARTUUID rw
#BOOT
#cat <<LOADER > /root/CI/loader.conf
#default arch
#timeout 4
#console-mode max
#editor no
#LOADER
#bootctl --path=/boot update
echo CHROOT
arch-chroot /mnt <<EOF
echo LOCALE and stuff
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
export LANG=en_US.UTF-8
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
echo Arch-VM > /etc/hostname
#sed -i "/localhost/s/$/ Arch-VM" /etc/hosts
mkinitcpio -p linux
echo "root:qazwsx12" | chpasswd
echo Adding user Ray
groupadd -r autologin
useradd -G autologin,wheel,power -m ray
echo "ray:qazwsx12" | chpasswd
cat <<SU >> /etc/sudoers
## Same thing without a password
ray ALL=(ALL) NOPASSWD: ALL
SU
ln -s /usr/bin/vim /usr/bin/vi
echo Installing Bootloader
bootctl --path=/boot install
#cat <<LOADER > /boot/loader/loader.conf
#bootctl --path=/boot update
echo Preparing Bootloader
PARTUUID=$(blkid -o value -s PARTUUID /dev/vda3)
echo 1 $PARTUUID > partuuid.txt
cat <<BOOT > /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=PARTUUID=$PARTUUID rw
BOOT
echo 2 $PARTUUID >> partuuid.txt
cat <<LOADER > /boot/loader/loader.conf
default arch
timeout 4
console-mode max
editor no
LOADER
bootctl --path=/boot update
EOF