#!/bin/bash export VERSION=1.2 export REV=21-04-2017 set -e set +x export SRC_DIR=$(cd $(dirname $0) && pwd) ESC=$(echo -en \\0033) BOLD="$ESC[1m" OFF="$ESC[0m" bold() { echo "$BOLD$1$OFF" } fail() { bold "$@" exit 1 } full() { # full automation clear echo -e "\e[031m${BOLD}Minera auto_install v:$VERSION rev:$REV $OFF" echo -e "\e[031m${BOLD}Full installation$OFF" sudo apt-get update sudo apt-get install git postfix -y sleep 3 init deploy sudo rm -r -f /var/www/minera/minera-bin/src/libblkmaker miners } init() { # Update and install prerequise clear echo -e "\e[031m${BOLD}Minera auto_install v:$VERSION rev:$REV $OFF" echo -e "\e[033m${BOLD}Raspberry Update:$OFF" sudo apt-get update sudo apt-get upgrade -y echo -e "\e[033m${BOLD}Install prerequises:$OFF" sudo apt-get install lighttpd php5-cgi dosfstools -y #sudo lighty-enable-mod fastcgi #sudo lighty-enable-mod fastcgi-php sleep 1 if [ -f "/usr/sbin/rpi-clone" ]; then echo -e "\e[039m${BOLD}Install rpi-clone: Already installed$OFF" else echo -e "\e[033m${BOLD}Install: rpi-clone$OFF" cd .. git clone https://github.com/billw2/rpi-clone.git cd rpi-clone sudo cp rpi-clone /usr/sbin fi echo -e "\e[033m${BOLD}Install: fastcgi$OFF" sudo apt-get install -y redis-server git screen php5-cli php5-curl sudo apt-get autoremove -y sudo /etc/init.d/lighttpd restart cd "$SRC_DIR" } deploy() { # Install Minera with my patched files if [ ! -d "/var/www/minera" ]; then cd /var/www/ sudo git clone https://github.com/michelem09/minera cd minera sudo git checkout 8890458b3dbb36cdc4bfb29c350759aec2588baf fi cd /var/www/minera echo -e "\e[033m${BOLD}Install: Patch:$OFF" sudo cp $SRC_DIR/files/patch_no_ads.diff . sudo patch -p1 &2 echo >&2 "Build actions:" grep "() { #" $0 | grep -v grep | sed -e "s:^: :" -e "s:() { #: @:" | while read i; do echo " " $(eval "echo $i") | tr @ \\t done exit 1 ;; esac