forked from sinfomicien/displaylink-evdi-opensuse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplaylink-installer.sh.opensuse.patch
More file actions
166 lines (152 loc) · 5.34 KB
/
displaylink-installer.sh.opensuse.patch
File metadata and controls
166 lines (152 loc) · 5.34 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
--- displaylink-installer.sh.orig 2016-05-10 12:13:27.000000000 +0200
+++ displaylink-installer.sh 2016-05-17 10:48:23.061600609 +0200
@@ -10,7 +10,15 @@
add_udev_rule()
{
- echo 'ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{bNumInterfaces}=="*5", GROUP="plugdev", MODE="0660"' > /etc/udev/rules.d/99-displaylink.rules
+ local UDevRules='ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{bNumInterfaces}=="*5", GROUP="plugdev", MODE="0660"'
+ if which lsb_release >/dev/null; then
+ local R=$(lsb_release -d -s)
+ local R=${R#\"}
+ if [ -z "${R##openSUSE Tumbleweed*}" ]; then
+ local UDevRules='ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{bNumInterfaces}=="*5", GROUP="users", MODE="0660"'
+ fi
+ fi
+ echo ${UDevRules} > /etc/udev/rules.d/99-displaylink.rules
chmod 0644 /etc/udev/rules.d/99-displaylink.rules
}
@@ -96,9 +104,25 @@
chmod 0644 /etc/init/displaylink.conf
}
+get_systemd_service_file()
+{
+ if which lsb_release >/dev/null; then
+ local R=$(lsb_release -d -s)
+ local R=${R#\"}
+ if [ -z "${R##openSUSE Tumbleweed*}" ]; then
+ echo "/etc/systemd/system/displaylink.service"
+ return
+ fi
+ fi
+
+ echo "/lib/systemd/system/displaylink.service"
+ return
+}
+
add_systemd_service()
{
- cat > /lib/systemd/system/displaylink.service <<'EOF'
+ local ServiceFile=$(get_systemd_service_file)
+ cat > ${ServiceFile} <<'EOF'
[Unit]
Description=DisplayLink Manager Service
After=display-manager.service
@@ -116,7 +140,7 @@
EOF
- chmod 0644 /lib/systemd/system/displaylink.service
+ chmod 0644 ${ServiceFile}
systemctl enable displaylink.service
}
@@ -127,8 +151,24 @@
remove_systemd_service()
{
+ local ServiceFile=$(get_systemd_service_file)
systemctl disable displaylink.service
- rm -f /lib/systemd/system/displaylink.service
+ rm -f ${ServiceFile}
+}
+
+get_pm_script()
+{
+ if which lsb_release >/dev/null; then
+ local R=$(lsb_release -d -s)
+ local R=${R#\"}
+ if [ -z "${R##openSUSE Tumbleweed*}" ]; then
+ echo "/usr/lib/systemd/system-sleep/displaylink.sh"
+ return
+ fi
+ fi
+
+ echo "/lib/systemd/system-sleep/displaylink.sh"
+ return
}
add_pm_script()
@@ -197,14 +237,14 @@
ln -s $COREDIR/displaylink.sh /etc/pm/sleep.d/displaylink.sh
elif [ "$1" = "systemd" ]
then
- ln -s $COREDIR/displaylink.sh /lib/systemd/system-sleep/displaylink.sh
+ ln -s $COREDIR/displaylink.sh $(get_pm_script)
fi
}
remove_pm_scripts()
{
rm -f /etc/pm/sleep.d/displaylink.sh
- rm -f /lib/systemd/system-sleep/displaylink.sh
+ rm -f $(get_pm_script)
}
cleanup()
@@ -342,7 +382,17 @@
version_lt "$KVER" "$KVER_MIN" && missing_requirement "Kernel version $KVER is too old. At least $KVER_MIN is required"
# Linux headers
- [ ! -f "/lib/modules/$KVER/build/Kconfig" ] && missing_requirement "Linux headers for running kernel, $KVER"
+ if which lsb_release >/dev/null; then
+ local R=$(lsb_release -d -s)
+ local R=${R#\"}
+ if [ -z "${R##openSUSE Tumbleweed*}" ]; then
+ [ ! -f "/lib/modules/$KVER/build/Makefile" ] && missing_requirement "Linux headers for running kernel, $KVER"
+ else
+ [ ! -f "/lib/modules/$KVER/build/Kconfig" ] && missing_requirement "Linux headers for running kernel, $KVER"
+ fi
+ else
+ [ ! -f "/lib/modules/$KVER/build/Kconfig" ] && missing_requirement "Linux headers for running kernel, $KVER"
+ fi
}
usage()
@@ -357,19 +407,21 @@
detect_init_daemon()
{
- INIT=$(readlink /proc/1/exe)
- if [ "$INIT" == "/sbin/init" ]; then
- INIT=$(/sbin/init --version)
- fi
-
- [ -z "${INIT##*upstart*}" ] && SYSTEMINITDAEMON="upstart"
- [ -z "${INIT##*systemd*}" ] && SYSTEMINITDAEMON="systemd"
-
if [ -z "$SYSTEMINITDAEMON" ]; then
- echo "ERROR: the installer script is unable to find out how to start DisplayLinkManager service automatically on your system." >&2
- echo "Please set an environment variable SYSTEMINITDAEMON to 'upstart' or 'systemd' before running the installation script to force one of the options." >&2
- echo "Installation terminated." >&2
- exit 1
+ INIT=$(readlink /proc/1/exe)
+ if [ "$INIT" == "/sbin/init" ]; then
+ INIT=$(/sbin/init --version)
+ fi
+
+ [ -z "${INIT##*upstart*}" ] && SYSTEMINITDAEMON="upstart"
+ [ -z "${INIT##*systemd*}" ] && SYSTEMINITDAEMON="systemd"
+
+ if [ -z "$SYSTEMINITDAEMON" ]; then
+ echo "ERROR: the installer script is unable to find out how to start DisplayLinkManager service automatically on your system." >&2
+ echo "Please set an environment variable SYSTEMINITDAEMON to 'upstart' or 'systemd' before running the installation script to force one of the options." >&2
+ echo "Installation terminated." >&2
+ exit 1
+ fi
fi
}
@@ -377,10 +429,14 @@
{
if which lsb_release >/dev/null; then
local R=$(lsb_release -d -s)
+ local R=${R#\"}
echo "Distribution discovered: $R"
[ -z "${R##Ubuntu 14.*}" ] && return
[ -z "${R##Ubuntu 15.*}" ] && return
[ -z "${R##Ubuntu 16.04*}" ] && return
+ if [ -z "${R##openSUSE Tumbleweed*}" ]; then
+ SYSTEMINITDAEMON="systemd"
+ fi
else
echo "WARNING: This is not an officially supported distribution." >&2
echo "Please use DisplayLink Forum for getting help if you find issues." >&2