Advertisement
alforro

ASIC HIVEOS D3 Blissz v1.12

May 24th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.37 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ASIC_MODEL=`sed -n 2p /usr/bin/compile_time`
  4. release=`curl -f --silent -L --insecure https://raw.githubusercontent.com/minershive/hiveos-asic/master/hive/etc/VERSION`
  5. exitcode=$?
  6. version=0
  7. version=`cat /hive/etc/VERSION`
  8. filename=v$release.tar.gz
  9.  
  10. cd /tmp
  11. rm -rf /tmp/hive/*
  12. rm -rf /tmp/selfupgrade
  13.  
  14. if [ $release == $version ]; then
  15.     if [ "$1" != "master" ]; then
  16.         if [ "$2" != "-f" ]; then
  17.             echo "The latest version is installed"
  18.             exit $exitcode
  19.         fi
  20.     fi
  21. fi
  22. if [ $exitcode -ne 0 ] || [ -z $release ]; then
  23.     echo "Can't get current version from repository"
  24.     exit $exitcode
  25. fi
  26. if [ $# != "0" ]; then
  27.     release=$1
  28.     if [ $release == "master" ]; then
  29.         filename=$release.tar.gz
  30.     else
  31.         filename=v$release.tar.gz
  32.     fi
  33. fi
  34. url=http://github.com/minershive/hiveos-asic/archive/$filename
  35.  
  36. [ -e $filename ] && rm $filename
  37.  
  38. echo $url
  39.  
  40. echo "> Downloading $url"
  41. curl -L --insecure -O $url
  42. [ $? -ne 0 ] && echo "Error downloading $url" && exit 1
  43.  
  44. sleep 2
  45.  
  46.  
  47. install_s9() {
  48.     echo ""
  49.     echo "> Extracting $filename"
  50.     tar -xzv -f $filename
  51.     cp -rf hiveos-asic-$release/* /
  52.     [ $? -ne 0 ] && echo "Error extracting $filename" && exit 1
  53.  
  54.     rm $filename
  55.  
  56.     sleep 2
  57.  
  58.     export PATH=$PATH:/hive/bin:/hive/sbin
  59.     export LD_LIBRARY_PATH=/hive/lib
  60.  
  61.     /hive/bin/hive
  62.  
  63.     sleep 2
  64.  
  65.     bash -c /hive/bin/firstrun
  66. }
  67.  
  68. install_a3_d3() {
  69.     echo ""
  70.     echo "> Extracting $filename"
  71.     if [ ! -d /config/hive ]; then
  72.         mkdir /config/hive
  73.     fi
  74.         tar -xzv -f $filename
  75.         cp -rf hiveos-asic-$release/* /config/hive/
  76.     [ $? -ne 0 ] && echo "Error extracting $filename" && exit 1
  77.  
  78.     rm $filename
  79.  
  80.     sleep 2
  81.  
  82.     export PATH=$PATH:/hive/bin:/hive/sbin
  83.     export LD_LIBRARY_PATH=/hive/lib
  84.    
  85.     if [ ! -e /hive ]; then
  86.         ln -s /config/hive/hive/ /hive
  87.         ln -s /config/hive/hive-config/ /hive-config
  88.         ln -s /config/hive/home/root/.profile /home/root/.profile
  89.     fi
  90.  
  91.     if grep "### HIVE AUTORUN ###" /config/network.conf || grep "ln -s /config/hive/hive/ /hive" /config/network.conf; then
  92.         echo "/config/network.conf skip"
  93.     else
  94.         cat >> /config/network.conf <<FILEEOF
  95.  
  96. ### HIVE AUTORUN ###
  97. [ -e /config/hive_autorun ] && nohup /bin/sh -c '/config/hive_autorun' > /dev/null 2>&1 &
  98. FILEEOF
  99.     fi
  100.     cp -rf /hive/bin/hive_autorun /config/hive_autorun
  101.     /hive/bin/hive
  102.  
  103.     #on a3 d3 no cron daemon, run tasks in background
  104.     nohup bash -c 'sleep 60; /hive/bin/cron1' > /dev/null 2>&1 &
  105.     nohup bash -c 'sleep 60; /hive/bin/cron2' > /dev/null 2>&1 &
  106.  
  107.     sleep 2
  108.  
  109.     bash -c /hive/bin/firstrun
  110. }
  111.  
  112.  
  113. if [ "$ASIC_MODEL" == "Antminer S9" ]; then
  114.     echo "Install Antminer S9"
  115.     install_s9
  116. elif [ "$ASIC_MODEL" == "Antminer A3" ]; then
  117.     echo "Install Antminer A3"
  118.     install_a3_d3
  119. elif [ "$ASIC_MODEL" == "Antminer D3" ]; then
  120.     echo "Install Antminer D3"
  121.     install_a3_d3
  122. elif [ "$ASIC_MODEL" == "Antminer D3 Blissz v1.12" ]; then
  123.     echo "Install Antminer D3 Blissz"
  124.     install_a3_d3
  125. elif [ "$ASIC_MODEL" == "Antminer L3+" ]; then
  126.     echo "Install Antminer L3+"
  127.     install_a3_d3
  128. elif [ "$ASIC_MODEL" == "Antminer T9+" ]; then
  129.     echo "Install Antminer T9+"
  130.     install_s9
  131. else
  132.     echo "Not found $ASIC_MODEL"
  133.     exit 1
  134. fi
  135.  
  136. . /hive/bin/colors
  137.  
  138. #Don't restart it...
  139. #echo -e "> Saying hello to server again"
  140. #hello restartminer
  141.  
  142. #Restart agent
  143. echo -e "> Restarting agent"
  144. screen -S agent -X quit
  145. agent-screen dontattach
  146.  
  147. echo -e "${GREEN}Upgrade complete. Have a happy mining.${NOCOLOR}"
  148.  
  149. sync
  150. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement