forked from ChrisTitusTech/ArchMatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9-post-setup.sh
executable file
·141 lines (103 loc) · 4.57 KB
/
9-post-setup.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
#!/usr/bin/env bash
#-------------------------------------------------------------------------
# _ _ __ __ _ _
# /_\ _ _ __| |_ | \/ |__ _| |_(_)__
# / _ \| '_/ _| ' \| |\/| / _` | _| / _|
# /_/ \_\_| \__|_||_|_| |_\__,_|\__|_\__|
# Arch Linux Post Install Setup and Config
#-------------------------------------------------------------------------
echo -e "\nFINAL SETUP AND CONFIGURATION"
# ------------------------------------------------------------------------
echo -e "\nGenaerating .xinitrc file"
# Generate the .xinitrc file so we can launch Awesome from the
# terminal using the "startx" command
cat <<EOF > ${HOME}/.xinitrc
#!/bin/bash
# Disable bell
xset -b
# Disable all Power Saving Stuff
xset -dpms
xset s off
# X Root window color
xsetroot -solid darkgrey
# Merge resources (optional)
#xrdb -merge $HOME/.Xresources
# Caps to Ctrl, no caps
setxkbmap -layout us -option ctrl:nocaps
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "\$f" ] && . "\$f"
done
unset f
fi
exit 0
EOF
# ------------------------------------------------------------------------
echo -e "\nUpdating /bin/startx to use the correct path"
# By default, startx incorrectly looks for the .serverauth file in our HOME folder.
sudo sed -i 's|xserverauthfile=\$HOME/.serverauth.\$\$|xserverauthfile=\$XAUTHORITY|g' /bin/startx
# ------------------------------------------------------------------------
echo -e "\nConfiguring LTS Kernel as a secondary boot option"
sudo cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-lts.conf
sudo sed -i 's|Arch Linux|Arch Linux LTS Kernel|g' /boot/loader/entries/arch-lts.conf
sudo sed -i 's|vmlinuz-linux|vmlinuz-linux-lts|g' /boot/loader/entries/arch-lts.conf
sudo sed -i 's|initramfs-linux.img|initramfs-linux-lts.img|g' /boot/loader/entries/arch-lts.conf
# ------------------------------------------------------------------------
echo -e "\nConfiguring vconsole.conf to set a larger font for login shell"
sudo cat <<EOF > /etc/vconsole.conf
KEYMAP=us
FONT=ter-v32b
EOF
# ------------------------------------------------------------------------
echo -e "\nDisabling buggy cursor inheritance"
# When you boot with multiple monitors the cursor can look huge. This fixes it.
sudo cat <<EOF > /usr/share/icons/default/index.theme
[Icon Theme]
#Inherits=Theme
EOF
# ------------------------------------------------------------------------
echo -e "\nIncreasing file watcher count"
# This prevents a "too many files" error in Visual Studio Code
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
# ------------------------------------------------------------------------
echo -e "\nDisabling Pulse .esd_auth module"
# Pulse audio loads the `esound-protocol` module, which best I can tell is rarely needed.
# That module creates a file called `.esd_auth` in the home directory which I'd prefer to not be there. So...
sudo sed -i 's|load-module module-esound-protocol-unix|#load-module module-esound-protocol-unix|g' /etc/pulse/default.pa
# ------------------------------------------------------------------------
echo -e "\nEnabling Login Display Manager"
sudo systemctl enable --now lightdm.service
# ------------------------------------------------------------------------
echo -e "\nEnabling bluetooth daemon and setting it to auto-start"
sudo sed -i 's|#AutoEnable=false|AutoEnable=true|g' /etc/bluetooth/main.conf
sudo systemctl enable --now bluetooth.service
# ------------------------------------------------------------------------
echo -e "\nEnabling the cups service daemon so we can print"
systemctl enable --now org.cups.cupsd.service
sudo ntpd -qg
sudo systemctl enable --now ntpd.service
sudo systemctl disable dhcpcd.service
sudo systemctl stop dhcpcd.service
sudo systemctl enable --now NetworkManager.service
echo "
###############################################################################
# Cleaning
###############################################################################
"
# Remove no password sudo rights
sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
# Add sudo rights
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
# Clean orphans pkg
if [[ ! -n $(pacman -Qdt) ]]; then
echo "No orphans to remove."
else
pacman -Rns $(pacman -Qdtq)
fi
# Replace in the same state
cd $pwd
echo "
###############################################################################
# Done
###############################################################################
"