source: ipk/make-ipk @ 12265

Last change on this file since 12265 was 12265, checked in by obi, 9 years ago

fix

  • Property svn:executable set to *
File size: 12.6 KB
Line 
1#!/bin/sh
2HOMEDIR=`pwd`
3TMP=.tmp
4NEXT_LIST=.tmp2
5
6GROUP=$1
7SVNUSER=$2
8SVNPASS=$3
9SVNURL=$4
10MAKETYPE=$5
11CPUTYPE=$6
12SWTYPE=$7
13
14if [ ! -e "$HOMEDIR"/.firstrun ]; then
15        echo "[make-ipk] first run remove old ipkg-build and ipkg-make-index links"
16        sudo rm /bin/ipkg-build
17        sudo rm /sbin/ipkg-build
18        sudo rm /bin/ipkg-make-index
19        sudo rm /sbin/ipkg-make-index
20        touch "$HOMEDIR"/.firstrun
21fi
22
23if [ `which ipkg-build | wc -l` -eq 0 ]; then
24        sudo ln -s $HOMEDIR/ipkg-utils-050831/ipkg-build /bin
25fi
26if [ `which ipkg-make-index | wc -l` -eq 0 ]; then
27        sudo ln -s $HOMEDIR/ipkg-utils-050831/ipkg-make-index /bin
28fi
29if [ `which gzip | wc -l` -eq 0 ]; then
30        echo "[make-ipk] install gzip"
31        echo "[make-ipk] apt-get install gzip"
32        exit
33elif [ `which python2.6 | wc -l` -eq 0 ]; then
34        echo "[make-ipk] install python2.6 | search python2.6_2.6.1-1_i386.deb"
35        exit
36elif [ `which wput | wc -l` -eq 0 ]; then
37        echo "[make-ipk] install wput v0.6.2"
38        echo "[make-ipk] apt-get install wput"
39        exit
40fi
41
42if [ "$MAKETYPE" = "online" ];then
43        WPUTCHECK=`wput --version | tr " " "\n" | tail -n1 | sed 's/\.//' | sed 's/\.//'`
44        echo WPUTCHECK $WPUTCHECK
45        if [ "$WPUTCHECK" -gt "061" ]; then
46                echo "[make-ipk] wput0.6.2 ok"
47        else
48                echo "[make-ipk] install wput0.6.2"
49                echo "[make-ipk] cd /src"
50                echo "[make-ipk] wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/wput-0.6.2.tar.gz"
51                echo "[make-ipk] tar -zxvf wput-0.6.2.tar.gz"
52                echo "[make-ipk] cd wput-0.6.2"
53                echo "[make-ipk] ./configure"
54                echo "[make-ipk] make"
55                echo "[make-ipk] make install"
56                exit
57        fi
58fi
59
60if [ $# -ne 7 ]; then
61        echo "|---------------------------------------------------------------------------------------------|"
62        echo "|                                                                                             |"
63        echo "| IPK Make Script                                                                             |"
64        echo "|                                                                                             |"
65        echo '| use ./make-ipk <group> <svnuser> <svnpass> <svnurl> <maketype> <cputype> <swtype>           |'
66        echo "|                                                                                             |"
67        echo "| for group <dev|update|secret|atemio>                                                        |"
68        echo "| for svnuser <your>                                                                          |"
69        echo "| for svnpass <your>                                                                          |"
70        echo "| for svnurl <your>                                                                           |"
71        echo "| for maketype <online|offline|onlinebeta>                                                    |"
72        echo "| for cputype <sh4|mipsel|feeds>                                                              |"
73        echo "| for swtype <enigma2|neutrino|titan>                                                         |"
74        echo "|                                                                                             |"
75        echo "|---------------------------------------------------------------------------------------------|"
76        echo "|                                                                            v2.1@dev-team    |"
77        echo "|---------------------------------------------------------------------------------------------|"
78        exit 1
79fi
80
81if [ $GROUP = "dev" ] || [ $GROUP = "update" ] || [ $GROUP = "secret" ] || [ $GROUP = "atemio" ];then
82        echo "[make-ipk] group=$GROUP"
83else
84        echo "[make-ipk] group <dev|update|secret|atemio>"
85        exit 1
86fi
87
88if [ $MAKETYPE = "online" ] || [ $MAKETYPE = "offline" ] || [ $MAKETYPE = "onlinebeta" ];then
89        echo "[make-ipk] maketype=$MAKETYPE"
90else
91        echo "[make-ipk] maketype <online|offline|onlinebeta>"
92        exit 1
93fi
94
95if [ $CPUTYPE = "sh4" ] || [ $CPUTYPE = "mipsel" ] || [ $CPUTYPE = "feeds" ];then
96        echo "[make-ipk] cputype=$CPUTYPE"
97else
98        echo "[make-ipk] cputype <sh4|mipsel|feeds>"
99        exit 1
100fi
101
102if [ $SWTYPE = "enigma2" ] || [ $SWTYPE = "neutrino" ] || [ $SWTYPE = "titan" ];then
103        echo "[make-ipk] swtype=$SWTYPE"
104else
105        echo "[make-ipk] swtype <enigma2|neutrino|titan>"
106        exit 1
107fi
108
109rm -rf "$HOMEDIR"/BUILD
110rm -rf "$HOMEDIR"/BUILDRELEASE
111
112rm -rf "$HOMEDIR"/preview
113rm -rf "$HOMEDIR"/config
114rm -rf "$HOMEDIR"/scripts
115
116mkdir -p "$HOMEDIR"/BUILD
117mkdir -p "$HOMEDIR"/BUILDRELEASE
118
119svn co --username $SVNUSER --password $SVNPASS http://"$SVNURL"/svn/image/scripts $HOMEDIR/scripts
120svn co --username $SVNUSER --password $SVNPASS http://"$SVNURL"/svn/image/config $HOMEDIR/config
121
122. ./config/make-config
123
124if [ $GROUP = "dev" ];then
125        WWWMAIN="beta"
126elif [ $GROUP = "secret" ]; then
127        WWWMAIN="ipk"
128elif [ $GROUP = "atemio" ]; then
129        WWWMAIN="atemio"
130else
131        WWWMAIN="public"
132fi
133
134WWWPUBLIC="ipk"
135
136ls -1 "$HOMEDIR"/source > aaf-flashbeta.txt
137ls -1 "$HOMEDIR"/source."$CPUTYPE" >> aaf-flashbeta.txt
138
139LIST_LINE=`cat aaf-flashbeta.txt`
140if [ $GROUP = "secret" ]; then
141        ALLOWED=`cat "$HOMEDIR"/trustlist_secret_"$CPUTYPE"_"$SWTYPE"`
142elif [ $GROUP = "atemio" ]; then
143        ALLOWED=`cat "$HOMEDIR"/trustlist_atemio_"$CPUTYPE"_"$SWTYPE"`
144else
145        ALLOWED=`cat "$HOMEDIR"/trustlist_allowed_"$CPUTYPE"_"$SWTYPE"`
146fi
147
148if [ $CPUTYPE != "feeds" ];then
149        for DIR in $ALLOWED; do
150                echo cp "$DIR"_*
151                cp -a "$HOMEDIR"/source/"$DIR"_* "$HOMEDIR"/BUILD
152        done
153fi
154
155for DIR in $ALLOWED; do
156        echo cp "$DIR"_*
157        cp -a "$HOMEDIR"/source."$CPUTYPE"/"$DIR"_* "$HOMEDIR"/BUILD
158done
159
160if [ $GROUP = "atemio" ] && [ $SVNUSER = "aafsvn" ];then
161        cp -a /home/atemio/flashimg/BUILD/titan/var/usr/local/share/titan/plugins/mc/* "$HOMEDIR"/BUILD/titanplayers_mc/var/usr/local/share/titan/plugins/mc
162        cp -a /home/atemio/flashimg/BUILD/titan/var/usr/local/share/titan/plugins/networkbrowser/* "$HOMEDIR"/BUILD/titannetwork_networkbrowser/var/usr/local/share/titan/plugins/networkbrowser
163        rm -rf "$HOMEDIR"/BUILD/browsers_elektro*
164        rm -rf "$HOMEDIR"/BUILD/browsers_picasa*
165        rm -rf "$HOMEDIR"/BUILD/browsers_werbezapper*
166        rm -rf "$HOMEDIR"/BUILD/browsers_zaphistorybrowser*
167fi
168
169if [ $CPUTYPE = "mipsel" ];then
170        rm -r "$HOMEDIR"/BUILD/*/CONTROL/pre*
171        sed -i 's/sh4/mipsel/g' "$HOMEDIR"/BUILD/*/CONTROL/control
172fi
173
174cp -a "$HOMEDIR"/bootvideos "$HOMEDIR"/BUILDRELEASE/boot
175cd "$HOMEDIR"/BUILD     
176
177# titan work start
178rm -rf browsers_picasa
179rm -rf browsers_elektro_1_0
180rm -rf browsers_werbezapper_1_0
181rm -rf browsers_zaphistorybrowser_1_2
182rm -rf swapnetwork_webif_1.0
183rm -rf swapnetwork_wlan_300
184# titan work done
185
186ls -1 "$HOMEDIR"/BUILD > $NEXT_LIST
187
188LIST=`cat $NEXT_LIST`
189echo LIST: $LIST
190
191rm -rf `find "$HOMEDIR"/BUILD -type d -name "*.svn"`
192sed -i "s/Package: enigma2-plugin-/Package: $SWTYPE-plugin-/g" "$HOMEDIR"/BUILD/*/CONTROL/control
193
194echo "[make-ipk] set executable Folder rights 755 to CONTROL bin sbin emu"
195chmod -R 755 `find "$HOMEDIR"/BUILD -type d -name "CONTROL"` > /dev/null 2>&1
196chmod -R 755 `find "$HOMEDIR"/BUILD -type d -name "bin"` > /dev/null 2>&1
197chmod -R 755 `find "$HOMEDIR"/BUILD -type d -name "sbin"` > /dev/null 2>&1     
198chmod -R 755 `find "$HOMEDIR"/BUILD -type d -name "emu"` > /dev/null 2>&1
199
200###################  SHRINK PYTHON FILES  #########################
201
202"$HOMEDIR"/scripts/kf-pyshrink.sh ./ "$HOMEDIR"/BUILD "$PYTHONVER" "$SKIPPEDSHRINK"
203
204###
205#cd $HOMEDIR
206echo make py var
207ls -R -1 "$HOMEDIR"/BUILD | grep "/" | sed 's/.$//' > tmp.txt
208LINE=`cat tmp.txt`
209for DIR in $LINE; do
210        cd $HOMEDIR
211        cd $DIR
212        echo "[make-ipk] dir $DIR"
213        ls -1 *.py > "$HOMEDIR"/pylist.tmp
214        PYLINE=`cat "$HOMEDIR"/pylist.tmp`
215        for RPY in $PYLINE; do
216                python2.6 -OO "$HOMEDIR"/scripts/mkpyc.py $RPY
217                PYO=`echo "$RPY" | sed "s/.py$/.pyo/"`
218                PYC=`echo "$RPY" | sed "s/.py$/.pyc/"`
219                if [ $CPUTYPE = "sh4" ];then
220                        mv $PYO $PYC
221                elif [ $CPUTYPE = "mipsel" ];then
222                        mv $PYC $PYO
223                fi
224                if [ $? -ne 0 ]; then
225                        echo "[make-ipk] Fehler beim kompilieren $RPY"
226                fi
227        done
228done
229cd $HOMEDIR
230###
231rm "$HOMEDIR"/pylist.tmp
232rm -rf `find "$HOMEDIR"/BUILD -type f -name "*.py" -print`
233if [ $CPUTYPE = "sh4" ];then
234        rm -rf `find "$HOMEDIR"/BUILD -type f -name "*.pyo" -print`
235elif [ $CPUTYPE = "mipsel" ];then
236        rm -rf `find "$HOMEDIR"/BUILD -type f -name "*.pyc" -print`
237fi
238rm -rf "$HOMEDIR"/preview
239mkdir "$HOMEDIR"/preview
240
241###################  SHRINK PNG FILES  #########################
242
243PNGFILES=`find "$HOMEDIR"/BUILD -type f -name "*.png" -print`
244
245for DIR in $PNGFILES; do
246        echo "[make-ipk] PNG: $DIR"
247        /usr/bin/advpng -4 -z $DIR #> /dev/null 2>&1
248#       /usr/bin/advpng -4 -z $DIR #> /dev/null 2>&1
249done
250
251###################  STRIPPED ALL FILES  #########################
252if [ $CPUTYPE = "sh4" ];then
253        FILEALL=`find "$HOMEDIR"/BUILD -name "*" -print`
254
255        if ( test -f ../flashimg/BUILDGIT/checkout_"$STM"/tdt/tufsbox/devkit/sh4/bin/sh4-linux-strip ); then
256                echo ""
257                echo "[make-ipk] Files strippen"
258                echo ""
259                for FILE in $FILEALL
260                do
261                        echo $FILE | grep ".ko" >/dev/null 2>&1
262                        if [ $? -eq 0 ]; then param="--strip-unneeded --remove-section=.comment"; else param="-s --remove-section=.comment"; fi
263                        ../flashimg/BUILDGIT/checkout_"$STM"/tdt/tufsbox/devkit/sh4/bin/sh4-linux-strip $param $FILE > /dev/null 2>&1
264                        if [ $? -eq 0 ]; then
265                                echo "[make-ipk] Strippe: $FILE"
266                        fi
267                done
268        else
269                echo ""
270                echo "[make-ipk] Files strippen konnte nicht durchgefuehrt werden, da sh4-linux-strip fehlt."
271        fi
272fi
273
274for DIR in $LIST; do
275        echo "[make-ipk] $DIR"
276        NAME=`cat "$HOMEDIR"/BUILD/"$DIR"/CONTROL/control | grep Package: | tr " " "\n" | tr "-" "\n" | tail -n 1 | cut -d . -f1 | head -n1`
277#       ARCH=`cat "$HOMEDIR"/BUILD/"$DIR"/CONTROL/control | grep Architecture: | tr " " "\n" | tail -n 1`
278#       cp "$HOMEDIR"/BUILD/"$DIR"/preview/prev.png "$HOMEDIR"/preview/enigma2-pluginpreview-"$NAME"_"$ARCH".ipk.png
279        cp "$HOMEDIR"/BUILD/"$DIR"/preview/prev.png "$HOMEDIR"/preview/"$SWTYPE"-pluginpreview-"$NAME".png
280        rm -r "$HOMEDIR"/BUILD/"$DIR"/preview
281done
282
283
284cd "$HOMEDIR"/BUILDRELEASE
285
286for DIR in $LIST; do
287        ipkg-build "$HOMEDIR"/BUILD/"$DIR"
288done
289
290date=`date`
291echo "[make-ipk] make-index"
292rm Packages*
293 
294ipkg-make-index -l Packages.filelist -p Packages -v .
295
296if [ $GROUP = "secret" ]; then
297        echo "Here is the secret AAF-Flash-PlugList" > PlugList
298elif [ $GROUP = "beta" ]; then
299        echo "Here is the beta AAF-Flash-PlugList" > PlugList
300else
301        echo "Here is the public AAF-Flash-PlugList" > PlugList
302fi
303
304echo "" >> PlugList
305cat Packages | grep Filename: | sed "s/Filename: $SWTYPE-plugin-//" | sed "s/.ipk//" | sed "s/_sh4//" | sed "s/_/ V/" >> PlugList
306rm test.txt
307echo "" >> PlugList
308echo "mfg AAF-TEAM @ $date" >> PlugList
309echo "done"
310
311rm .tmp*
312rm tmprc
313
314cd "$HOMEDIR"
315tar czvf Packages.preview.tar.gz ./preview
316
317mv "$HOMEDIR"/Packages.preview.tar.gz "$HOMEDIR"/BUILDRELEASE
318
319cd "$HOMEDIR"/BUILDRELEASE
320
321FULLLIST=`ls -1`
322PACKAGESLIST=`ls -1 Packages*`
323IPKLIST=`ls -1 *.ipk`
324
325if [ $GROUP = "update" ] && [ "$SVNUSER" = "aafsvn" ] && [ $CPUTYPE != "feeds" ];then
326        rm -rf "$HOMEDIR"/BUILDRELEASE-UPDATE/$IPKGCROSS_RELEASE/$CPUTYPE/$SWTYPE
327        mkdir -p "$HOMEDIR"/BUILDRELEASE-UPDATE/$IPKGCROSS_RELEASE/$CPUTYPE/$SWTYPE             
328
329        for file in $FULLLIST; do
330                if [ -e "$file" ]; then
331                        wputcmd="$file "$HOMEDIR"/BUILDRELEASE-UPDATE/$IPKGCROSS_RELEASE/$CPUTYPE/$SWTYPE/$file"
332                        echo "[make-ipk] move: $wputcmd"
333                        mv -f $wputcmd
334                fi
335        done
336elif [ $GROUP = "dev" ] && [ "$SVNUSER" = "aafsvn" ] && [ $CPUTYPE != "feeds" ];then
337        rm -rf "$HOMEDIR"/BUILDRELEASE-BETA/$IPKGCROSS_BETA/$CPUTYPE/$SWTYPE
338        mkdir -p "$HOMEDIR"/BUILDRELEASE-BETA/$IPKGCROSS_BETA/$CPUTYPE/$SWTYPE         
339       
340        for file in $FULLLIST; do
341                if [ -e "$file" ]; then
342                        wputcmd="$file "$HOMEDIR"/BUILDRELEASE-BETA/$IPKGCROSS_BETA/$CPUTYPE/$SWTYPE/$file"
343                        echo "[make-ipk] move: $wputcmd"
344                        mv -f $wputcmd
345                fi
346        done
347elif [ $GROUP = "secret" ] && [ $MAKETYPE = "online" ] && [ $CPUTYPE != "feeds" ];then
348        for ROUND in $PACKAGESLIST; do
349                wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$CPUTYPE/$SWTYPE/$ROUND"
350                echo "[make-ipk] upload: $wputbin $wputcmd"
351                $wputbin $wputcmd
352        done
353        for ROUND in $IPKLIST; do
354                wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$CPUTYPE/$SWTYPE/$ROUND"
355                echo "[make-ipk] upload: $wputbin $wputcmd"
356                $wputbin $wputcmd
357        done
358
359        wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$CPUTYPE/$SWTYPE/PlugList"
360        echo "[make-ipk] upload: $wputbin $wputcmd"
361        $wputbin $wputcmd
362
363        wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$CPUTYPE/$SWTYPE/Packages.preview.tar.gz"
364        echo "[make-ipk] upload: $wputbin $wputcmd"
365        $wputbin $wputcmd
366elif [ $GROUP = "atemio" ] && [ $MAKETYPE = "online" ] && [ $CPUTYPE != "feeds" ];then
367        for ROUND in $PACKAGESLIST; do
368                wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$ROUND"
369                echo "[make-ipk] upload: $wputbin $wputcmd"
370                $wputbin $wputcmd
371        done
372        for ROUND in $IPKLIST; do
373                wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/$ROUND"
374                echo "[make-ipk] upload: $wputbin $wputcmd"
375                $wputbin $wputcmd
376        done
377
378        wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/PlugList"
379        echo "[make-ipk] upload: $wputbin $wputcmd"
380        $wputbin $wputcmd
381
382        wputcmd="$SECRETRELEASEUPDATEURL/$WWWMAIN/Packages.preview.tar.gz"
383        echo "[make-ipk] upload: $wputbin $wputcmd"
384        $wputbin $wputcmd
385fi
386
387echo "[make-ipk] done"
388exit 0
Note: See TracBrowser for help on using the repository browser.