Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brainiarc7/6aa532550a5bf57cc9ee to your computer and use it in GitHub Desktop.
Save Brainiarc7/6aa532550a5bf57cc9ee to your computer and use it in GitHub Desktop.
Automated script for OpenELRC builds on a VPC instance
#!/bin/bash
# Outer loop for build and image
while :
do
# Inner loop for git pull
while :
do
GIT=$(git pull)
echo $GIT
if [ "$GIT" = 'Already up-to-date.' ]
then
echo 'Wait for 30 minutes for another pull at Git'
sleep 1800
else
echo 'Start the build and post build processes'
break
fi
done
# Delete old build
rm -rf build.OpenELEC-RPi.arm-devel
# Make release
PROJECT=RPi ARCH=arm make release
# Set env vars for release package name
TARBALL=$(ls -t ~/OpenELEC.tv/target | head -1)
BUILD=$(echo $TARBALL | sed 's/.tar.bz2//')
RELEASE=$(echo $BUILD | sed 's/.*-r/r/')
# Copy release build to web server
sudo cp ~/OpenELEC.tv/target/$TARBALL /var/www
cp ~/OpenELEC.tv/target/$TARBALL /mnt/box/OpenELEC
# Unpack release
cd ~/OpenELEC.tv/releases
tar -xvf ~/OpenELEC.tv/target/$TARBALL
# Wipe virtual SD
sudo dd if=/dev/zero of=/dev/sdc bs=1M
# Move into release working directory
cd ~/OpenELEC.tv/releases/$BUILD
#Run script to create SD card
sudo ../create_sdcard /dev/sdc
# Make an image file
sudo dd if=/dev/sdc of=../$RELEASE.img bs=1M count=910
# Compress release file
zip ../$RELEASE.img.zip ../$RELEASE.img
# Remove image file
sudo rm ../$RELEASE.img
# Copy zipped image to web server
sudo cp ../$RELEASE.img.zip /var/www
cp ../$RELEASE.img.zip /media/lin/OpenELEC
# Go back to OpenELEC directory
cd ~/OpenELEC.tv
# Loop back to start of script
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment