forked from pharra/linux-surface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
142 lines (114 loc) · 4.76 KB
/
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
142
#!/bin/sh
LX_BASE=""
LX_VERSION=""
if [ -r /etc/os-release ]; then
. /etc/os-release
if [ $ID = arch ]; then
LX_BASE=$ID
elif [ $ID = ubuntu ]; then
LX_BASE=$ID
LX_VERSION=$VERSION_ID
elif [ ! -z "$UBUNTU_CODENAME" ] ; then
LX_BASE="ubuntu"
LX_VERSION=$VERSION_ID
else
LX_BASE=$ID
LX_VERSION=$VERSION
fi
else
echo "Could not identify your distro. Please open script and run commands manually."
exit
fi
SUR_MODEL="$(dmidecode | grep "Product Name" -m 1 | xargs | sed -e 's/Product Name: //g')"
SUR_SKU="$(dmidecode | grep "SKU Number" -m 1 | xargs | sed -e 's/SKU Number: //g')"
echo "\nRunning $LX_BASE version $LX_VERSION on a $SUR_MODEL.\n"
read -rp "Press enter if this is correct, or CTRL-C to cancel." cont;echo
echo "\nContinuing setup...\n"
echo "Coping the config files under root to where they belong...\n"
cp -R root/* /
echo "Making /lib/systemd/system-sleep/hibernate executable...\n"
chmod a+x /lib/systemd/system-sleep/hibernate
read -rp "Do you want to replace suspend with hibernate? (type yes or no) " usehibernate;echo
if [ "$usehibernate" = "yes" ]; then
if [ "$LX_BASE" = "ubuntu" ] && [ 1 -eq "$(echo "${LX_VERSION} >= 17.10" | bc)" ]; then
echo "Using Hibernate instead of Suspend...\n"
ln -sf /lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -sf /lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
else
echo "Using Hibernate instead of Suspend...\n"
ln -sf /usr/lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -sf /usr/lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
fi
else
echo "Not touching Suspend\n"
fi
read -rp "Do you want use the patched libwacom packages? (type yes or no) " uselibwacom;echo
if [ "$uselibwacom" = "yes" ]; then
echo "Installing patched libwacom packages..."
dpkg -i packages/libwacom/*.deb
apt-mark hold libwacom
else
echo "Not touching libwacom"
fi
if [ "$SUR_MODEL" = "Surface Pro 3" ]; then
echo "\nInstalling i915 firmware for Surface Pro 3...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_bxt.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Pro" ]; then
echo "\nInstalling IPTS firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v102.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_kbl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Pro 4" ]; then
echo "\nInstalling IPTS firmware for Surface Pro 4...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v78.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Pro 4...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Pro 2017" ]; then
echo "\nInstalling IPTS firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v102.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_kbl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Laptop" ]; then
echo "\nInstalling IPTS firmware for Surface Laptop...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v79.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Laptop...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Book" ]; then
echo "\nInstalling IPTS firmware for Surface Book...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v76.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Book...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Book 2" ]; then
echo "\nInstalling IPTS firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/intel/ipts
if [ "$SUR_SKU" = "Surface_Book_1793" ]; then
unzip -o firmware/ipts_firmware_v101.zip -d /lib/firmware/intel/ipts/
else
unzip -o firmware/ipts_firmware_v137.zip -d /lib/firmware/intel/ipts/
fi
echo "\nInstalling i915 firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_kbl.zip -d /lib/firmware/i915/
echo "\nInstalling nvidia firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/nvidia/gp108
unzip -o firmware/nvidia_firmware_gp108.zip -d /lib/firmware/nvidia/gp108/
fi
echo "Installing marvell firmware...\n"
mkdir -p /lib/firmware/mrvl/
unzip -o firmware/mrvl_firmware.zip -d /lib/firmware/mrvl/
echo "\nAll done! Please reboot."