-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path7_build_lirc.sh
executable file
·105 lines (87 loc) · 3.04 KB
/
7_build_lirc.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
#!/bin/bash
# Script for install patched lirc-0.10.1. Get repeats again. In version Ubuntu-14.04, use lirc 0.9.0 from the repository only.
# If your system has two devices /dev/lirc0 and /dev/lirc1 (for example, a built-in IR-receiver in the card card)
# then you can add a rule to /etc/udev/rules.d/99-lirc-symlinks.rules:
# KERNELS=="serial_ir.0", SUBSYSTEM=="lirc", DRIVERS=="serial_ir", ATTRS{driver_override}=="(null)", SYMLINK+="lirc_serial"
# and use "/dev/lirc_serial" in your *.lircd.conf.
# You also need to disable the uinput service by command:
# systemctl mask lircd-uinput.service
# and then reboot the system.
PKG="lirc-0.10.1"
DIR="lirc_build"
CONF="/etc/lirc"
DH="dh-systemd_12.1.1~nd20.04+1_all.deb"
release=$(lsb_release -a 2>/dev/null | grep -i release | awk ' { print $2 } ')
dpkg -r liblirc-dev liblirc0 liblircclient-dev lirc lirc-doc lirc-x
if [[ "$release" = "22.04" ]]; then
pip install --upgrade websockets
pip uninstall PyCrypto
pip install -U PyCryptodome
apt install -y dh-exec dh-python doxygen expect libftdi1-dev libsystemd-dev libudev-dev libusb-dev man2html-base portaudio19-dev python3-dev python3-setuptools socat setserial xsltproc
wget https://neurodebian.g-node.org/pool/main/d/debhelper/$DH
dpkg -i $DH
rm -f $DH
else
apt install -y dh-exec dh-python dh-systemd doxygen expect libftdi1-dev libsystemd-dev libudev-dev libusb-dev man2html-base portaudio19-dev python3-dev python3-setuptools socat setserial xsltproc
fi
if [ -d $DIR ]; then
rm -fr $DIR
fi
mkdir $DIR
cd $DIR
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/lirc/0.10.1-6/lirc_0.10.1.orig.tar.gz
tar -xvf lirc_0.10.1.orig.tar.gz
rm -f lirc_0.10.1.orig.tar.gz
cd ..
cp -v patches/lirc_0.10.1-6.patch $DIR/$PKG
cp -v patches/python38_client_py.patch $DIR/$PKG
cp -v patches/lirc-python3.10.patch $DIR/$PKG
cd $DIR/$PKG
if [[ "$release" = "20.04" ]]; then
patch -p1 < lirc_0.10.1-6.patch
patch -p1 < python38_client_py.patch
fi
if [[ "$release" = "22.04" ]]; then
patch -p1 < lirc-python3.10.patch
fi
rm -f *.patch
chmod 755 debian/install
chmod 755 debian/pbuilder-test
chmod 755 debian/lirc-old2new
chmod 755 debian/postrm
cd ..
tar -cvzf lirc_0.10.1-6.orig.tar.gz $PKG
cd $PKG
dpkg-buildpackage -b -d -uc -us
cd ..
if [[ "$release" = "16.04" ]]; then
# Hack. We need to resolve dependencies.
echo "*** 16.04 ***"
dpkg -i *.deb
sleep 1
dpkg -i *.deb
else
dpkg -i *.deb
fi
cd ..
cp -rfv pre/lirc/lircd.conf.d /etc
cp -rfv pre/lirc/lirc_options.conf.example /etc
cp -fv pre/99-lirc-symlinks.rules /etc/udev/rules.d
if [ -f $CONF/lircd.conf.d/devinput.lircd.conf ]; then
mv -b $CONF/lircd.conf.d/devinput.lircd.conf /etc/lirc/lircd.conf.d/devinput.lircd.conf.dist
fi
if [ -f $CONF/irexec.lircrc ]; then
mv -b $CONF/irexec.lircrc $CONF/irexec.lircrc.dist
fi
if [ -f $CONF/irexec.lircrc ];then
rm -f $CONF/irexec.lircrc
fi
systemctl enable lircd.socket
systemctl start lircd.socket
systemctl enable lircmd.service
systemctl start lircmd.service
systemctl mask lircd-uinput.service
systemctl daemon-reload
systemctl start lircd
systemctl restart lircd
reboot