#!/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 -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 . ../../packages/emulation/$1/package.mk git_clone $PKG_SITE master $PKG_NAME.git if [ -f ../../packages/emulation/$PKG_NAME/package.mk ] ; then # update package.mk RESOLVED_HASH=$(resolve_hash $PKG_NAME.git master) sed -i "s|PKG_VERSION=.*|PKG_VERSION=\"$RESOLVED_HASH\"|g" ../../packages/emulation/$PKG_NAME/package.mk fi fi