Created
April 9, 2017 17:09
-
-
Save CGarces/3b223de4fc6e428d7cda0d1a63ee151c to your computer and use it in GitHub Desktop.
Check if there is newer versions of libreelec packages on github repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "usage: $0 user:password (from github)" | |
exit 1 | |
fi | |
ROOT=/media/hdd/Development/LibreELEC.tv | |
TARGET_ARCH="x" | |
find $ROOT/packages -type f -name "package.mk" | while read line; do | |
. $line | |
if [[ $PKG_URL == "https://github.com/"* ]]; then | |
URL_NOPRO=${PKG_URL:19} | |
OWNER=${URL_NOPRO%%/*} | |
REPO=${URL_NOPRO#$OWNER/} | |
REPO=${REPO%%/*} | |
re='\w{7}' | |
if [[ $PKG_VERSION =~ $re ]] ; then | |
PKG_CURL=$(curl -s -u $1 https://api.github.com/repos/$OWNER/$REPO/git/refs/heads/) | |
(echo $PKG_CURL | grep -Eq '"sha": "'$PKG_VERSION) && export PKG_SATUS="updated" || export PKG_SATUS="outdated" | |
else | |
PKG_CURL=$(curl -s -u $1 https://api.github.com/repos/$OWNER/$REPO/releases/latest ) | |
if [[ $PKG_CURL == *'"message": "Not Found"'* ]]; then | |
PKG_SATUS="Not found" | |
else | |
(echo $PKG_CURL | grep -Eq '"tag_name": "'$PKG_VERSION) && export PKG_SATUS="updated" || export PKG_SATUS="outdated" | |
if [ $PKG_SATUS = "outdated" ]; then | |
(echo $PKG_CURL | grep -Eq '"tag_name": "v'$PKG_VERSION) && export PKG_SATUS="updated" || export PKG_SATUS="outdated" | |
fi | |
fi | |
fi | |
echo $PKG_NAME $PKG_SATUS | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment