-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_UEFI_linux.sh
executable file
·233 lines (169 loc) · 4.25 KB
/
install_UEFI_linux.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
if [ $(lsblk|grep disk|grep vda|sed 's/ .*$//') == vda ]
then
DISK=vda
else
DISK=sda
fi
echo Freeing System
umount -R /dev/${DISK}2
sleep 2
umount -R /dev/${DISK}3
sleep 2
umount -R /mnt
sleep 2
echo Setting vi
ln -s /usr/bin/vim /usr/bin/vi
MEMTOTAL=$(grep MemTotal /proc/meminfo | awk ' { print $2 }')
echo Partitioning disk
sgdisk --zap-all /dev/$DISK
sleep 2
sfdisk --delete /dev/$DISK
sleep 2
fdisk /dev/$DISK <<EOF
g
n
p
+500M
t
1
n
+${MEMTOTAL}k
t
19
n
+30G
t
20
n
t
28
w
EOF
fdisk -l
echo Swap
mkswap /dev/${DISK}2
swapon /dev/${DISK}2
echo Formatting disks
mkfs.fat -F 32 /dev/${DISK}1
mkfs.ext4 -F /dev/${DISK}3
mkfs.ext4 -F /dev/${DISK}4
echo Mounting
mount /dev/${DISK}3 /mnt
mkdir /mnt/home
mount /dev/${DISK}4 /mnt/home
mkdir /mnt/efi
mount /dev/${DISK}1 /mnt/efi
echo Copying files
cp -ax / /mnt
cp mkinitcpio.conf /mnt/etc
cp -vaT /run/archiso/bootmnt/arch/boot/$(uname -m)/vmlinuz-linux /mnt/boot/vmlinuz-linux
sleep 2
genfstab -U /mnt >> /mnt/etc/fstab
cp sudoers /mnt/etc
cp yay-11.0.2-1-x86_64.pkg.tar.zst /mnt
cp rclone.conf /mnt
cp VM_xinitrc /mnt/home
cp sxhkdrc /mnt/home
cp dusk_config.h /mnt/home
cp POST_INSTALL.sh /mnt
echo Going CHROOT
arch-chroot /mnt /bin/bash <<EOF >/dev/tty
pacman -Syu --noconfirm
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
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
cp /home/VM_xinitrc /home/ray/.xinitrc
echo Chowning Ray
chown -R ray:ray /home/ray
sleep 2
echo Pacman Keys
pacman-key --init
sleep 3
pacman-key --populate archlinux
sleep 3
sudo pacman -Syu --noconfirm
sleep 2
echo Installing yay
pacman -U yay-11.0.2-1-x86_64.pkg.tar.zst --noconfirm
echo Preparing Jotta and Rclone
sleep 2
mkdir -p /DATA/cloud/Jotta
mkdir -p /home/ray/.config
mkdir -p /home/ray/.config/rclone/
chown -R ray:ray /home/ray
cp /rclone.conf /home/ray/.config/rclone
echo installing Jotta-cli
su ray -c 'yay -S jotta-cli --noconfirm'
sleep 5
mkdir -p /DATA/cloud/Jotta
mkdir -p /MEDIA/Jotta_Photos
chown -R ray:ray /DATA/
chown -R ray:ray /MEDIA/
sudo chown -R jottad /var/lib/jottad
cp /FILES/jottad.service /etc/systemd/system/
systemctl enable --now jottad.service
cp /FILES/rclone-mount.service /etc/systemd/system/
cp /FILES/rclone-mount-photos.service /etc/systemd/system/
echo Enabling rclone services
systemctl enable --now rclone-mount.service
systemctl enable --now rclone-mount-photos.service
systemctl enable --now sshd.service
ln -s /usr/bin/vim /usr/bin/vi
echo cleaning up
sed -i 's/Storage=volatile/#Storage=auto/' /etc/systemd/journald.conf
rm /etc/udev/rules.d/81-dhcpcd.rules
systemctl disable pacman-init.service choose-mirror.service
rm -r /etc/systemd/system/{choose-mirror.service,pacman-init.service,etc-pacman.d-gnupg.mount,[email protected]}
rm /etc/systemd/scripts/choose-mirror
rm /etc/systemd/system/[email protected]/autologin.conf
rm /root/{.automated_script.sh,.zlogin}
rm /etc/mkinitcpio-archiso.conf
rm -r /etc/initcpio
echo mkinitcpio
mkinitcpio -P
echo Installing grub
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
echo Installing dusk
su ray -c 'yay --noconfirm -S yajl'
su ray -c 'yay --noconfirm -S imlib2'
git clone https://github.com/bakkeby/dusk
cd dusk
mv /home/dusk_config.h config.h
chown ray:ray config.h
make
sudo make install
echo Installing YAY packages
for PACK in /FILES/AUR_PACKAGES
do
pacman -U $PACK --noconfirm --needed
done
/POST_INSTALL.sh
EOF
echo moving dusk
cp mirrorlist /mnt/etc/pacman.d/
cp rclone-mount* /mnt/etc/systemd/system
mkdir /mnt/home/ray/git
mkdir -p /mnt/home/ray/.config/sxhkd
mv /mnt/dusk /mnt/home/ray/git
mv /mnt/home/sxhkdrc /mnt/home/ray/.config/sxhkd
mv /home/.xinitrc /home/ray
cp get_wallpaper ~/.config/variety/scripts
cp set_wallpaper ~/.config/variety/scripts
echo Copying scripts
cp -rv FILES/scripts /mnt/home/ray
chmod -R 755 /mnt/home/ray/scripts