123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- #!/bin/bash
- #####################################################################
- # Minera builder script to build and update miner software binaries
- #
- # For usage just run the build_miner.sh without any argument
- #
- # Thanks to @brettvitaz https://github.com/brettvitaz
- #
- # modded by wareck@gmail.com
- #
- #####################################################################
- set -u
- set -e
- VERSION=3.4.0306
-
- LINK_ONLY=0
- BUILD_OK=0
- DYNLINK=0
-
- MINERA_PATH="/var/www/minera"
- BINARY_PATH="$MINERA_PATH/minera-bin"
- SOURCE_PATH="$BINARY_PATH/src"
-
- CPUMINER_REPO="https://github.com/siklon/cpuminer-gc3355"
- CPUMINER_PATH="$SOURCE_PATH/cpuminer-gc3355"
- CPUMINER_CONFIG="CFLAGS=-O3"
- CPUMINER_BINARY="minerd"
- CPUMINER_MINERA_BINARY="minerd"
-
- BFGMINER_REPO="https://github.com/luke-jr/bfgminer.git"
- BFGMINER_PATH="$SOURCE_PATH/bfgminer"
- BFGMINER_CONFIG="--enable-scrypt --enable-keccak --enable-bfsb --enable-broad-udevrules --without-system-libbase58"
- BFGMINER_BINARY="bfgminer"
- BFGMINER_MINERA_BINARY="bfgminer"
-
- CGMINER_DMAXL_REPO="https://github.com/wareck/cgminer-lketc.git"
- CGMINER_DMAXL_PATH="$SOURCE_PATH/cgminer-lketc"
- CGMINER_DMAXL_CONFIG="--enable-scrypt --enable-gridseed --enable-zeus --enable-lketc"
- CGMINER_DMAXL_BINARY="cgminer"
- CGMINER_DMAXL_MINERA_BINARY="cgminer-dmaxl-zeus"
-
- CGMINER_REPO="https://github.com/ckolivas/cgminer.git"
- CGMINER_PATH="$SOURCE_PATH/cgminer"
- CGMINER_CONFIG="--enable-avalon --enable-bflsc --enable-bitforce --enable-bitfury --enable-blockerupter --enable-cointerra --enable-drillbit --enable-hashfast --enable-hashratio --enable-icarus --enable-klondike --enable-modminer"
- CGMINER_BINARY="cgminer"
- CGMINER_MINERA_BINARY="cgminer"
- BITMINER_REPO="https://github.com/wareck/cgminer-hexminer.git"
- BITMINER_PATH="$SOURCE_PATH/cgminer-hex"
- BITMINER_CONFIG="--enable-hexminera --enable-hexminerb --enable-hexmineru --enable-hexminerc --enable-hexminer8 --enable-hexminerm --enable-hexminerr --enable-hexminerbe200 --enable-hexminer3"
- BITMINER_BINARY="cgminer"
- BITMINER_MINERA_BINARY="cgminer-hex"
- CGMINER_GK_REPO="https://wareck@bitbucket.org/wareck/cgminer-gekko.git"
- CGMINER_GK_PATH="$SOURCE_PATH/cgminer-gekko"
- CGMINER_GK_CONFIG="--enable-gekko --enable-bflsc --enable-icarus"
- CGMINER_GK_BINARY="cgminer"
- CGMINER_GK_MINERA_BINARY="cgminer-gekko"
- BFGMINER_MOON_REPO="--branch futurebit_driver https://github.com/jstefanop/bfgminer.git"
- BFGMINER_MOON_PATH="$SOURCE_PATH/bfgminer-moon"
- BFGMINER_MOON_CONFIG="--enable-scrypt --enable-scrypt --enable-futurebit --disable-other-drivers"
- BFGMINER_MOON_BINARY="bfgminer"
- BFGMINER_MOON_MINERA_BINARY="bfgminer-moon"
-
- function buildMiner {
- if [[ $LINK_ONLY -eq 0 ]]; then
- if [[ -d "$BUILD_PATH/.git" ]]; then
- cd $BUILD_PATH
- echo "Pulling repo $BUILD_REPO"
- git fetch --all
- git reset --hard
- else
- echo "Cloning repo $BUILD_REPO into $BUILD_PATH"
- git clone $BUILD_REPO $BUILD_PATH
- cd $BUILD_PATH
- fi
- ./autogen.sh
- echo "Running ./configure $BUILD_CONFIG"
- ./configure ${BUILD_CONFIG}
- make
- sudo make install
- sudo ldconfig
- fi
- if [[ -f $BINARY_PATH/$MINERA_BINARY ]]; then
- sleep 1
- else
- echo "build temporary file..."
- touch $BINARY_PATH/$MINERA_BINARY
- fi
-
- if [[ -e "$BUILD_PATH/$BUILD_BINARY" ]]; then
- echo "Removing old binary $BINARY_PATH/$MINERA_BINARY"
- rm $BINARY_PATH/$MINERA_BINARY
- echo "Copying new binary $BUILD_PATH/$BUILD_BINARY -> $BINARY_PATH/$MINERA_BINARY"
- cp $BUILD_PATH/$BUILD_BINARY $BINARY_PATH/$MINERA_BINARY
- else
- echo "Failed to copy miner binary. File $BUILD_PATH/$BUILD_BINARY does not exist."
- fi
- if [[ $DYNLINK -eq 1 ]]; then
- if [[ -e "/var/www/minera/minera-bin/custom/$MINERA_BINARY" ]]; then
- rm /var/www/minera/minera-bin/custom/$MINERA_BINARY
- fi
- echo "Creating symlink to custom miner"
- ln -s $BINARY_PATH/$MINERA_BINARY /var/www/minera/minera-bin/custom/$MINERA_BINARY
- fi
- }
-
- ARGS="${@/%all/cpuminer bfgminer cgminer-dmaxl cgminer cgminer-hex cgminer-gekko bfgminer-moon}"
-
- if [[ -d "$SOURCE_PATH" ]]; then
- for OPT in $ARGS; do
- echo "$OPT"
- if [[ $OPT = "-l" ]]; then
- LINK_ONLY=1
- elif [[ $OPT = "all" ]]; then
- ARGS="cpuminer bfgminer cgminer-dmaxl cgminer cgminer-hex cgminer-gekko bfgminer-moon"
- elif [[ $OPT = "cpuminer" ]]; then
- BUILD_REPO=$CPUMINER_REPO
- BUILD_PATH=$CPUMINER_PATH
- BUILD_CONFIG=$CPUMINER_CONFIG
- BUILD_BINARY=$CPUMINER_BINARY
- MINERA_BINARY=$CPUMINER_MINERA_BINARY
- BUILD_OK=1
- elif [[ $OPT = "bfgminer" ]]; then
- BUILD_REPO=$BFGMINER_REPO
- BUILD_PATH=$BFGMINER_PATH
- BUILD_CONFIG=$BFGMINER_CONFIG
- BUILD_BINARY=$BFGMINER_BINARY
- MINERA_BINARY=$BFGMINER_MINERA_BINARY
- BUILD_OK=1
- elif [[ $OPT = "cgminer-dmaxl" ]]; then
- BUILD_REPO=$CGMINER_DMAXL_REPO
- BUILD_PATH=$CGMINER_DMAXL_PATH
- BUILD_CONFIG=$CGMINER_DMAXL_CONFIG
- BUILD_BINARY=$CGMINER_DMAXL_BINARY
- MINERA_BINARY=$CGMINER_DMAXL_MINERA_BINARY
- BUILD_OK=1
- elif [[ $OPT = "cgminer" ]]; then
- BUILD_REPO=$CGMINER_REPO
- BUILD_PATH=$CGMINER_PATH
- BUILD_CONFIG=$CGMINER_CONFIG
- BUILD_BINARY=$CGMINER_BINARY
- MINERA_BINARY=$CGMINER_MINERA_BINARY
- BUILD_OK=1
- elif [[ $OPT = "cgminer-hex" ]]; then
- BUILD_REPO=$BITMINER_REPO
- BUILD_PATH=$BITMINER_PATH
- BUILD_CONFIG=$BITMINER_CONFIG
- BUILD_BINARY=$BITMINER_BINARY
- MINERA_BINARY=$BITMINER_MINERA_BINARY
- BUILD_OK=1
- DYNLINK=1
- elif [[ $OPT = "cgminer-gekko" ]]; then
- BUILD_REPO=$CGMINER_GK_REPO
- BUILD_PATH=$CGMINER_GK_PATH
- BUILD_CONFIG=$CGMINER_GK_CONFIG
- BUILD_BINARY=$CGMINER_GK_BINARY
- MINERA_BINARY=$CGMINER_GK_MINERA_BINARY
- BUILD_OK=1
- DYNLINK=1
- elif [[ $OPT = "bfgminer-moon" ]]; then
- BUILD_REPO=$BFGMINER_MOON_REPO
- BUILD_PATH=$BFGMINER_MOON_PATH
- BUILD_CONFIG=$BFGMINER_MOON_CONFIG
- BUILD_BINARY=$BFGMINER_MOON_BINARY
- MINERA_BINARY=$BFGMINER_MOON_MINERA_BINARY
- BUILD_OK=1
- DYNLINK=1
- else
- echo "Option not recognized = $OPT"
- BUILD_OK=0
- fi
- if [[ $BUILD_OK -eq 1 ]]; then
- buildMiner
- fi
- done
- if [[ $BUILD_OK -eq 0 ]]; then
- echo " "
- echo -e "\e[1m\e[33mBinary mining autobuilder \e[31mv$VERSION"
- echo -e "\e[0m\e[39mUsage: build_miner.sh [OPTION] [MINER NAME(S)]..."
- echo ""
- echo "Arguments:"
- echo " -l Link binaries only (do not build)"
- echo ""
- echo "Miner Names:"
- echo " cgminer cgminer official"
- echo " cpuminer cpuminer GC3355 fork"
- echo " bfgminer bfgminer official"
- echo " cgminer-dmaxl cgminer dmaxl fork (GridSeed and Zeus support)"
- echo " cgminer-hex cgminer special HexMiner"
- echo " cgminer-gekko cgminer with gekko support"
- echo " bfgminer-moon bfgminer Futurebit Moonlander"
- echo " all build all the above"
- echo ""
- fi
- else
- echo "Minera source folder does not exist. Please install Minera prior to building the miners."
- fi
|