LibreELEC build script
The below script will build LibreELEC from source.
build-libreelec.sh
#!/bin/bash buildDIR='/mnt/public/LibreELEC.tv' httpDIR='/var/www/html' builds="master libreelec-11.0" GITURL="https://github.com/LibreELEC/LibreELEC.tv.git" ###################################################################################### scriptName=$(basename -- "$0") for pid in $(pidof -x ${scriptName}); do if [ $pid != $$ ]; then echo "[$(date)] : $scriptName : Process is already running with PID $pid" exit 1 fi done ###################################################################################### if [ "${LOGNAME}" != "matt" ]; then echo "[$(date)] : $scriptName : Process must be ran by the 'matt' user." exit 1 fi ###################################################################################### cd ${buildDIR}/ for BUILD in ${builds} do if [ -d ${buildDIR}/${BUILD}/.git ]; then OLDGITID=`git --git-dir=${buildDIR}/${BUILD}/.git show-ref |grep "refs/remotes/origin/${BUILD}" |awk '{print $1}' |cut -c -7` else OLDGITID='new-install' fi NEWGITID=`git ls-remote --heads ${GITURL} |grep "refs/heads/${BUILD}" |awk '{ print $1 }' |cut -c -7` if [ -z ${NEWGITID} ]; then break fi #NEWGITID='' echo "" echo "Building LibreELEC" echo "--------------------------------------------------------------------------" echo "" echo "Branch: ${BUILD}" echo "Remote Ref ID: ${NEWGITID}" echo "Local Ref ID: ${OLDGITID}" if [ "${OLDGITID}" != "${NEWGITID}" ]; then if [ -d ${buildDIR}/${BUILD}/ ]; then cd ${buildDIR}/${BUILD}/ git pull else git clone ${GITURL} ${buildDIR}/${BUILD}/ fi cd ${buildDIR}/${BUILD}/ pwd PROJECT=RPi ARCH=arm DEVICE=RPi4 make image echo "" if [ "${BUILD}" = "master" ]; then echo "--------------------------------------------------------------------------" echo "" ssh [email protected] rm -f /storage/.update/*.img.gz rsync -a ${buildDIR}/${BUILD}/target/*img.gz [email protected]:/storage/.update/ echo "" fi buildID=`git log --pretty="%h" |head -1 |cut -c -7` if [ -f ${buildDIR}/${BUILD}/target/*img.gz ]; then rm -f ${buildDIR}/${BUILD}/target/*kernel ${buildDIR}/${BUILD}/target/*system \ ${buildDIR}/${BUILD}/target/*tar ${buildDIR}/${BUILD}/target/*tar.sha256 sudo mkdir -p ${httpDIR}/${BUILD}/ cd ${httpDIR}/${BUILD}/; ls -tp . | grep -v '/$' | tail -n +5 | xargs -I {} rm -- {} sudo rsync -a ${buildDIR}/${BUILD}/target/*img.gz ${httpDIR}/${BUILD}/ rm ${buildDIR}/${BUILD}/target/* fi else echo "" echo "No Update for branch ${BUILD} found, skipping..." echo "" fi done echo "--------------------------------------------------------------------------" echo "Done!" echo ""