forked from OpenELEC/OpenELEC.tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_addon
executable file
·100 lines (82 loc) · 3.74 KB
/
create_addon
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
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue ([email protected])
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. config/options $1
IFS=" "
for i in $PKG_ADDON_REQUIRES; do
REQUIRES_ADDONNAME=`echo $i | cut -f1 -d ":"`
REQUIRES_ADDONVERSION=`echo $i | cut -f2 -d ":"`
REQUIRES="$REQUIRES\n <import addon=\"$REQUIRES_ADDONNAME\" version=\"$REQUIRES_ADDONVERSION\" />"
done
unset IFS
if [ -z "$1" ]; then
echo "usage: $0 package_name"
exit 1
fi
if [ -n $PKG_ARCH -a ! "$PKG_ARCH" = "any" ]; then
echo "$PKG_ARCH" | grep -q "$TARGET_ARCH" || exit 0
echo "$PKG_ARCH" | grep -q "\-$TARGET_ARCH" && exit 0
fi
$SCRIPTS/build $@
printf "%${BUILD_INDENT}c CREATE ADDON $1\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
if [ -f $PKG_DIR/addon ]; then
rm -rf $ADDON_BUILD
$PKG_DIR/addon $@ >&$VERBOSE_OUT
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID
if [ ! -f $ADDON_BUILD/$PKG_ADDON_ID/addon.xml ]; then
cp config/addon/addon.xml $ADDON_BUILD/$PKG_ADDON_ID
$SED -e "s|@PKG_ADDON_ID@|$PKG_ADDON_ID|g" \
-e "s|@PKG_NAME@|$PKG_NAME|g" \
-e "s|@ADDON_VERSION@|$ADDON_VERSION.$PKG_REV|g" \
-e "s|@PKG_ADDON_TYPE@|$PKG_ADDON_TYPE|g" \
-e "s|@REQUIRES@|$REQUIRES|g" \
-e "s|@PKG_SHORTDESC@|$PKG_SHORTDESC|g" \
-e "s|@OS_VERSION@|$OS_VERSION|g" \
-e "s|@PKG_LONGDESC@|$PKG_LONGDESC|g" \
-i $ADDON_BUILD/$PKG_ADDON_ID/addon.xml
fi
if [ -f $PKG_DIR/source/default.py ]; then
cp -R $PKG_DIR/source/* $ADDON_BUILD/$PKG_ADDON_ID
else
echo "*** WARNING: You *probably* need at least $PKG_DIR/source/default.py to make your addon work ***"
fi
if [ -f $PKG_DIR/icon/icon.png ]; then
cp $PKG_DIR/icon/icon.png $ADDON_BUILD/$PKG_ADDON_ID
else
echo "*** WARNING: It's recommended to have a $PKG_DIR/icon/icon.png file ***"
fi
if [ -f $PKG_DIR/changelog.txt ]; then
cp $PKG_DIR/changelog.txt $ADDON_BUILD/$PKG_ADDON_ID
else
echo "*** WARNING: It's recommended to have a $PKG_DIR/changelog.txt file ***"
fi
if [ -d $ADDON_BUILD/mkimage ]; then
$ROOT/$TOOLCHAIN/bin/mksquashfs $ADDON_BUILD/mkimage $ADDON_BUILD/$PKG_ADDON_ID/$1.img -noappend -comp lzma
fi
cd $ADDON_BUILD
echo "*** compressing Addon $PKG_ADDON_ID ... ***"
zip -rq $PKG_ADDON_ID-$ADDON_VERSION.$PKG_REV.zip $PKG_ADDON_ID;
cd -
mkdir -p $TARGET/$ADDONS/$ADDON_VERSION/$PROJECT/$TARGET_ARCH/$PKG_ADDON_ID
cp $ADDON_BUILD/$PKG_ADDON_ID-$ADDON_VERSION.$PKG_REV.zip $TARGET/$ADDONS/$ADDON_VERSION/$PROJECT/$TARGET_ARCH/$PKG_ADDON_ID
cp $PKG_DIR/changelog.txt $TARGET/$ADDONS/$ADDON_VERSION/$PROJECT/$TARGET_ARCH/$PKG_ADDON_ID/changelog-$ADDON_VERSION.$PKG_REV.txt
cp $PKG_DIR/icon/icon.png $TARGET/$ADDONS/$ADDON_VERSION/$PROJECT/$TARGET_ARCH/$PKG_ADDON_ID/icon.png
fi