-
Notifications
You must be signed in to change notification settings - Fork 0
/
aconfig
250 lines (204 loc) · 7.44 KB
/
aconfig
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/bin/bash
pacman -Syu --noconfirm ntp
systemctl enable ntp.service
#enable parallel downloads and color in pacman
sed -i '38 a ILoveCandy' /etc/pacman.conf
sed -i 's/#ParallelDownloads = 5/ParallelDownloads = 10/g' /etc/pacman.conf
sed -i 's/#Color/Color/g' /etc/pacman.conf
#enable multilib repositories
sed -i '94,95s/#//g' /etc/pacman.conf
#check if portable installation
while :
do
echo "Is this a portable USB installation? (yes,no)"
read portable
if [ "$portable" == "yes" ]
then
break
else
sed -i 's/-march=x86-64 -mtune=generic/-march=native -mtune=native/g' /etc/makepkg.conf
break
fi
done
#makepkg config, set arch and tune to native if not portable, set number of jobs to number of threads
if [ "$portable" == "yes" ]
then
processorCount=`nproc --all`
sed -i 's/#MAKEFLAGS=/MAKEFLAGS=/g' /etc/makepkg.conf
sed -i "s/-j./-j$processorCount/g" /etc/makepkg.conf
fi
#Install kernel + key packages
pacman -Syu --noconfirm archlinux-keyring
pacman -Syu --noconfirm grub os-prober nano initramfs linux linux-lts linux-lts-headers linux-headers reflector kernel-modules-hook
#reflector
reflector --verbose --ipv4 --protocol https,http --score 50 --fastest 10 --save /etc/pacman.d/mirrorlist
#locale setup
echo "Select locale:"
read -p "Press enter to continue:"
#nano /etc/locale.gen
locale-gen
echo en_US.UTF-8 UTF-8 > /etc/locale.gen
localectl set-locale LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale -a
echo "Select your timezone:"
tzselect | read timeZone
ln -sf $timeZone /etc/localtime
hwclock --systohc --utc
clear
#swap file
echo "Would you like a swap file? (yes,no)"
read swapAnswer
if [ "$swapAnswer" == "yes" ]
then
echo "What size swap file would you like in MiB?"
read swapSize
dd if=/dev/zero of=/swapfile bs=1M count=$swapSize status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "# /swapfile" >> /etc/fstab
echo "/swapfile none swap defaults,lazytime 0 0" >> /etc/fstab
fi
#User setup
echo "What should the hostname be?"
read hostName
echo "$hostName" >> /etc/hostname
echo "127.0.1.1 localhost.localdomain $hostName" >> /etc/hosts
clear
echo "Create password for root:"
passwd
clear
echo "What should the user name be?"
read userName
useradd -m -g users -G wheel,storage,power,tty -s /bin/bash $userName
clear
echo "Create password for $userName:"
passwd $userName
#Allow all users in wheel group to use sudo if they know the password
echo "%wheel ALL=(ALL:ALL) ALL" >> /etc/sudoers
#Set sudo timeout to 60 minutes
echo "Defaults timestamp_timeout=60" >> /etc/sudoers
#Remove prompt timeout for sudo
echo "Defaults passwd_timeout=0" >> /etc/sudoers
#bootloader-gen
os-prober
##reorder autodetect and block hooks for universal hardware booting
sed -i 's/autodetect modconf block/block autodetect modconf/g' /etc/mkinitcpio.conf
mkinitcpio -p linux
UEFI="null"
while :
do
echo "Is this a UEFI system? (yes, no, both)"
read UEFI
if [ "$UEFI" == "yes" ]
then
pacman -S --noconfirm efibootmgr
#/boot/efi already made
grub-install --removable --target=x86_64-efi --bootloader-id=ArchLinux --efi-directory=/boot/efi
break
elif [ "$UEFI" == "no" ]
then
echo "Where should grub be installed? (sda, sdb)"
read iGrub
grub-install --target=i386-pc --recheck /dev/$iGrub
break
elif [ "$UEFI" == "both" ]
then
pacman -S --noconfirm efibootmgr
#/boot/efi already made
grub-install --removable --target=x86_64-efi --bootloader-id=ArchLinux --efi-directory=/boot/efi
echo "Where should the grub be installed? (sda, sdb)"
read iGrub
grub-install --target=i386-pc --recheck /dev/$iGrub
break
fi
done
echo -e "\n\nGRUB_DEFAULT=saved" >> /etc/default/grub
echo "GRUB_SAVEDEFAULT=true" >> /etc/default/grub
echo "GRUB_FORCE_HIDDEN_MENU=TRUE" >> /etc/default/grub
#microcode
while :
do
echo "Does this system have an Intel or AMD CPU? Or is this a portable install? (intel,amd,portable)"
read PROC
if [ "$PROC" == "intel" ]
then
pacman -S --noconfirm intel-ucode
break
elif [ "$PROC" == "amd" ]
then
pacman -S --noconfirm amd-ucode
break
elif [ "$PROC" == "portable" ]
then
pacman -S --noconfirm amd-ucode intel-ucode
break
fi
done
grub-mkconfig -o /boot/grub/grub.cfg
if [ "$UEFI" == "yes" ]
then
mkdir /boot/efi/EFI/BOOT
cp /boot/efi/EFI/GRUB/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
echo "bcf boot add 1 fs0:\EFI\GRUB\grubx64.efi \"Arch GRUB bootloader\"\nexit" >> /boot/efi/startup.nsh
fi
clear
#aur helper
echo "Installing yay:"
echo EDITOR="/usr/bin/nano" >> /etc/environment
chown -hR $userName /home/$userName
cd /home/$userName
curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz
tar -xvzf yay.tar.gz
cd /home/$userName/yay
chown -hR $userName /home/$userName
sudo -u $userName makepkg -csri --skippgpcheck
clear
#default packages
yay -Syu --noconfirm wayland xorg-xwayland linux-firmware networkmanager bash-completion wpa_supplicant xorg-xinit xf86-video-vesa xorg-apps xorg firefox alsa-utils pipewire jamesdsp-pipewire-bin lib32-pipewire wireplumber pipewire-alsa pipewire-pulse p7zip htop wine-staging winetricks libreoffice-fresh mpv adwaita-icon-theme links ntfs-3g deluge code noto-fonts noto-fonts-emoji noto-fonts-cjk noto-fonts-extra
clear
#desktop environment
echo "Which desktop environment would you like to use? (plasma, gnome3, xfce, or none)"
read deWM
case $deWM in
plasma)
pacman -S --noconfirm plasma-meta plasma-nm spectacle konsole gwenview dolphin partitionmanager kate ark knotes qpwgraph plasma-wayland-session
systemctl enable sddm.service ;;
gnome3)
pacman -S --noconfirm gnome gparted gedit file-roller helvum
systemctl enable gdm.service ;;
xfce)
pacman -S --noconfirm xfce4 xfce4-goodies gparted file-roller deluge sddm network-manager-applet gvfs helvum
systemctl enable sddm.service ;;
none)
;;
esac
######anbox may need some fuckery to get yay to cooperate due to not being $userName ~~~~~maybe replace this with waydroid stuff once wayland works for everything
######echo "Install if you wish to have android app support"
######yay -Syu anbox-git anbox-image-gapps-rooted
sysctl -w net.ipv4.ip_default_ttl=128
systemctl enable NetworkManager
systemctl enable wpa_supplicant
systemctl enable bluetooth.service
systemctl enable linux-modules-cleanup
systemctl daemon-reload
rm -rf /ainstall /aconfig /home/$userName/yay*
clear
while :
do
echo "Does this system have an AMD or Nvidia GPU? (amd,nvidia,none)"
read gpu
if [ "$gpu" == "amd" ]
then
pacman -S --noconfirm mesa lib32-mesa xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon libva-mesa-driver lib32-libva-mesa-driver mesa-vdpau lib32-mesa-vdpau
break
elif [ "$gpu" == "nvidia" ]
then
echo "Install Nvidia GPU drivers with package nvidia, nvidia-open, nvidia-340xx, or nvidia-304xx"
echo "You'll also probably want nvidia-settings and lib32-nvidia-utils for configuration and games."
break
fi
done
echo "You may need to modprobe your wifi driver to get it running at first."
echo "Reboot when ready."