#!/bin/bash Version=3.5 OpenSSL_v=1.0.2u Boost_v=1_67_0 DB_v=4.8.30 Miniupnp_v=2.2.3 okcash_v=5005_bliss zip_i="" unzip_i="" ftp_i="" pixz_i="" pigz_i="" cmake_i="" chkinstall_i="" z="" set -e echo -e "\n\e[93mOkcash headless dependencies format/uploader v$Version:\e[0m" echo -e "wareck@gmail.com" echo -e "" echo -e "\e[97mSoftware version :\e[0m" echo -e "------------------" echo -e "Boost : $Boost_v" echo -e "OpenSSL : $OpenSSL_v" echo -e "DB Berkeley : $DB_v" echo -e "DB Berkeley NC : $DB_v.NC" echo -e "Miniupnp : $Miniupnp_v" echo -e "Okcash_source : $okcash_v" function system_check { echo -e "\n\e[95mSystem check :\e[0m" echo -e -n "Check ZIP : " if ! [ -x "$(command -v zip)" ];then zip_i="zip" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]";fi if ! [ -x "$(command -v unzip)" ];then unzip_i="unzip" ;fi echo -e -n "Check LFTP : " if ! [ -x "$(command -v lftp)" ];then ftp_i="lftp" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]";fi echo -e -n "Check PIXZ : " if ! [ -x "$(command -v pixz)" ];then pixz_i="pixz" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]";fi echo -e -n "Check PIGZ : " if ! [ -x "$(command -v pigz)" ];then pigz_i="pigz" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]"; fi echo -e -n "Check CMAKE : " if ! [ -x "$(command -v cmake)" ];then cmake_i="cmake" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]"; fi echo -e -n "Check CHKININSTALL : " if ! [ -x "$(command -v checkinstall)" ];then chkinstall_i="checkinstall" && echo -e "[\e[91mNO\e[0m]";else echo -e "[\e[92mOK\e[0m]"; fi if [[ ! $ftp_i = "" || ! $zip_i = "" || ! $unzip_i = "" || ! $pixz_i = "" || ! $pigz_i = "" || ! $cmake_i = "" || ! $chkinstall_i = "" ]] then echo -e "" sudo apt install $ftp_i $zip_i $unzip_i $pv_i $pixz_i $pigz_i $cmake_i $chkinstall_i -y fi } function freeze_on { NEW_FAN=5.0 NEW_PWMFAN=5.0 if [ -f /home/$USER/scripts/run-fan.py ] then echo -e "\n\e[95mEnable \e[38;5;196mF\e[38;5;202mr\e[38;5;208me\e[38;5;214me\e[38;5;220mz\e[38;5;226mi\e[38;5;227mn\e[38;5;229mg\e[0m \e[95m:\e[0m" sudo systemctl stop run-fan.service if ! [ -f /home/$USER/freeze.txt ] then if grep "# Author: Andreas Spiess" /home/$USER/scripts/run-fan.py >/dev/null then grep -i "desiredTemp = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt else grep -i "self.startTemperature = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt fi fi OLD_FAN=`cat /home/$USER/freeze.txt| awk '{print $1}'` if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null then echo "Fan PWM value : $OLD_FAN => $NEW_PWMFAN" else echo "Fan value : $OLD_FAN => $NEW_FAN" fi if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null then sed -i -e "s/desiredTemp = "$OLD_FAN"/desiredTemp = "$NEW_PWMFAN"/g" /home/$USER/scripts/run-fan.py else sed -i -e "s/self.startTemperature = "$OLD_FAN"/self.startTemperature = "$NEW_FAN"/g" /home/$USER/scripts/run-fan.py fi sudo systemctl restart run-fan.service echo -e "Done." sleep 1 fi } function freeze_off { echo -e -n "" if [ -f /home/$USER/scripts/run-fan.py ] then echo -e "\n\e[95mDisable Freezing :\e[0m" OLD_FAN=`cat /home/$USER/freeze.txt| awk '{print $1}'` if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null then echo "Fan PWM value : $NEW_PWMFAN => $OLD_FAN" else echo "Fan value: $NEW_FAN =>$OLD_FAN" fi sudo systemctl stop run-fan.service if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null then sed -i -e "s/desiredTemp = "$NEW_PWM"/desiredTemp = "$OLD_FAN"/g" /home/$USER/scripts/run-fan.py else sed -i -e "s/self.startTemperature = "$NEW_FAN"/self.startTemperature = "$OLD_FAN"/g" /home/$USER/scripts/run-fan.py fi sudo systemctl restart run-fan.service if [ -f /home/$USER/freeze.txt ];then rm /home/$USER/freeze.txt;fi echo -e "Done." fi } function download_ { echo -e "\n\e[95mDownload original libraries :\e[0m" if [ ! -d deps ];then mkdir deps && cd deps;else cd deps; fi wget -c -q --show-progress https://github.com/okcashpro/okcash/archive/v5.0.0.5-core.bliss.zip wget -c -q --show-progress http://wareck.free.fr/crypto/okcash/sources/boost_$Boost_v.tar.gz wget -c -q --show-progress http://wareck.free.fr/crypto/okcash/sources/miniupnpc-$Miniupnp_v.tar.gz wget -c -q --show-progress http://download.oracle.com/berkeley-db/db-$DB_v.tar.gz wget -c -q --show-progress http://download.oracle.com/berkeley-db/db-$DB_v.NC.tar.gz wget -c -q --show-progress https://www.openssl.org/source/openssl-$OpenSSL_v.tar.gz if ! [ -d megadown ];then echo "" && git clone http://gogserver.dnsalias.com:3000/wareck/megadown.git;fi if ! [ -d userland ];then echo "" && git clone https://github.com/raspberrypi/userland.git ;fi echo "Done." } function expand_ { echo -e "\n\e[95mExpand original libraries :\e[0m" sleep 1 echo -e -n "okcash_v5.0.0.5-core.bliss:" unzip -q -o v5.0.0.5-core.bliss.zip echo -n " Ok." echo -e "\nboost_$Boost_v.tar.gz:" tar -I pigz -xf boost_$Boost_v.tar.gz --checkpoint=.1000 echo -n " Ok." echo -e "\ndb-$DB_v.tar.gz:" tar -I pigz -xf db-$DB_v.tar.gz --checkpoint=.215 echo -n " Ok." echo -e "\ndb-$DB_v.NC.tar.gz" tar -I pigz -xf db-$DB_v.NC.tar.gz --checkpoint=.200 echo -n " Ok." echo -e "\nopenssl-$OpenSSL_v.tar.gz:" tar -I pigz -xf openssl-$OpenSSL_v.tar.gz --checkpoint=.60 echo -n " Ok." echo -e "\nminiupnpc-$Miniupnp_v.tar.gz:" tar xfz miniupnpc-$Miniupnp_v.tar.gz --checkpoint=.01 echo -n " Ok." } function compress_ { echo "" echo -e "\n\e[95mCompress libraries :\e[0m" sleep 1 echo -e -n "userland" cd userland if [ ! -d build ];then mkdir build;fi cd build cmake .. sudo checkinstall --pkgname=userland --pkgversion="1.51" --default cd .. cd .. echo -e -n "megadown:" cd megadown tar cfj megadown.tar.bz2 megadown echo -n " Ok." cd .. mv megadown/megadown.tar.bz2 . echo -e "\nokcash_v5.0.0.5-core.bliss:" cp -r okcash-5.0.0.5-core.bliss okcash XZ_OPT=-9 tar cf okcash_$okcash_v.tar.xz okcash --checkpoint=.250 -Ipixz echo -n " Ok." echo -e "\nboost_$Boost_v.tar.xz:" XZ_OPT=-9 tar cf boost_$Boost_v.tar.xz boost_$Boost_v --checkpoint=.400 -Ipixz echo -n " Ok." echo -e "\ndb-$DB_v.tar.xz:" XZ_OPT=-9 tar cf db-$DB_v.tar.xz db-$DB_v --checkpoint=.250 -Ipixz echo -n " Ok." echo -e "\ndb-$DB_v.NC.tar.xz:" XZ_OPT=-9 tar cf db-$DB_v.NC.tar.xz db-$DB_v.NC --checkpoint=.250 -Ipixz echo -n " Ok." echo -e "\nopenssl-$OpenSSL_v.tar.xz:" tar cf openssl-$OpenSSL_v.tar.xz openssl-$OpenSSL_v --checkpoint=.80 -Ipixz echo -n " Ok." echo -e "\nminiupnpc-$Miniupnp_v.tar.xz:" tar cf miniupnpc-$Miniupnp_v.tar.xz miniupnpc-$Miniupnp_v --checkpoint=.2 -Ipixz echo -n " Ok." touch 1pass } function stop_watchdog_ { echo -e "\n\e[95mStop Watchdog :\e[0m" sudo /etc/init.d/cron stop 2>/dev/null || true if [ "`systemctl is-active watchdog.service`" = "active" ] then echo -e "\n\e[95mStopping watchdog :\e[0m" sudo systemctl stop watchdog >/dev/null echo "Done." else echo "Done." fi } function upload_ { echo "" echo -e "\n\e[95mUpload libraries :\e[0m" lftp -u wareck,zorn692611 ftpperso.free.fr <