forked from nobody9/openpliPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_openpliPC.sh
executable file
·209 lines (168 loc) · 4.79 KB
/
build_openpliPC.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
#!/bin/bash
# where install Enigma2 tree
INSTALL_E2DIR="/usr/local/e2"
BACKUP_E2="etc/enigma2 etc/tuxbox/*.xml etc/tuxbox/nim_sockets share/enigma2/xine.conf"
# ----------------------------------------------------------------------
DO_BACKUP=0
DO_RESTORE=0
DO_XINE=1
DO_CONFIGURE=1
DO_PARALLEL=1
DO_MAKEINSTALL=1
function e2_backup {
echo "-----------------------------"
echo "BACKUP E2 CONFIG"
echo "-----------------------------"
tar -C $INSTALL_E2DIR -v -c -z -f e2backup.tgz $BACKUP_E2
}
function e2_restore {
echo "-----------------------------"
echo "RESTORE OLD E2 CONFIG"
echo "-----------------------------"
if [ -f e2backup.tgz ]; then
sudo tar -C $INSTALL_E2DIR -v -x -z -f e2backup.tgz
fi
}
function usage {
echo "Usage:"
echo " -b : backup E2 conf file before re-compile"
echo " -r : restore E2 conf file after re-compile"
echo " -x : don't compile xine-lib (compile only enigma2)"
echo " -nc: don't start configure/autoconf"
echo " -py: parallel compile (y threads) e.g. -p2"
echo " -ni: only execute make and no make install"
echo " -h : this help"
echo ""
echo "common usage:"
echo " $0 -b -r : make E2 backup, compile E2, restore E2 conf files"
echo ""
}
while [ "$1" != "" ]; do
case $1 in
-b ) DO_BACKUP=1
shift
;;
-r ) DO_RESTORE=1
shift
;;
-x ) DO_XINE=0
shift
;;
-nc ) DO_CONFIGURE=0
shift
;;
-ni ) DO_MAKEINSTALL=0
shift
;;
-p* ) if [ "`expr substr "$1" 3 3`" = "" ]
then
echo "Number threads is missing"
usage
exit
else
DO_PARALLEL=`expr substr "$1" 3 3`
fi
shift
;;
-h ) usage
exit
;;
* ) echo "Unknown parameter $1"
usage
exit
;;
esac
done
if [ "$DO_BACKUP" -eq "1" ]; then
e2_backup
fi
# ----------------------------------------------------------------------
if [ "$DO_XINE" -eq "1" ]; then
# Build and install xine-lib:
PKG="xine-lib"
cd $PKG
if [ "$DO_CONFIGURE" -eq "1" ]; then
echo "-----------------------------------------"
echo "configuring OpenPliPC $PKG"
echo "-----------------------------------------"
./autogen.sh --disable-xinerama --disable-musepack --prefix=/usr
fi
if [ "$DO_MAKEINSTALL" -eq "0" ]; then
echo "-----------------------------------------"
echo "build OpenPliPC $PKG, please wait..."
echo "-----------------------------------------"
make -j"$DO_PARALLEL"
if [ ! $? -eq 0 ]
then
echo ""
echo "An error occured while building xine-lib"
exit
fi
else
echo "--------------------------------------"
echo "installing OpenPliPC $PKG"
echo "--------------------------------------"
sudo make -j"$DO_PARALLEL" install
if [ ! $? -eq 0 ]
then
echo ""
echo "An error occured while building xine-lib"
exit
fi
fi
cd ..
fi
# ----------------------------------------------------------------------
# Build and install enigma2:
PKG="enigma2"
cd $PKG
if [ "$DO_CONFIGURE" -eq "1" ]; then
echo "--------------------------------------"
echo "configuring OpenPliPC $PKG"
echo "--------------------------------------"
autoreconf -i
./configure --prefix=$INSTALL_E2DIR --with-xlib --with-debug
fi
echo "--------------------------------------"
echo "build OpenPliPC $PKG, please wait..."
echo "--------------------------------------"
if [ "$DO_MAKEINSTALL" -eq "0" ]; then
make -j"$DO_PARALLEL"
if [ ! $? -eq 0 ]
then
echo ""
echo "An error occured while building OpenPliPC"
exit
fi
else
echo "--------------------------------------"
echo "installing OpenPliPC $PKG in $INSTALL_E2DIR"
echo "--------------------------------------"
sudo make -j"$DO_PARALLEL" install
if [ ! $? -eq 0 ]
then
echo ""
echo "An error occured while building OpenPliPC"
exit
fi
fi
cd ..
echo "--------------------------------------"
echo "final step: installing E2 conf files"
echo "--------------------------------------"
# strip binary
sudo strip $INSTALL_E2DIR/bin/enigma2
# removing pre-compiled py files
sudo find $INSTALL_E2DIR/lib/enigma2/python/ -name "*.py[oc]" -exec rm {} \;
# copying needed files
sudo mkdir -p $INSTALL_E2DIR/etc/enigma2
sudo mkdir -p $INSTALL_E2DIR/etc/tuxbox
sudo cp share/fonts/* $INSTALL_E2DIR/share/fonts
sudo cp -rf etc/* $INSTALL_E2DIR/etc
sudo cp enigma2/data/black.mvi $INSTALL_E2DIR/etc/tuxbox/logo.mvi
ln -sf $INSTALL_E2DIR/bin/enigma2 ./e2bin
if [ "$DO_RESTORE" -eq "1" ]; then
e2_restore
fi
echo ""
echo "**********************<END>**********************"