1
|
#!/bin/bash
|
2
|
|
3
|
if [ "$EUID" -ne 0 ]
|
4
|
then echo "Please run as root!"
|
5
|
exit
|
6
|
fi
|
7
|
|
8
|
echo 'Prepare system'
|
9
|
|
10
|
if [ -n "`which apt-get`" ]; then
|
11
|
|
12
|
V=$(uname -r | awk -F. '{print $1*100+$2}')
|
13
|
if [ $V -lt 41 ]; then
|
14
|
echo "Please, install kernel ...."
|
15
|
exit 1
|
16
|
fi
|
17
|
apt-get update
|
18
|
apt-get -y upgrade
|
19
|
apt-get dist-upgrade
|
20
|
apt-get -y install \
|
21
|
build-essential \
|
22
|
patchutils \
|
23
|
libproc-processtable-perl \
|
24
|
linux-headers-$(uname -r) \
|
25
|
git
|
26
|
systemctl disable apt-daily.service
|
27
|
systemctl disable apt-daily.timer
|
28
|
rm -rf /usr/src/media_build /usr/src/media /usr/src/dvb-firmwares.tar.bz2
|
29
|
cd /usr/src
|
30
|
git clone --depth=1 https://github.com/tbsdtv/media_build.git
|
31
|
git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media
|
32
|
|
33
|
|
34
|
elif [ -n "`which yum`" ]; then
|
35
|
yum -y update
|
36
|
yum -y upgrade
|
37
|
yum -y group install "Development Tools"
|
38
|
yum -y install epel-release
|
39
|
yum -y install \
|
40
|
perl-core \
|
41
|
perl-Proc-ProcessTable \
|
42
|
perl-Digest-SHA \
|
43
|
kernel-headers \
|
44
|
kernel-devel \
|
45
|
elfutils-libelf-devel
|
46
|
rm -rf /usr/src/media_build /usr/src/media /usr/src/dvb-firmwares.tar.bz2
|
47
|
cd /usr/src
|
48
|
git clone --depth=1 https://github.com/tbsdtv/media_build.git
|
49
|
git clone --depth=1 https://github.com/tbsdtv/linux_media.git -b latest ./media
|
50
|
sed -i '/vm_fault_t;/d' /usr/src/media_build/v4l/compat.h
|
51
|
sed -i '/add v4.20_access_ok.patch/d' /usr/src/media_build/backports/backports.txt
|
52
|
|
53
|
fi
|
54
|
|
55
|
rm -rf /lib/modules/$(uname -r)/extra
|
56
|
rm -rf /lib/modules/$(uname -r)/kernel/drivers/media
|
57
|
rm -rf /lib/modules/$(uname -r)/kernel/drivers/staging/media
|
58
|
|
59
|
curl -L https://github.com/tbsdtv/media_build/releases/download/latest/dvb-firmwares.tar.bz2 | \
|
60
|
tar -jxf - -C /lib/firmware/
|
61
|
|
62
|
|
63
|
cd /usr/src/media_build
|
64
|
make dir DIR=../media && \
|
65
|
make allyesconfig && \
|
66
|
make -j4 && \
|
67
|
make install && \
|
68
|
echo 'Done! Please reboot the server'
|
69
|
|