forked from nickersk/enigmalight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenigma2-plugin-extensions-enigmalight.bb
163 lines (130 loc) · 4.64 KB
/
enigma2-plugin-extensions-enigmalight.bb
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
DESCRIPTION = "An Ambilight clone for broadcom based linux receivers."
HOMEPAGE = "https://github.com/Dima73/enigmalight"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://README;md5=93285fcad54271879db50c1fbf22d98b"
DEPENDS += "libusb1"
RRECOMMENDS_${PN} = "python-cheetah libusb1 kernel-module-cdc-acm kernel-module-ftdi-sio kernel-module-usbserial kernel-module-ch341 curl"
inherit gitpkgv
SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"
PKGV = "1.0+git${GITPKGV}"
PR = "r10"
SRC_URI = "git://github.com/nickersk/enigmalight.git;protocol=https;branch=4.3"
S = "${WORKDIR}/git"
inherit autotools-brokensep pkgconfig
do_install_append() {
cd ${S}
install -d ${D}${libdir}/enigma2/python/Plugins/Extensions
cp -R ${S}/python/plugin/EnigmaLight ${D}${libdir}/enigma2/python/Plugins/Extensions
install -d ${D}/home/elight-addons
cp -R ${WORKDIR}/git/elight-addons/config_samples ${D}/home/elight-addons
install -d ${D}/home/elight-addons/profiles_empty
cp ${S}/python/plugin/EnigmaLight/profiles/* ${D}/home/elight-addons/profiles_empty
install -d ${D}/home/elight-addons/wifilight
cp -R ${WORKDIR}/git/elight-addons/wifilight ${D}/home/elight-addons/
cp -R ${WORKDIR}/git/elight-addons/config_samples ${D}/home/elight-addons/wifilight
}
FILES_${PN} += "${libdir}/enigma2/python/Plugins/Extensions/EnigmaLight/ \
/home/elight-addons"
pkg_preinst_${PN}() {
#/bin/sh
FILE=/etc/enigmalight.conf
FILE2=/usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/profiles/custom_0.profile
mkdir -p /home/elight-addons > /dev/null
mkdir -p /home/elight-addons/profiles > /dev/null
echo ""
echo "Check if enigmalight is running..."
echo ""
EPID=`pidof enigmalight|head -n1`
if [ ${EPID} ]; then
echo "enigmalight: running with PID ${EPID}, Exit..."
kill -9 ${EPID} 2>/dev/null
else
echo "enigmalight: not running"
fi
rm -rf /usr/bin/enigmalight 2>/dev/null
rm -rf /usr/bin/elighttalk 2>/dev/null
rm -rf /usr/bin/elightprefix 2>/dev/null
echo "Checking for $FILE..."
if [ -f $FILE ]; then
echo "File $FILE exists"
cp -f /etc/enigmalight.conf /home/elight-addons/enigmalight.conf
echo "Backup created in /home/elight-addons"
else
echo "File $FILE does not exist in /etc/"
fi
echo "Create backups from profiles..."
if [ -f $FILE2 ]; then
echo "Profiles found, backup created in /home/elight-addons/profiles"
cp -f /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/profiles/*.profile /home/elight-addons/profiles/
else
echo "No profiles found..."
fi
echo "Checking for an older version of EnigmaLight..."
if [ -d /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight ]
then
rm -rf /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight > /dev/null 2>&1
echo "An older version of EnigmaLight was found and removed"
else
echo "EnigmaLight was not found in the system"
echo "Proceeding to installation..."
fi
}
pkg_postinst_${PN}() {
#!/bin/sh
FILE=/home/elight-addons/enigmalight.conf
FILE2=/home/elight-addons/profiles/custom_0.profile
if [ -f $FILE ];
then
mv /home/elight-addons/enigmalight.conf /etc/enigmalight.conf
echo "- Config enigmalight.conf restored from backup..."
fi
if [ -f $FILE2 ];
then
cd /
rm -rf /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/profiles/*.profile 1>/dev/null
cp -r /home/elight-addons/profiles /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight 1>/dev/null
echo "- Profiles restored from backup..."
else
cd /
mkdir -p /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/profiles/ 1>/dev/null
cp -f /home/elight-addons/profiles_empty/*.profile /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight/profiles/ 1>/dev/null
echo "- Added profiles..."
fi
echo ">>> Configuring EnigmaLight..."
sleep 1
echo
echo
echo "#################### EnigmaLight installed... ####################"
echo
echo " You can now use the Plugin."
echo " Please RESTART Enigma2 to activate the GUI."
echo " don't forget to create a configuration file :)"
echo
echo
echo ">>> For samplefiles look in /home/elight-addons/config_samples <<<"
echo
echo "###################################################################"
echo
}
pkg_postrm_${PN}() {
#!/bin/sh
echo ""
echo "Check if enigmalight is running..."
echo ""
DPID=`pidof enigmalight|head -n1`
if [ ${DPID} ]; then
echo "enigmalight: running with PID ${DPID}, Exit..."
kill -9 ${DPID} 2>/dev/null
else
echo "enigmalight: not running"
fi
echo ""
rm -rf /usr/bin/enigmalight 2>/dev/null
rm -rf /usr/bin/elighttalk 2>/dev/null
rm -rf /usr/bin/elightprefix 2>/dev/null
rm -rf /usr/lib/enigma2/python/Plugins/Extensions/EnigmaLight 2>/dev/null
rm -rf /home/elight-addons 2>/dev/null
echo ""
}
do_populate_sysroot[noexec] = "1"