Created
September 13, 2020 13:01
-
-
Save Paulchen-Panther/ff958ce8676f9633d48b828a8eecf302 to your computer and use it in GitHub Desktop.
Script for compiling Hyperion.NG inside a Docker container on LibreElec (RPi)
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/sh | |
# Script for compiling Hyperion.NG inside a Docker container on LibreElec (RPi) | |
# Fixed variables | |
DOCKER="docker" | |
# Set welcome message | |
echo '*******************************************************************************' | |
echo 'This script will compile Hyperion.NG inside a Docker container on LibreELEC' | |
echo 'Created by Paulchen-Panther - hyperion-project.org - the official Hyperion source.' | |
echo '*******************************************************************************' | |
# Find out if we are on LibreELEC | |
OS_LIBREELEC=`grep -m1 -c LibreELEC /etc/issue` | |
if [ $OS_LIBREELEC -ne 1 ]; then | |
echo '---> Critical Error: We are not on LibreELEC -> abort' | |
exit 1 | |
fi | |
# Find out if we are on an Raspberry Pi | |
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835\|BCM2836\|BCM2837\|BCM2711' /proc/cpuinfo` | |
if [ $CPU_RPI -ne 1 ]; then | |
echo '---> Critical Error: We are not on an Raspberry Pi -> abort' | |
exit 1 | |
fi | |
# check if docker is available | |
if ! $DOCKER ps >/dev/null; then | |
echo "Critical Error: Please install the docker service add-on using the kodi interface" | |
exit 1 | |
fi | |
# cleanup deploy folder | |
rm -f /storage/deploy/* >/dev/null 2>&1 | |
# Build docker image | |
$DOCKER build -t hyperion:libreelec . -f-<< EOF | |
FROM ghcr.io/hyperion-project/rpi-raspbian:stretch | |
WORKDIR /root | |
RUN git clone --recursive https://github.com/hyperion-project/hyperion.ng.git hyperion \ | |
&& cd hyperion \ | |
&& mkdir build \ | |
&& cd build \ | |
&& cmake -DCMAKE_BUILD_TYPE=Release .. \ | |
&& make -j \$(nproc) package | |
EOF | |
# Copy package from docker container | |
echo '---> Copying compiled package into deploy folder ...' | |
$DOCKER run --rm -v "/storage/deploy:/deploy" hyperion:libreelec /bin/bash -c "cp /root/hyperion/build/*.tar.gz /deploy/ 2>/dev/null" | |
echo "*******************************************************************************" | |
echo "Compiling finished!" | |
echo "The compiled package is available at the deploy folder: '/storage/deploy'" | |
echo "*******************************************************************************" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment