#!/bin/sh ################################################################################ # This file is part of LibreELEC - https://libreelec.tv # Copyright (C) 2016 Team LibreELEC # # LibreELEC 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 of the License, or # (at your option) any later version. # # LibreELEC 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 LibreELEC. If not, see . ################################################################################ git_clone() { # git_clone https://repo.url branch ./target_dir [githash] echo "[mkpkg] Checking out $1 ..." if [ ! -d "$3" ]; then git clone --recursive "$1" -b $2 "$3" else if [ -d "$3" ] ; then cd "$3" git checkout $2 >/dev/null 2>/dev/null git pull cd .. fi fi if [ ! -z "$4" ] ; then cd "$3" git fetch >/dev/null 2>/dev/null git branch -D $4 >/dev/null 2>/dev/null git checkout $4 >/dev/null 2>/dev/null git checkout -b ref-$4 >/dev/null 2>/dev/null cd .. fi } resolve_hash() { if [ -d "$1" ] ; then cd "$1" git rev-parse --short $2 2>/dev/null fi } if [ -z "$1" ]; then echo "Usage: $0 " exit 0 else addontxt="binary-addons https://github.com/lrusak/repo-binary-addons.git retroplayer" ADDONS=$(echo $addontxt | awk '{print $1}') ADDONREPO=$(echo $addontxt | awk '{print $2}') GIT_HASH=$(echo $addontxt | awk '{print $3}') git_clone $ADDONREPO retroplayer $ADDONS.git $GIT_HASH addon="$ADDONS.git/$1" if [ -n "$(echo $addon | grep game.)" -o -n "$(echo $addon | grep peripheral.)" ]; then ADDON=$(basename $addon) REPO=$(cat $addon/$ADDON.txt | awk '{print $2}') GIT_HASH=$(cat $addon/$ADDON.txt | awk '{print $3}') if ! grep -q all $addon/platforms.txt && ! grep -q linux $addon/platforms.txt && ! grep -q ! $addon/platforms.txt; then continue fi git_clone $REPO master $ADDON.git $GIT_HASH if [ -f ../../packages/mediacenter/kodi-binary-addons/$ADDON/package.mk ] ; then # update package.mk RESOLVED_HASH=$(resolve_hash $ADDON.git $GIT_HASH) sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/mediacenter/kodi-binary-addons/$ADDON/package.mk fi fi fi