File download_binary-addons.sh of Package kodi.binary-addons (Revision 1958c17be96f823753a3f8667cc28e47)

Currently displaying revision 1958c17be96f823753a3f8667cc28e47 , Show latest

81
 
1
#!/bin/bash 
2
3
DOWNLOAD_DIR=build/download
4
VERSION_NAME=master
5
REPO_BINARY_ADDONS=repo-binary-addons-$VERSION_NAME
6
mkdir -p $REPO_BINARY_ADDONS-file
7
mkdir -p $DOWNLOAD_DIR
8
mkdir -p tmp
9
10
curl -L "https://github.com/xbmc/repo-binary-addons/archive/$VERSION_NAME.tar.gz" | tar zxf -
11
if [ ! -x $REPO_BINARY_ADDONS ]; then
12
    exit 1
13
fi
14
15
# Removing disabled binary addons
16
if [ -e $REPO_BINARY_ADDONS-disabled.txt ]; then
17
    for addon in $(awk -F'-' '{print $1}' repo-binary-addons-$VERSION_NAME-disabled.txt); do
18
        echo "Removing disabled addon $addon"
19
        rm -rf $REPO_BINARY_ADDONS/$addon
20
    done
21
fi
22
23
#
24
rm -f spec.packages.in spec.files.in
25
rm -f kodi.binary-addons.spec.packages.inc kodi.binary-addons.spec.files.inc
26
27
JSONCPP_PATCH="pvr.argustv pvr.filmon pvr.hdhomerun pvr.pctv pvr.stalker pvr.sledovanitv.cz"
28
29
for addon in $(ls -1 $REPO_BINARY_ADDONS); do
30
    echo "Downloading $addon"
31
    ADDON=$(cat $REPO_BINARY_ADDONS/$addon/$addon.txt)
32
    IFS=' ' read -a SPLIT_ADDON <<< "$ADDON"
33
    NAME=${SPLIT_ADDON[0]}
34
    URL=${SPLIT_ADDON[1]}
35
    DL_BRANCH=${SPLIT_ADDON[2]}
36
    BRANCH=$(echo ${SPLIT_ADDON[2]} | sed -e 's#^v##')
37
    curl --progress-bar -L "$URL/archive/$DL_BRANCH.tar.gz" -o $DOWNLOAD_DIR/$NAME-$BRANCH.tar.gz   
38
    
39
    mkdir -p $REPO_BINARY_ADDONS-file/$addon
40
    echo "$NAME file://$DOWNLOAD_DIR/$NAME-$BRANCH.tar.gz $BRANCH" > $REPO_BINARY_ADDONS-file/$addon/$addon.txt
41
42
    if [[ $JSONCPP_PATCH =~ (^|[[:space:]])"$NAME"($|[[:space:]]) ]]; then
43
        echo "Patching $addon"
44
        tar -C tmp -xf $DOWNLOAD_DIR/$NAME-$BRANCH.tar.gz 
45
        patch -d tmp/$NAME-$BRANCH -t < FindJsonCpp.cmake.patch
46
        tar -C tmp -zcf $DOWNLOAD_DIR/$NAME-$BRANCH.tar.gz $NAME-$BRANCH
47
    fi
48
49
    cat << EOF >> kodi.binary-addons.spec.packages.inc
50
%package $addon
51
Summary:        Kodi $addon binary addon
52
Group:          Productivity/Multimedia/Video/Players
53
Requires:       kodi = %{version}
54
55
%description $addon
56
Kodi $addon binary addon
57
58
EOF
59
60
    cat << EOF >> kodi.binary-addons.spec.files.inc
61
%files $addon
62
%defattr(-,root,root)
63
%dir %{_libdir}/kodi/addons
64
%dir %{_libdir}/kodi/addons/$addon
65
%dir %{_kodi_addons_dir}/$addon
66
%{_libdir}/kodi/addons/$addon/*
67
%{_kodi_addons_dir}/$addon/*
68
69
EOF
70
71
done
72
73
tar cf kodi.binary-addons.tar $DOWNLOAD_DIR
74
echo "kodi.binary-addons.tar was created"
75
76
tar cjf repo-binary-addons.$VERSION_NAME.tar.bz2 $REPO_BINARY_ADDONS-file
77
echo "repo-binary-addons.$VERSION_NAME.tar.bz2 was created"
78
79
# cleanup
80
rm -rf tmp $(dirname $DOWNLOAD_DIR) $REPO_BINARY_ADDONS $REPO_BINARY_ADDONS-file
81