Skip to content

Instantly share code, notes, and snippets.

@guysoft
Last active April 17, 2018 09:42
Show Gist options
  • Save guysoft/d7e2ce10d200f0c90b55568398d489fb to your computer and use it in GitHub Desktop.
Save guysoft/d7e2ce10d200f0c90b55568398d489fb to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
sudo apt-get install -y ca-certificates git sudo scren python3
wget https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb
dpkg -i vagrant_2.0.3_x86_64.deb
#Install virtualbox
echo "deb http://download.virtualbox.org/virtualbox/debian stretch contrib" > /etc/apt/sources.list.d/virtualbox.list
wget -q -O- http://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc | apt-key add -
apt-get update; apt-get install -y virtualbox-5.2
/sbin/vboxconfig
# Taken from ZynthianOS README
apt-get install realpath p7zip-full qemu-user-static
#Install jenkins
wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | apt-key add
echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list
apt update ; apt install -y jenkins
# as guysoft:
git clone https://github.com/guysoft/CustomPiOS.git
git clone https://github.com/guysoft/ZynthianOS.git
pushd /home/guysoft/ZynthianOS/src
../../CustomPiOS/src/update-custompios-paths
popd image
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest'
popd
popd
#Install so we can run locally
apt-get install -y gawk util-linux realpath git qemu-user-static p7zip-full unzip zip
ln -s /distro /home/guysoft/ZynthianOS/src
ln -s /home/guysoft/CustomPiOS/src /CustomPiOS
#### Jenkins ###
# Go in to jenkins at os.zynthian.org:8080 and follow setup instructions
# Install on jenkisn plugins:
# 1. parsed console plugin
# 2. colored shell
# Added to jenkins a new console parser, path is at /home/guysoft/ZynthianOS/src/modules/zynthianos/config
###
# Echo to /usr/local/bin/zynthianos
######################################
#!/bin/bash -x
whoami
OCTOPIPATH=/mnt/sdc1/ZynthianOS
for i in `lsof ${OCTOPIPATH}/src/workspace/mount | awk '{print $2}'`; do kill -9 $i; done
rm ${OCTOPIPATH}/src/workspace/*.img
rm ${OCTOPIPATH}/src/workspace/*.zip
pushd ${OCTOPIPATH}
umount ${OCTOPIPATH}/src/workspace/mount/boot
umount ${OCTOPIPATH}/src/workspace/mount
sudo git pull origin devel
#export OCTOPI_OCTOPRINT_REPO_BUILD='http://localhost/git/OctoPrint.git/'
pushd src
/CustomPiOS/nightly_build_scripts/custompios_nightly_build $1
popd
# Umcomment to run vagrant build
# pushd src/vagrant
# ./run_vagrant_build.sh $1
# popd
chmod 777 ${OCTOPIPATH}/src/*
popd
#####################
chmod 755 /usr/local/bin/zynthianos
echo "jenkins ALL=(root) NOPASSWD: /usr/local/bin/zynthianos" > /etc/sudoers.d/zynthianos
echo "jenkins ALL=(root) NOPASSWD: /usr/local/bin/custompios_build_repo" >> /etc/sudoers.d/zynthianos
systemctl restart sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment