-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSurfaceLinuxSetupWizardArch.sh
103 lines (99 loc) · 4.93 KB
/
SurfaceLinuxSetupWizardArch.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
#!/usr/bin/env bash
# Linux-Surface-Wizard is licensed under MIT license, see https://github.com/SlippingGitty/Linux-Surface-Wizard/blob/main/LICENSE for more info
# __ _ _ ___ ___ __ ______ _ _ __ _ _ ___ __ __ ___ _____ _ _ ___ _ _ _ ___ __ ___ __
# /' _/| || | _ \ __/ \ / _/ __| | | | | \| | || \ \_/ / /' _/| __|_ _| || | _,\ | | | || |_ |/ \| _ \ _\
# `._`.| \/ | v / _| /\ | \_| _| | |_| | | ' | \/ |> , < `._`.| _| | | | \/ | v_/ | 'V' || |/ /| /\ | v / v |
# |___/ \__/|_|_\_||_||_|\__/___| |___|_|_|\__|\__//_/ \_\ |___/|___| |_| \__/|_| !_/ \_!|_|___|_||_|_|_\__/
#
#
# VERSION 2021.05.03.02
#INITIAL INFO PROMPT
y=0
if yay -V;
then
y=1
else
y=2
fi
if dialog --title "Linux-Surface Setup Wizard" --infobox "Welcome. \n\nIf this is your first time running this script, please select option 1 before attempting to do anything else. \n\nAfterwards, select a function by typing the number that co-relates with the specific action you want to do." 10 70;
then
sleep 5
else
echo "You may need to install dialog with 'pacman -S dialog'. Do this, then rerun this script"
sleep 2
exit
fi
#DIALOG/NCURSES
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Pacman Linux-Surface Setup Wizard"
TITLE="Installer"
MENU="Select an option:"
while [ "$CHOICE -ne 4" ]; do
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
#OPTIONS NAMES
OPTIONS=(1 "Import keys and add repo"
2 "Install kernel modules"
3 "Install touchscreen support"
4 "Enable secure boot"
5 "Show GRUB menu"
6 "Update GRUB and Finish")
#OPTIONS IN EXECUTION
clear
case $CHOICE in
1)
if cat /etc/pacman.conf | grep -F "[linux-surface]";
then
dialog --title "Linux-Surface Setup Wizard" --infobox 'You already have the "linux-surface" repo initialized' 10 70;
sleep 5
else
su -c 'curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| sudo pacman-key --add - && pacman-key --finger 56C464BAAC421453 && pacman-key --lsign-key 56C464BAAC421453 && cp /etc/pacman.conf /etc/pacman.conf.save && echo "[linux-surface]" >> /etc/pacman.conf && echo "Server = https://pkg.surfacelinux.com/arch/" >> /etc/pacman.conf && pacman -Syu'
fi
# Signs the repos needed to install the surface-linux packages
;;
2)
su -c "pacman -S linux-surface linux-surface-headers surface-ath10k-firmware-override"
# Installs the surface-linux modules and headers
;;
3)
su -c "pacman -S iptsd && systemctl enable iptsd"
if ((y == 1));
then
yay -S libwacom-surface
else
dialog --title "Linux-Surface Setup Wizard" --infobox 'You do not have yay installed on your system. \n\nPlease install it using AUR. \n\nDependencies are listed below the package in AUR, and install these before installing yay. \n\n Otherwise, you will not be able to install libwacom-surface or mokutil (required by linux-surface-secureboot-mok)'10 70;
sleep 5
fi
# Installs and enables touchscreen support
;;
4)
if ((y == 1));
then
yay -S mokutil
su -c "pacman -S linux-surface-secureboot-mok"
else
dialog --title "Linux-Surface Setup Wizard" --infobox 'You do not have yay installed on your system. \n\nPlease install it using AUR. \n\nDependencies are listed below the package in AUR, and install these before installing yay. \n\n Otherwise, you will not be able to install libwacom-surface or mokutil (required by linux-surface-secureboot-mok)'10 70;
sleep 5
fi
# Installs and enables secure boot
;;
5)
dialog --title "Surface-Linux Setup Wizard" --infobox "This is going to remove GRUB_TIMEOUT=0 from your /etc/default/grub file. \n\nGRUB is a bootloader, and that's like, very important! \n\nYou can manually add this back yourself if you wish to hide it again." 10 70;sleep 5
clear
su -c "cp /etc/default/grub /etc/default/grub.bak && sed -i 's/\<GRUB_TIMEOUT=0\>//g' /etc/default/grub && grub-mkconfig -o /boot/grub/grub.cfg"
# Removes the timeout for GRUB and shows the menu
;;
6)
su -c "grub-mkconfig -o /boot/grub/grub.cfg"
exit
;;
esac
done