# Quarkcoin All-In-One EZ Setup Script # Hacked together by GigaWatt # Donations welcome! # BTC: 1E2egHUcLDAmcxcqZqpL18TPLx9Xj1akcV # XPM: AWHJbwoM67Ez12SHH4pH5DnJKPoMSdvLz2 # Last Update: 27 August, 2013 { # PUT YOUR SETTINGS HERE QUARK_USERNAME="" # Build swapfile if [[ ! -f /swapfile ]]; then echo "Building swapfile..." sudo dd if=/dev/zero of=/swapfile bs=64M count=16 sudo mkswap /swapfile sudo swapon /swapfile # Mount on reboot if [[ -z "$(cat /etc/fstab | grep swapfile)" ]]; then echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab > /dev/null 2>&1 fi fi # Auto reboot on kernel panic if [[ -z "$(cat /etc/sysctl.conf | grep '^kernel.panic')" ]]; then echo "kernel.panic=3" | sudo tee /etc/sysctl.conf >/dev/null 2>&1 fi echo "Installing libraries..." sudo apt-get update sudo apt-get install build-essential bc curl fail2ban git haveged libboost-all-dev libdb++-dev libminiupnpc-dev libssl-dev m4 nano -y # Install GMP cd ~/ rm -rf gmp-5.1.2.tar.bz2 gmp-5.1.2 wget http://mirrors.kernel.org/gnu/gmp/gmp-5.1.2.tar.bz2 tar xjvf gmp-5.1.2.tar.bz2 cd gmp-5.1.2 ./configure --enable-cxx make sudo make install rm -rf gmp-5.1.2.tar.bz2 gmp-5.1.2 cd ~/ # Enable HAVEGED for entropy sudo update-rc.d haveged defaults sudo service haveged restart echo "Downloading and building quark..." cat << "SCRIPT" > ~/build-quarkcoin #!/bin/bash [[ -f ~/stop-quarkcoind ]] && ./stop-quarkcoind if [[ -d ~/quark ]]; then cd ~/quark git pull cd ~/quark/src make -f makefile.unix clean else cd ~ git clone https://github.com/MaxGuevara/quark.git fi cd ~/quark/src make -f makefile.unix USE_UPNP=- DEBUGFLAGS="" sudo cp quarkcoind /usr/local/bin/ SCRIPT chmod +x ~/build-quarkcoin ~/build-quarkcoin echo "Building settings and scripts..." mkdir ~/.quarkcoin echo "rpcusername=${QUARKCOIN_USERNAME} rpcpassword=$(cat /dev/urandom | tr -cd '[:alnum:]' | head -c32) gen=1 genproclimit=-1" > ~/.quarkcoin/quarkcoin.conf # Notification scripts cat << "SCRIPT" > ~/notify-block #!/bin/bash # YOUR SCRIPT HERE SCRIPT chmod +x ~/notify-block cat << "SCRIPT" > ~/notify-wallet #!/bin/bash # YOUR SCRIPT HERE cp ~/.quarkcoin/wallet.dat ~/${HOSTNAME}.bak SCRIPT chmod +x ~/notify-wallet # Watchdog runner cat << "SCRIPT" > ~/start-quarkcoind #!/bin/bash export PATH="/usr/local/bin:$PATH" echo Starting quarkcoind [[ -n "$(pidof quarkcoind)" ]] && killall --older-than 60s -q start-quarkcoind quarkcoind function background_loop while :; do quarkcoind -blocknotify="~/notify-block" -walletnotify="~/notify-wallet" >/dev/null 2>&1 sleep 5 date >> ~/crash.log done background_loop & SCRIPT chmod +x ~/start-quarkcoind ~/start-quarkcoind # Add to startup mkdir /var/spool/cron/crontabs/ > /dev/null 2>&1 echo "@reboot ${HOME}/start-quarkcoind" | sudo tee /var/spool/cron/crontabs/$(whoami) > /dev/null 2>&1 echo "" | sudo tee -a /var/spool/cron/crontabs/$(whoami) > /dev/null 2>&1 sudo chmod 0600 /var/spool/cron/crontabs/$(whoami) sudo update-rc.d cron defaults # Watchdog stopper cat << "SCRIPT" > ~/stop-quarkcoind #!/bin/bash killall -q start-quarkcoind quarkcoind stop sleep 3 [[ -n "$(pidof quarkcoind)" ]] && killall quarkcoind SCRIPT chmod +x ~/stop-quarkcoind # Watchdog restarter cat << "SCRIPT" > ~/restart-quarkcoind #!/bin/bash ~/stop-quarkcoind ~/start-quarkcoind SCRIPT chmod +x ~/restart-quarkcoind # Peek at status cat << "SCRIPT" > ~/peek #!/bin/bash conf=$(quarkcoind getbalance) unconf=$(quarkcoind getbalance '' 1) immature=$(echo "scale=4;${unconf} - ${conf}" | bc) echo "Stats: $(quarkcoind getmininginfo)" echo "Confirmed Balance: ${conf}" echo "Immature Balance: ${immature}" echo "Immature TX: $(quarkcoind listtransactions | grep immature | wc -l)" echo "Connections: $(quarkcoind getconnectioncount)" SCRIPT chmod +x ~/peek # Dump address info cat << "SCRIPT" > ~/myinfo #!/bin/bash for addr in $(quarkcoind listtransactions "" 99999 | grep -C 1 '"generate"\|"receive"' | grep --color=never -o "\b[A-Za-z0-9]\{33,36\}\b" | sort -u); do echo Address: ${addr} echo PrivKey: $(quarkcoind dumpprivkey ${addr}) echo done SCRIPT chmod +x ~/myinfo # Edit quarkcoin config file cat << "SCRIPT" > ~/config #!/bin/bash nano ~/.quarkcoin/quarkcoin.conf ~/stop-quarkcoind ~/start-quarkcoind SCRIPT chmod +x ~/config echo echo echo '==========================================================' echo 'All Done!' echo 'quarkcoind should be up and running' echo echo 'Run ~/start-quarkcoind to start quarkcoind and begin mining' echo 'Run ~/stop-quarkcoind to stop quarkcoind and stop mining' echo 'Run ~/build-quarkcoin to update and rebuild quarkcoind' echo 'Run ~/config to modify your quarkcoind config file' echo 'Run ~/peek to check on your mining status' echo 'Run ~/myinfo to view your quarkcoin address and privkey' }