-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmake-kodi.sh
392 lines (347 loc) · 20.4 KB
/
make-kodi.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#!/bin/bash
# KODI Standalone autostart install script for CentOS (versions 8)
# Version 2.6 for x86_64
#
# More info:
# [PL/ENG] https://www.marcinwilk.eu/projects/htpc-on-centos-8-linux-with-kodi/
#
# Feel free to contact me: marcin@marcinwilk.eu
# www.marcinwilk.eu
# Marcin Wilk
#
# License:
# 1. You use it at your own risk. Author is not responsible for any damage made with that script.
# 2. Any changes of scripts must be shared with author with authorization to implement them and share.
#
# Changelog:
# v 2.6.1 - 12.11.2020
# HDMI/CEC file access for kodi is now fixed with every restart, so large system updates should not brake that.
# v 2.6 - 09.10.2020
# Removed double lines.
# v 2.5 - 30.09.2020
# Thanks to Thebes Knossos there are some fixes in the script - thank You!
# Raven repo can be disabled in configuration (reported conflicts with VLC).
# rapidjson package do not need compiling from sources anymore.
# I prepared SRPM of phonon that works and is phonon-qt5 compatible! (Oryginal srpm stopped - don't know why - rebuilding, maybe some cmake changes or dunno).
# I made script little less "loud" when taking actions (except when compiling from sources).
# Added libcec srpm for CEC/HDMI support on compiled from source version of Kodi.
# Fixed some errors in commands.
# v 2.4 - 12.09.2020
# Add HDMI/CEC fix (tested with Pulse-Eight CEC module on USB/HDMI for TV-remote control of KODI).
# v 2.3 - 19.07.2020
# Fixed some typos, finally releasing on the web.
# v 2.2 - 07.07.2020
# Add license info.
# Fixed typos, and checked on core CentOS install. Ready to release on web.
# v 2.1 - 03.07.2020
# Added Avahi with it's daemon enabled.
# v 2.0 - 26.06.2020
# Another approach using flatpak instead of compiling many libraries and kodi itself from sources.
# v 1.0 - 23.06.2020
# First release, tested on CentOS 8
user=$( whoami )
# User name that run the script. No reasons to change it.
# Used only for testing.
el5=$( cat /etc/redhat-release | grep "release 5" )
el6=$( cat /etc/redhat-release | grep "release 6" )
el7=$( cat /etc/redhat-release | grep "release 7" )
el8=$( cat /etc/redhat-release | grep "release 8" )
#Configuration
# Installing (compiling) from sources - if yes then it will try to use not tested sources and repos
# to compile of missing libraries and kodi then.
# I strongly do not reommend changing that option. Most likely will not work!
srcins=no
# Plex Media Server install.
# You can set this to yes so Plex Media Server will be installed. You may try it for fun.
plex=no
# Raven repo can be disabled here. According to Thebes there is conflict with VLC.
raven=yes
echo -e "Welcome in \e[93mKODI Standalone autostart install script \e[39mfor CentOS8."
echo ""
echo "This script will install additional software and will make changes"
echo "in system config files to autologin and start KODI after reboot."
echo ""
echo "Changes in the system:"
echo "1. Checking user that runs script and OS version."
echo "2. Disabling SELinux, add RPMFusion and EPEL repos, adding kodi user, installing some X11 packages, configuring firewall."
echo "3. IF CONFIGURED: Installing Plex, installing libraries, and compiling from sources some of them and kodi."
echo "4. Installing flatpak and kodi flatpak package."
echo "5. Configuring kodi user profile config, making OS to start with kodi user into X11 automatically."
echo ""
echo "If kodi crash, xterm terminall will be started, so You may restart it with command:"
echo "flatpak run tv.kodi.Kodi"
echo "or if you configured script to install from sources:"
echo "kodi"
echo ""
sleep 10
if [ $user != root ]
then
echo "You must be root. Mission aborted!"
echo "You are trying to start this script as: $user"
exit 0
else
echo "You are root, this is good for me..."
fi
echo "------------------- ---------- -------- ----- -"
if [ -n "$el5" ]
then
echo "Too old CentOS version. Pleasu upgrade to CentOS 8."
echo "Mission aborted!."
exit 0
fi
if [ -n "$el6" ]
then
echo "Too old CentOS version. Pleasu upgrade to CentOS 8."
echo "Mission aborted!."
exit 0
fi
if [ -n "$el7" ]
then
echo "Too old CentOS version. Pleasu upgrade to CentOS 8."
echo "Mission aborted!."
exit 0
fi
echo "This process will take some time, please be patient..."
if [ ! -f /etc/redhat-release ]
then
echo "Your Linux distribution isn't supported by this script."
echo "Mission aborted!"
exit 0
fi
# Disabling SELinux problems
echo "Disabling SELinux in /etc/selinux/config and installing base software - please wait."
sed --in-place=.bak 's/^SELINUX\=enforcing/SELINUX\=permissive/g' /etc/selinux/config
dnf -y -q update
dnf -y -q install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y -q install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
dnf config-manager --enable PowerTools
dnf -y -q groupinstall "base-x"
dnf -y -q install wget gdm matchbox-window-manager rsync xorg-x11-xinit-session xterm glibc-langpack-en flatpak avahi oclock xload ImageMagick langpacks-en glibc-all-langpacks
echo "Enabling avahi, creating kodi user."
systemctl enable avahi-daemon
# Adding kodi user to some groups used for hardware acceleration
useradd kodi
usermod kodi -a -G audio
usermod kodi -a -G video
echo "Firewall setup."
# Setting up firewall
firewall-cmd --zone=public --add-port=32469/tcp --permanent
firewall-cmd --zone=public --add-port=32414/udp --permanent
firewall-cmd --zone=public --add-port=32413/udp --permanent
firewall-cmd --zone=public --add-port=32412/udp --permanent
firewall-cmd --zone=public --add-port=32410/udp --permanent
firewall-cmd --zone=public --add-port=32400/tcp --permanent
firewall-cmd --zone=public --add-port=12374/udp --permanent
firewall-cmd --zone=public --add-port=9090/tcp --permanent
firewall-cmd --zone=public --add-port=9090/udp --permanent
firewall-cmd --zone=public --add-port=9777/udp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=8324/tcp --permanent
firewall-cmd --zone=public --add-port=5353/udp --permanent
firewall-cmd --zone=public --add-port=3005/tcp --permanent
firewall-cmd --zone=public --add-port=1900/tcp --permanent
firewall-cmd --zone=public --add-port=1900/udp --permanent
firewall-cmd --zone=public --add-port=1414/tcp --permanent
firewall-cmd --zone=public --add-port=1414/udp --permanent
firewall-cmd --zone=public --add-port=1131/tcp --permanent
firewall-cmd --zone=public --add-port=1131/udp --permanent
firewall-cmd --zone=public --add-port=1308/tcp --permanent
firewall-cmd --zone=public --add-port=1308/udp --permanent
firewall-cmd --zone=public --add-port=1084/tcp --permanent
firewall-cmd --zone=public --add-port=1084/udp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
setsebool httpd_can_network_connect on -P
# Installing Plex Media Server
if [ $plex = yes ]
then
echo "Installing Plex."
touch /etc/yum.repos.d/plex.repo
echo "[Plex]" >> /etc/yum.repos.d/plex.repo
echo "name=Plex" >> /etc/yum.repos.d/plex.repo
echo "baseurl=https://downloads.plex.tv/repo/rpm/$basearch/" >> /etc/yum.repos.d/plex.repo
echo "enabled=1" >> /etc/yum.repos.d/plex.repo
echo "gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key" >> /etc/yum.repos.d/plex.repo
echo "gpgcheck=1" >> /etc/yum.repos.d/plex.repo
echo "" >> /etc/yum.repos.d/plex.repo
dnf -y -q install plexmediaserver
dnf -y reinstall glibc-common
systemctl enable plexmediaserver
systemctl start plexmediaserver
else
echo "Skipping Plex Media Server installation."
fi
echo "Installing KODI!"
if [ $srcins = no ]
then
echo "Configuring flatpak for kodi install."
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak -y install flathub tv.kodi.Kodi
sudo -u kodi flatpak override --user --share=network --share=ipc --socket=x11 --socket=wayland --socket=fallback-x11 --socket=pulseaudio --socket=system-bus --socket=session-bus --device=all --device=dri --device=shm --allow=devel --allow=multiarch --allow=bluetooth --allow=canbus --filesystem=host tv.kodi.Kodi
else
cd /root
# Adding Raven REPO for QT install
if [ $raven = yes ]
then
echo "Installing KODI from source - this will take VERY long time, be patient!"
touch /etc/yum.repos.d/raven.repo
echo "[raven]" >> /etc/yum.repos.d/raven.repo
echo "name=Raven packages" >> /etc/yum.repos.d/raven.repo
echo "baseurl=https://pkgs.dyn.su/el8/base/x86_64/" >> /etc/yum.repos.d/raven.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/raven.repo
echo "enabled=1 " >> /etc/yum.repos.d/raven.repo
echo "" >> /etc/yum.repos.d/raven.repo
echo "[raven-extras]" >> /etc/yum.repos.d/raven.repo
echo "name=Raven extra packages" >> /etc/yum.repos.d/raven.repo
echo "baseurl=https://pkgs.dyn.su/el8/extras/x86_64/" >> /etc/yum.repos.d/raven.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/raven.repo
echo "enabled=0" >> /etc/yum.repos.d/raven.repo
echo "" >> /etc/yum.repos.d/raven.repo
echo "[raven-multimedia]" >> /etc/yum.repos.d/raven.repo
echo "name=Raven multimedia packages" >> /etc/yum.repos.d/raven.repo
echo "baseurl=https://pkgs.dyn.su/el8/multimedia/x86_64/" >> /etc/yum.repos.d/raven.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/raven.repo
echo "enabled=0" >> /etc/yum.repos.d/raven.repo
echo "" >> /etc/yum.repos.d/raven.repo
dnf config-manager --set-enabled raven
# dnf config-manager --set-enabled raven-extras
# dnf config-manager --set-enabled raven-multimedia
dnf -y install qt-4.8.7 qt-devel-4.8.7
else
echo "Raven's repo disabled."
fi
echo "Because source install method is unstable (link to source files can disappear, newr lib version may brake things, there will be more details on the screen about the proccess."
sleep 5
dnf config-manager --set-enabled epel-testing
dnf -y -q install unixODBC-devel bzip2-devel cmake curl dbus-devel fmt-devel fontconfig-devel freetype-devel fribidi-devel gawk gcc gcc-c++ gettext gettext-devel giflib-devel gperf gtest java-11-openjdk-headless jre lcms2-devel libao-devel libass-devel libcap-devel libcdio-devel libcurl-devel libidn2-devel libjpeg-turbo-devel libmicrohttpd-devel libmpc-devel libnfs-devel libplist-devel libsmbclient-devel libtool libtool-ltdl-devel libudev-devel libunistring libunistring-devel libusb-devel libuuid-devel libva-devel libvdpau-devel libxml2-devel libXmu-devel libXrandr-devel libxslt-devel libXt-devel lirc-devel lzo-devel make mariadb-devel mesa-libEGL-devel mesa-libGL-devel mesa-libGLU-devel mesa-libGLw-devel mesa-libOSMesa-devel nasm openssl-devel openssl-libs patch pcre-devel pulseaudio-libs-devel python3-devel python3-pillow sqlite-devel swig taglib-devel tinyxml-devel trousers-devel uuid-devel yasm zlib-devel qt5-qtdeclarative-devel
dnf -y -q install gtk2-devel libXv-devel libXcursor-devel cups-devel firebird-devel freetds-devel libmng-devel libpq-devel tk-devel python2-numpy python2-tkinter python3-numpy python3-qt5 python3-sphinx python3-sphinx_rtd_theme python3-tkinter libimagequant-devel libwebp-devel openjpeg2-devel pixman-devel python2-devel tre-devel wavpack-devel yajl-devel libsamplerate-devel libtiff-devel libvorbis-devel mesa-libgbm-devel ninja-build libmad-devel libmms-devel libmodplug-devel libmpcdec-devel libmpeg2-devel libogg-devel librtmp-devel libXinerama-devel libXtst-devel libcrystalhd-devel libdca-devel fontpackages-devel glew-devel jasper-devel lame-devel faad2-devel flac-devel enca-devel e2fsprogs-devel boost-devel afpfs-ng-devel qt5-devel extra-cmake-modules kde-filesystem kf5-rpm-macros gtest-devel libpng12 lockdev-devel ncurses-devel platform-devel ant doxygen texlive-latex libevent-devel git make gcc glib2-devel gcc-c++ groff ghostscript alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel avahi-devel bluez-libs-devel
dnf -y -q install kf5-rpm-macros libxml2-devel libxcb-devel pulseaudio-libs-devel glib2-devel qt5-qtbase-devel qt5-qttools-devel kde-filesystem
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/f/fstrcmp-0.7.D001-11.fc30.src.rpm
rpmbuild --rebuild fstrcmp-0.7.D001-11.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/fstrcmp-0.7.D001-11.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/fstrcmp-devel-0.7.D001-11.el8.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/l/libbluray-1.1.0-1.fc30.src.rpm
rpmbuild --rebuild libbluray-1.1.0-1.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/libbluray-1.1.0-1.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/libbluray-devel-1.1.0-1.el8.x86_64.rpm
wget http://vault.centos.org/8.1.1911/AppStream/Source/SPackages/libpng12-1.2.57-5.el8.src.rpm
rpmbuild --rebuild libpng12-1.2.57-5.el8.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/libpng12-devel-1.2.57-5.el8.x86_64.rpm
dnf -y install valgrind rapidjson rapidjson-devel
# wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/r/rapidjson-1.1.0-9.fc30.src.rpm
# rpmbuild --rebuild rapidjson-1.1.0-9.fc30.src.rpm
# dnf -y install /root/rpmbuild/RPMS/noarch/rapidjson-devel-1.1.0-9.el8.noarch.rpm /root/rpmbuild/RPMS/noarch/rapidjson-doc-1.1.0-9.el8.noarch.rpm
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/f/flatbuffers-1.10.0-4.fc30.src.rpm
rpmbuild --rebuild flatbuffers-1.10.0-4.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/flatbuffers-1.10.0-4.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/flatbuffers-devel-1.10.0-4.el8.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/a/a52dec-0.7.4-35.fc30.src.rpm
rpmbuild --rebuild a52dec-0.7.4-35.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/a52dec-0.7.4-35.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/liba52-0.7.4-35.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/liba52-devel-0.7.4-35.el8.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/c/crossguid-0-0.11.20160908gitfef89a4.fc30.src.rpm
rpmbuild --rebuild crossguid-0-0.11.20160908gitfef89a4.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/crossguid-0-0.11.20160908gitfef89a4.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/crossguid-devel-0-0.11.20160908gitfef89a4.el8.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/p/python-olefile-0.46-2.fc30.src.rpm
rpmbuild --rebuild python-olefile-0.46-2.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/noarch/python2-olefile-0.46-2.el8.noarch.rpm /root/rpmbuild/RPMS/noarch/python3-olefile-0.46-2.el8.noarch.rpm
dnf -y install python3-cffi
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/30/Everything/SRPMS/Packages/p/python-pillow-5.4.1-4.fc30.src.rpm
rpmbuild --rebuild python-pillow-5.4.1-4.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/python2-pillow-5.4.1-4.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/python2-pillow-devel-5.4.1-4.el8.x86_64.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/python2-pillow-tk-5.4.1-4.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/python3-pillow-5.4.1-4.el8.x86_64.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/python3-pillow-devel-5.4.1-4.el8.x86_64.rpm /root/rpmbuild/RPMS/noarch/python3-pillow-doc-5.4.1-4.el8.noarch.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/python3-pillow-tk-5.4.1-4.el8.x86_64.rpm
# automoc needs qt4-devel
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/a/automoc-1.0-0.34.rc3.fc30.src.rpm
rpmbuild --rebuild automoc-1.0-0.34.rc3.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/automoc-1.0-0.34.rc3.el8.x86_64.rpm
# wget https://dl.fedoraproject.org/pub/fedora/linux/updates/30/Everything/SRPMS/Packages/p/phonon-4.10.2-3.fc30.src.rpm
# rpmbuild --rebuild phonon-4.10.2-3.fc30.src.rpm
# dnf -y install /root/rpmbuild/RPMS/x86_64/phonon-4.10.2-3.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/phonon-4.10.2-3.el8.x86_64.rpm phonon-devel-4.10.2-3.el8.x86_64.rpm
# !!! Something is broken and rebuilding from srpm STOPPED working (few weeks ago there was no problem with that),
# !!! so i "fixed/broken" that by editing spec files, and removing everything related to qt5, prepared own srpm that will be downloaded here and installed.
# !!! Also that should be "compatible" with -qt5 rpm from epel repo. This thime i backed up all rebuilt rpms in case they broke something again somewhere.
wget https://www.marcinwilk.eu/SRPMS/phonon-4.10.2-3.el8.src.rpm
rpmbuild --rebuild phonon-4.10.2-3.el8.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/phonon-4.10.2-3.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/phonon-devel-4.10.2-3.el8.x86_64.rpm
dnf -y install phonon-qt5 phonon-qt5-devel
wget https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/30/Everything/source/tree/Packages/s/shairplay-0.9.0-12.20160101gitce80e00.fc30.src.rpm
rpmbuild --rebuild shairplay-0.9.0-12.20160101gitce80e00.fc30.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/shairplay-0.9.0-12.20160101gitce80e00.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/shairplay-libs-0.9.0-12.20160101gitce80e00.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/shairplay-devel-0.9.0-12.20160101gitce80e00.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/airtv-0.9.0-12.20160101gitce80e00.el8.x86_64.rpm
# Added libcec and libcec-devel package for CEC support.
wget https://www.marcinwilk.eu/SRPMS/libcec-4.0.4-4.el8.src.rpm
rpmbuild --rebuild libcec-4.0.4-4.el8.src.rpm
dnf -y install /root/rpmbuild/RPMS/x86_64/libcec-4.0.4-4.el8.x86_64.rpm /root/rpmbuild/RPMS/x86_64/libcec-devel-4.0.4-4.el8.x86_64.rpm
cd $HOME
git clone https://github.com/xbmc/xbmc kodi
cd $HOME/kodi
make -C tools/depends/target/crossguid PREFIX=/usr/local
make -C tools/depends/target/flatbuffers PREFIX=/usr/local
make -C tools/depends/target/libfmt PREFIX=/usr/local
make -C tools/depends/target/libspdlog PREFIX=/usr/local
make -C tools/depends/target/wayland-protocols PREFIX=/usr/local
make -C tools/depends/target/waylandpp PREFIX=/usr/local
mkdir $HOME/kodi-build
cd $HOME/kodi-build
cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DX11_RENDER_SYSTEM=gl
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)
sudo make install
cd $HOME/kodi
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons PREFIX=/usr/local
fi
echo "Configuring login manager (GDM), adding lines for autologin kodi user."
autologin=$( cat /etc/gdm/custom.conf | grep AutomaticLoginEnable=true )
loginname=$( cat /etc/gdm/custom.conf | grep AutomaticLogin=kodi )
if [ -n "$autologin" ]
then
echo "File is already configured for automatic login."
echo "Current automatic login config:"
grep AutomaticLoginEnable /etc/gdm/custom.conf
echo ""
echo "Check the GDM file /etc/gdm/custom.conf."
else
echo "Adding line to /etc/gdm/custom.conf for automatic login."
sed -i '/daemon]/aAutomaticLoginEnable=true' /etc/gdm/custom.conf
fi
if [ -n "$loginname" ]
then
echo "File is already configured for user to autologin."
echo "Check the GDM file /etc/gdm/custom.conf."
else
echo "Adding line to /etc/gdm/custom.conf for login user name."
sed -i '/AutomaticLoginEnable=true/aAutomaticLogin=kodi' /etc/gdm/custom.conf
fi
echo "Adding line to /etc/gdm/custom.conf for default X Session in EL7."
echo "And creating session file for specific user in /var/lib/AccountsService/users/kodi."
sed -i '/AutomaticLogin=kodi/aDefaultSession=xinit-compat.desktop' /etc/gdm/custom.conf
touch /var/lib/AccountsService/users/kodi
chmod 644 /var/lib/AccountsService/users/kodi
echo "[User]" >> /var/lib/AccountsService/users/kodi
echo "Language=" >> /var/lib/AccountsService/users/kodi
echo "XSession=xinit-compat" >> /var/lib/AccountsService/users/kodi
echo "SystemAccount=false" >> /var/lib/AccountsService/users/kodi
echo "Setting up graphical boot."
systemctl set-default graphical.target
echo "xset s off ; xset -dpms" > /home/kodi/.xsession
echo "exec matchbox-window-manager &" >> /home/kodi/.xsession
if [ $srcins = yes ]
then
echo "kodi" >> /home/kodi/.xsession
echo "" >> /home/kodi/.xsession
else
echo "flatpak run tv.kodi.Kodi" >> /home/kodi/.xsession
echo "" >> /home/kodi/.xsession
fi
echo "xterm" >> /home/kodi/.xsession
ln -s /home/kodi/.xsession /home/kodi/.xinitrc
chown kodi:kodi /home/kodi/.xsession
chmod 777 /home/kodi/.xsession
echo "[Desktop]" > /home/kodi/.dmrc
echo "Session=xinit-compat" >> /home/kodi/.dmrc
echo "Language=$LANG" >> /home/kodi/.dmrc
chown kodi:kodi /home/kodi/.dmrc
chmod 766 /home/kodi/.dmrc
echo "Adopting HDMI/CEC fix (tested with Pulse-Eight CEC module)."
if [ -f /dev/ttyACM0 ]
then
chmod a+rw /dev/ttyACM0
echo 'chmod a+rw /dev/ttyACM0' >> /etc/rc.local
fi
echo "You may now restart this computer to experience Kodi."