-
Notifications
You must be signed in to change notification settings - Fork 155
/
update.sh
101 lines (87 loc) · 2.8 KB
/
update.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
#!/usr/bin/env bash
# This script require root privileges
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Parse ARGS
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-c|--compatibility)
echo "Setting compatibility..."
COMPATIBILITY="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
# End args parsing
GRUBOPTIONS="quiet splash acpi_rev_override=1"
# Add graphics drivers PPA
sudo add-apt-repository ppa:graphics-drivers/ppa
# Fix Atheros cards
sudo rm /lib/firmware/ath10k/QCA6174/hw3.0/*
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/board.bin?raw=true
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/board-2.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/board-2.bin?raw=true
sudo wget -O /lib/firmware/ath10k/QCA6174/hw3.0/firmware-4.bin https://github.com/kvalo/ath10k-firmware/blob/master/QCA6174/hw3.0/firmware-4.bin_WLAN.RM.2.0-00180-QCARMSWPZ-1?raw=true
# Select only required packages
installpackages=""
# Packages that will be installed:
# Thermal management stuff and packages
installpackages+="thermald "
installpackages+="tlp "
installpackages+="tlp-rdw "
installpackages+="powertop "
# Streaming and codecs for correct video encoding/play
installpackages+="va-driver-all "
installpackages+="vainfo "
if [ -n "$COMPATIBILITY" ]; then
if [ "$COMPATIBILITY" == "bionicbeaver" ]; then
installpackages+="libva2 "
installpackages+="bbswitch-dkms "
installpackages+="pciutils "
installpackages+="lsb-release "
# Nvidia
installpackages+="nvidia-driver-396 "
installpackages+="nvidia-prime "
GRUBOPTIONS="quiet splash acpi_rev_override=1 nouveau.modeset=0"
else
installpackages+="libva1 "
# Nvidia
installpackages+="nvidia-390 "
installpackages+="nvidia-prime "
fi
else
installpackages+="libva1 "
# Nvidia
installpackages+="nvidia-390 "
installpackages+="nvidia-prime "
fi
installpackages+="gstreamer1.0-libav "
installpackages+="gstreamer1.0-vaapi "
# Useful music/video player with large set of codecs
installpackages+="vlc "
# refresh packages list
apt update
# install required packages
echo "Install required packages..."
for i in $installpackages; do
sudo apt-get install -y $i
done
# set intel GPU
sudo prime-select intel 2> /dev/null
# install GPU service
cp gpuoff.service /lib/systemd/system/gpuoff.service
sudo systemctl enable gpuoff
# update grub
sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"$GRUBOPTIONS\"/" /etc/default/grub
sudo sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$GRUBOPTIONS\"/" /etc/default/grub
sudo update-grub