forked from ChrisTitusTech/ArchTitus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path4-post-setup.sh
executable file
·124 lines (112 loc) · 5.88 KB
/
4-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
#!/usr/bin/env bash
#--------------------------------------------------------------------
# █████╗ ██████╗ ██████╗██╗ ██╗██████╗ █████╗ ██╗ ██╗███████╗
# ██╔══██╗██╔══██╗██╔════╝██║ ██║██╔══██╗██╔══██╗██║ ██║██╔════╝
# ███████║██████╔╝██║ ███████║██║ ██║███████║██║ ██║█████╗
# ██╔══██║██╔══██╗██║ ██╔══██║██║ ██║██╔══██║╚██╗ ██╔╝██╔══╝
# ██║ ██║██║ ██║╚██████╗██║ ██║██████╔╝██║ ██║ ╚████╔╝ ███████╗
# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝
#--------------------------------------------------------------------
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
BASENAME="$( basename $SCRIPT_DIR)"
source $SCRIPT_DIR/install.conf
echo -ne "
--------------------------------------------------------------------
GRUB Bootloader Installation
--------------------------------------------------------------------
"
errors=0
installGrub() {
if [[ ! -d "/sys/firmware/efi" ]]; then
grub-install --boot-directory=/boot ${DISK}
else
grub-install --efi-directory=/boot ${DISK}
fi
}
until installGrub
do
if [[ $errors -ge 3 ]]; then
echo "Grub installation failed"
exit 1
fi
echo "Grub installation failed, retrying..."
sleep 3
errors=$((errors+1))
done
$SCRIPT_DIR/functions/grub.sh
echo -ne "
--------------------------------------------------------------------
Enabling Login Display Manager
--------------------------------------------------------------------
"
if [ "$DESKTOP_ENV" = "kde" ]; then
systemctl enable sddm.service
echo -e "[Theme]\nCurrent=breeze" > /etc/sddm.conf
echo "/home/$USERNAME/bin/xrandr-display" >> /usr/share/sddm/scripts/Xsetup
elif [ "$DESKTOP_ENV" = "gnome" ]; then
systemctl enable gdm.service
elif [ "$DESKTOP_ENV" = "lxde" ]; then
systemctl enable lxdm.service
elif [ ! "$DESKTOP_ENV" = "none" ]; then
pacman -S --noconfirm --needed lightdm lightdm-gtk-greeter
systemctl enable lightdm.service
fi
echo -ne "
--------------------------------------------------------------------
Enabling Essential Services
--------------------------------------------------------------------
"
cat <<EOF > /etc/systemd/system/fingerprint-pam-post-startup.service
[Unit]
Description=Fingerprint PAM Post Startup
[Service]
ExecStart=/home/$USERNAME/$BASENAME/functions/fingerprint-pam.sh
Type=oneshot
[Install]
WantedBy=multi-user.target
EOF
systemctl enable fingerprint-pam-post-startup.service
systemctl enable cups.service
systemctl disable dhcpcd.service 2>/dev/null
systemctl enable NetworkManager.service
systemctl enable bluetooth.service
if ! systemd-detect-virt &>/dev/null && [ ! "$INSTALL_TYPE" = "minimal" ]; then
systemctl enable libvirtd.service
usermod -aG libvirt "$USERNAME" &>/dev/null
if [ -f /etc/libvirt/qemu/networks/default.xml ]; then
echo "Enabling autostart for default virtualization network"
ln -s /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml &>/dev/null
fi
fi
if hdparm -I "$DISK" | grep TRIM &>/dev/null; then
systemctl enable fstrim.timer
fi
if [ "$HIBERNATE_TYPE" != "hibernate" ]; then
sed -i '/suspendThenHibernate/d' /home/$USERNAME/.config/powermanagementprofilesrc
sed -i '/suspendType=2/d' /home/$USERNAME/.config/powermanagementprofilesrc
fi
sed -i '/ScaleFactor/d' /home/$USERNAME/.config/kdeglobals
echo -ne "
--------------------------------------------------------------------
Cleaning
--------------------------------------------------------------------
"
# Remove no password sudo rights
sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
sed -i 's/^%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers
# Add sudo rights
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
rm -r /root/"$BASENAME"
echo -ne "
--------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗██████╗ █████╗ ██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║██╔══██╗██╔══██╗██║ ██║██╔════
███████║██████╔╝██║ ███████║██║ ██║███████║██║ ██║█████╗
██╔══██║██╔══██╗██║ ██╔══██║██║ ██║██╔══██║╚██╗ ██╔╝██╔══╝
██║ ██║██║ ██║╚██████╗██║ ██║██████╔╝██║ ██║ ╚████╔╝ ███████╗
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝
--------------------------------------------------------------------
Done - Please Eject Install Media and Reboot
--------------------------------------------------------------------
"