mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
update_emulation: new script to update packages/emulation/*
This commit is contained in:
parent
91639134df
commit
68e6a54522
69
tools/mkpkg/update_emulation
Executable file
69
tools/mkpkg/update_emulation
Executable file
@ -0,0 +1,69 @@
|
||||
#!/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 <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
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
|
||||
for package in $(find ../../packages/emulation/* -name package.mk); do
|
||||
. $package
|
||||
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
|
||||
done
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user