Skip to content

Instantly share code, notes, and snippets.

@Langerz82
Created November 5, 2024 17:45
Show Gist options
  • Save Langerz82/83675a61dd5fd41a1028babb547a1ecc to your computer and use it in GitHub Desktop.
Save Langerz82/83675a61dd5fd41a1028babb547a1ecc to your computer and use it in GitHub Desktop.
EmuELEC - script for obtaining latest libretro cores file.
#!/bin/bash
rm -r source
mkdir -p ./source
for i in `find -type d -maxdepth 1 -mindepth 1`; do
DIRNAME="${i:2}"
DIRNAME="${DIRNAME%/}"
SITE=$(cat ./${DIRNAME}/package.mk | grep PKG_SITE= | cut -d'"' -f2)
[[ -z "${SITE}" ]] && continue
cd source
git clone ${SITE}.git
cd ${SITE##*/}
NEW_HASH=$(git rev-parse HEAD)
[[ -z "${NEW_HASH}" ]] && cd ../.. && continue
BRANCH=$(cat ./${DIRNAME}/package.mk | grep PKG_GIT_CLONE_BRANCH= | cut -d'"' -f2)
[[ -z "${BRANCH}" ]] && BRANCH=master
git checkout ${BRANCH}
echo $(git rev-parse ${BRANCH})
cd ..
wget ${SITE}/archive/${NEW_HASH}.tar.gz
NEW_HASH256=$(sha256sum ${NEW_HASH}.tar.gz | cut -d' ' -f1)
[[ -z "${NEW_HASH256}" ]] && cd .. && continue
cd ..
sed -i "s/PKG_VERSION=.*/PKG_VERSION=\"${NEW_HASH}\"/" ./${DIRNAME}/package.mk
sed -i "s/PKG_SHA256=.*/PKG_SHA256=\"${NEW_HASH256}\"/" ./${DIRNAME}/package.mk
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment