From 664d41605585e80ff1607536f4cbd4f765a1369d Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 18 Jun 2011 16:34:52 +0200 Subject: initial commit of miner repo --- mining/README | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 mining/README (limited to 'mining') diff --git a/mining/README b/mining/README new file mode 100644 index 00000000..ad8c3468 --- /dev/null +++ b/mining/README @@ -0,0 +1,9 @@ +What to do: +format the usb-stick: +Device Boot Start End Blocks Id System +/dev/sda1 * 1 254 976345 c W95 FAT32 (LBA) +/dev/sda2 255 1017 2932972 83 Linux + +1. install coinlinux live system on sda1. +2. mkfs.ext3 /dev/sda2 -L live-rw +3. install grub on /dev/sda -- cgit v1.2.3 From 3352f847704718c43f346b781725e4ff8b2112de Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 18 Jun 2011 17:06:11 +0200 Subject: mining/: added all mining scripts and configs mining/Makefile: format - how to format the usb stick (or hard drive) install - installs all necessary components, writes ati_license, copies files in home dir configure - how to configure the miner mining/user/*: files to be dumped in the miners home directory --- mining/CONFIGURE | 5 +++++ mining/Makefile | 11 +++++++++++ mining/user/.config/autostart/startup.desktop | 6 ++++++ mining/user/mining.odvr | 16 ++++++++++++++++ mining/user/startup.sh | 16 ++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 mining/CONFIGURE create mode 100644 mining/Makefile create mode 100644 mining/user/.config/autostart/startup.desktop create mode 100644 mining/user/mining.odvr create mode 100644 mining/user/startup.sh (limited to 'mining') diff --git a/mining/CONFIGURE b/mining/CONFIGURE new file mode 100644 index 00000000..6ddce386 --- /dev/null +++ b/mining/CONFIGURE @@ -0,0 +1,5 @@ +How to Configure +=============== + +1. change the mining-url in ~/startup.sh +2. sudo /etc/init.d/gdm restart diff --git a/mining/Makefile b/mining/Makefile new file mode 100644 index 00000000..c673ee3e --- /dev/null +++ b/mining/Makefile @@ -0,0 +1,11 @@ +.PHONY: all format install +select-target: + @echo "You are made of stupid!" +format: + cat README +install: + echo '#!/bin/bash' > /usr/bin/ati_license + echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license + cp -r user /home +configure: + cat CONFIGURE diff --git a/mining/user/.config/autostart/startup.desktop b/mining/user/.config/autostart/startup.desktop new file mode 100644 index 00000000..67c35ef8 --- /dev/null +++ b/mining/user/.config/autostart/startup.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=LXDE Autostart +Exec=/home/user/startup.sh +Terminal=true +Type=Application +Categories=Configuration diff --git a/mining/user/mining.odvr b/mining/user/mining.odvr new file mode 100644 index 00000000..d6cf6fec --- /dev/null +++ b/mining/user/mining.odvr @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mining/user/startup.sh b/mining/user/startup.sh new file mode 100644 index 00000000..c330b984 --- /dev/null +++ b/mining/user/startup.sh @@ -0,0 +1,16 @@ +sudo pkill xscreensaver +sudo pkill tmux +sleep 1 +export DISPLAY=:0 + +export URL="http://txgen_chinaman:lolwut@uk.btcguild.com:8332" +#export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334" +slock & +tmux start-server +tmux new-session -d -s mining -n mining +printenv > /home/user/environment +tmux new-window -t mining:1 'AMDOverdriveCtrl -i 0 mining.ovdr' +tmux new-window -t mining:2 'AMDOverdriveCtrl -i 3 mining.ovdr' +sleep 5 +tmux new-window -t mining:3 "cd /opt/miners/phoenix; while sleep 1; do sudo python phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" +tmux new-window -t mining:4 "cd /opt/miners/phoenix; while sleep 1;do sudo python phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=10 FASTLOOPS=false ; done" -- cgit v1.2.3 From 9343db90975d32b7f96f6407ab4689fdadc4c5a1 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 21 Jun 2011 17:06:05 +0200 Subject: added btcguild poll script --- mining/poll_btcguild | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 mining/poll_btcguild (limited to 'mining') diff --git a/mining/poll_btcguild b/mining/poll_btcguild new file mode 100644 index 00000000..92a02657 --- /dev/null +++ b/mining/poll_btcguild @@ -0,0 +1,2 @@ +API_KEY= +curl http://www.btcguild.com/api.php\?api_key\=${API_KEY} | python -mjson.tool -- cgit v1.2.3 From ae413040ff37f6d3a2e2fe06162851c09c089ea3 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 Jun 2011 21:19:01 +0200 Subject: mining/user/mining.o{dv -> vd}r --- mining/user/mining.odvr | 16 ---------------- mining/user/mining.ovdr | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 mining/user/mining.odvr create mode 100644 mining/user/mining.ovdr (limited to 'mining') diff --git a/mining/user/mining.odvr b/mining/user/mining.odvr deleted file mode 100644 index d6cf6fec..00000000 --- a/mining/user/mining.odvr +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/mining/user/mining.ovdr b/mining/user/mining.ovdr new file mode 100644 index 00000000..d6cf6fec --- /dev/null +++ b/mining/user/mining.ovdr @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7e6e4bcc68777aa7ddd7b925167dfd40c3ffed3a Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Wed, 22 Jun 2011 00:05:54 +0200 Subject: added ati_temper --- mining/user/bin/ati_temper | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 mining/user/bin/ati_temper (limited to 'mining') diff --git a/mining/user/bin/ati_temper b/mining/user/bin/ati_temper new file mode 100755 index 00000000..283a6024 --- /dev/null +++ b/mining/user/bin/ati_temper @@ -0,0 +1,5 @@ +#displays: CARD1TEMP CARD2TEMP CPUTEMP OUTSIDE +echo -n "`DISPLAY=:0 aticonfig --adapter=1 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`DISPLAY=:0 aticonfig --adapter=2 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`sensors | grep temp1 | sed -e 's/temp1: *+\([0-9.]*\).*/\1/'` " +echo "`temper`" -- cgit v1.2.3 From 9adf9b9c122dbf0dc81c82d2421c8b147d41dc21 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Wed, 22 Jun 2011 00:15:03 +0200 Subject: Makefile: does more of the right things now Makefile will patch quirks from the live system: 1. /etc/init.d/live-boot 2. ati_license Makefile will install and configure lm-sensors --- mining/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mining') diff --git a/mining/Makefile b/mining/Makefile index c673ee3e..0fab7b1f 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -1,11 +1,18 @@ .PHONY: all format install select-target: @echo "You are made of stupid!" + echo "look here" + @cat Makefile format: cat README install: + apt-get install --yes lm-sensors echo '#!/bin/bash' > /usr/bin/ati_license + echo '#!/bin/sh' > /etc/init.d/live-boot + echo 'wall "going down"' >> /etc/init.d/live-boot + chmod 755 /etc/init.d/live-boot echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license cp -r user /home configure: - cat CONFIGURE + sensors-detect + @cat CONFIGURE -- cgit v1.2.3 From 8f900fff02ac22ba87c35e6745af11c0b8d98855 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 22 Jun 2011 00:19:00 +0000 Subject: mining/user/startup.sh: use URL from env --- mining/user/startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mining') diff --git a/mining/user/startup.sh b/mining/user/startup.sh index c330b984..eb2ce13a 100644 --- a/mining/user/startup.sh +++ b/mining/user/startup.sh @@ -3,7 +3,7 @@ sudo pkill tmux sleep 1 export DISPLAY=:0 -export URL="http://txgen_chinaman:lolwut@uk.btcguild.com:8332" +export URL="${URL-http://txgen_chinaman:lolwut@uk.btcguild.com:8332}" #export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334" slock & tmux start-server -- cgit v1.2.3 From efee2013940fa4c57ec3b1ae046e64036864cc46 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 23 Jun 2011 01:10:24 +0200 Subject: updated mining CONFIGURE, more infos about what to do to use the mining Makefile: installs tmux --- mining/CONFIGURE | 3 +++ mining/Makefile | 1 + 2 files changed, 4 insertions(+) (limited to 'mining') diff --git a/mining/CONFIGURE b/mining/CONFIGURE index 6ddce386..299cbd53 100644 --- a/mining/CONFIGURE +++ b/mining/CONFIGURE @@ -2,4 +2,7 @@ How to Configure =============== 1. change the mining-url in ~/startup.sh +2. in KDE - 'AMDOverdriveCtrl - configure profile +3. in KDE-Autostart - activate the startup script 2. sudo /etc/init.d/gdm restart + diff --git a/mining/Makefile b/mining/Makefile index c673ee3e..b8ed2f6c 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -4,6 +4,7 @@ select-target: format: cat README install: + sudo apt-get install tmux echo '#!/bin/bash' > /usr/bin/ati_license echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license cp -r user /home -- cgit v1.2.3 From acd206da56f6ebfa123745cf6ab2f429d064363b Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Thu, 30 Jun 2011 22:55:26 +0200 Subject: added script to check btc guild miner status seems to be working --- mining/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mining') diff --git a/mining/Makefile b/mining/Makefile index 0fab7b1f..11058fb1 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -1,11 +1,11 @@ -.PHONY: all format install +.PHONY: all format install configure select-target: @echo "You are made of stupid!" echo "look here" @cat Makefile format: cat README -install: +install: configure apt-get install --yes lm-sensors echo '#!/bin/bash' > /usr/bin/ati_license echo '#!/bin/sh' > /etc/init.d/live-boot -- cgit v1.2.3 From 52237fa9912ac06ce89a1e61f8fde4d1a44cf828 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 3 Jul 2011 06:37:25 +0000 Subject: add mining/user/bin/ensure-wlan0 usage: combine this with cron to ensure wlan0 --- mining/user/bin/ensure-wlan0 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 mining/user/bin/ensure-wlan0 (limited to 'mining') diff --git a/mining/user/bin/ensure-wlan0 b/mining/user/bin/ensure-wlan0 new file mode 100755 index 00000000..92839a13 --- /dev/null +++ b/mining/user/bin/ensure-wlan0 @@ -0,0 +1,32 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +if ! ifconfig wlan0 | grep -q 'inet addr'; then + if ! grep -q wlan0 /etc/network/interfaces; then + cat >> /etc/network/interfaces < Date: Sun, 3 Jul 2011 06:43:01 +0000 Subject: add mining/user/bin/cleanup_tmp usage: combine this with cron to clean miner's .so-files from /tmp this was required @bergwerk to prevent filling up the tmpfs what stopped the miner... --- mining/user/bin/cleanup_tmp | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 mining/user/bin/cleanup_tmp (limited to 'mining') diff --git a/mining/user/bin/cleanup_tmp b/mining/user/bin/cleanup_tmp new file mode 100755 index 00000000..e1395b19 --- /dev/null +++ b/mining/user/bin/cleanup_tmp @@ -0,0 +1,4 @@ +#! /bin/sh +ls -lAtr /tmp/ | sed -rn ' + /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} +' | sudo sh -- cgit v1.2.3 From a754e3b290201f354f273628f65d811ca943c15a Mon Sep 17 00:00:00 2001 From: user Date: Fri, 8 Jul 2011 05:41:00 +0000 Subject: add mining/user/bin/ensure-router --- mining/user/bin/ensure-router | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 mining/user/bin/ensure-router (limited to 'mining') diff --git a/mining/user/bin/ensure-router b/mining/user/bin/ensure-router new file mode 100755 index 00000000..987ed5b1 --- /dev/null +++ b/mining/user/bin/ensure-router @@ -0,0 +1,25 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +if=eth2 + +if ! ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : + beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : + beep -l 50 -f 2500; /etc/init.d/dnsmasq restart + if ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500 -n -l 100 -f 3000 + else + beep -l 50 -f 2500 -n -l 100 -f 1000 + fi +else + case "${1-}" in + (--quiet) : ;; + (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;; + esac +fi -- cgit v1.2.3 From 615f11da5f781e817d016afebed8ac26ed6c83e7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 Jul 2011 06:34:05 +0000 Subject: masquerade wlan0, eth2 --- mining/user/bin/ensure-router | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mining') diff --git a/mining/user/bin/ensure-router b/mining/user/bin/ensure-router index 987ed5b1..ec78f610 100755 --- a/mining/user/bin/ensure-router +++ b/mining/user/bin/ensure-router @@ -12,6 +12,8 @@ if ! ifconfig $if | grep -q 'inet addr'; then beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : beep -l 50 -f 2500; /etc/init.d/dnsmasq restart + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE if ifconfig $if | grep -q 'inet addr'; then beep -l 50 -f 2500 -n -l 100 -f 3000 else -- cgit v1.2.3 From e03dc47d843f4ee351f59528bed7d8d581f827f7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 Jul 2011 17:24:48 +0200 Subject: mining: added archlinux cruise control mining/Makefile: added archlinux cruise control (auto installer) which always does the right thing. loosely after http://rubyists.github.com/2011/06/08/how-to-build-a-namecoin-or-bitcoin-miner-in98-easy-steps.html mining/{user/,}/bin:renamed mining/bin/newkey.sh: add policy Xorg keygen --- mining/Makefile | 40 +++++++++++++++++++++++++++++++++++++++- mining/bin/ati_temper | 5 +++++ mining/bin/cleanup_tmp | 4 ++++ mining/bin/ensure-router | 27 +++++++++++++++++++++++++++ mining/bin/ensure-wlan0 | 32 ++++++++++++++++++++++++++++++++ mining/bin/newkey.sh | 15 +++++++++++++++ mining/user/bin/ati_temper | 5 ----- mining/user/bin/cleanup_tmp | 4 ---- mining/user/bin/ensure-router | 27 --------------------------- mining/user/bin/ensure-wlan0 | 32 -------------------------------- 10 files changed, 122 insertions(+), 69 deletions(-) create mode 100755 mining/bin/ati_temper create mode 100755 mining/bin/cleanup_tmp create mode 100755 mining/bin/ensure-router create mode 100755 mining/bin/ensure-wlan0 create mode 100755 mining/bin/newkey.sh delete mode 100755 mining/user/bin/ati_temper delete mode 100755 mining/user/bin/cleanup_tmp delete mode 100755 mining/user/bin/ensure-router delete mode 100755 mining/user/bin/ensure-wlan0 (limited to 'mining') diff --git a/mining/Makefile b/mining/Makefile index b867d469..21db5091 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -5,7 +5,7 @@ select-target: @cat Makefile format: cat README -install: configure +fix-linucCoin: configure apt-get install --yes lm-sensors tmux echo '#!/bin/bash' > /usr/bin/ati_license echo '#!/bin/sh' > /etc/init.d/live-boot @@ -16,3 +16,41 @@ install: configure configure: sensors-detect @cat CONFIGURE +archlinux: + @echo "!! ARCHLINUX Cruise Control Mining installer !!" + @echo "** adding main network profile" + cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main + echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main + @echo "** adding worker account" + grep -q worker /etc/passwd || adduser worker + @echo "** adding archlinuxfr to pacman.conf" + grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf + + pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers + @echo "** installing tinc" + yaourt -S tinc + sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers + @echo "** Installing ATI drivers" + [ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils + [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook + [ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream + @echo "** installing X" + pacman --needed -S --noconfirm -f xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode xorg-twm + @echo "** copying bin folder" + cp -r bin /home/worker + @echo "** creating new .Xauthority for worker" + sudo -u worker /home/worker/bin/newkey.sh + @echo "configuring X" + @echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter." + @echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here" + @echo "!!press enter to continue" + lspci|grep VGA + read + aticonfig --initial=dual-head + vim /etc/X11/xorg.conf + @echo "** creating xinitrc and start x" + echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc + echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc + echo 'xterm &' >> /home/worker/.xinitrc + echo 'exec awesome' >> /home/worker/.xinitrc + @echo '!! start x with `xinit -- -auth ~/.Xauthority`' diff --git a/mining/bin/ati_temper b/mining/bin/ati_temper new file mode 100755 index 00000000..283a6024 --- /dev/null +++ b/mining/bin/ati_temper @@ -0,0 +1,5 @@ +#displays: CARD1TEMP CARD2TEMP CPUTEMP OUTSIDE +echo -n "`DISPLAY=:0 aticonfig --adapter=1 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`DISPLAY=:0 aticonfig --adapter=2 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` " +echo -n "`sensors | grep temp1 | sed -e 's/temp1: *+\([0-9.]*\).*/\1/'` " +echo "`temper`" diff --git a/mining/bin/cleanup_tmp b/mining/bin/cleanup_tmp new file mode 100755 index 00000000..e1395b19 --- /dev/null +++ b/mining/bin/cleanup_tmp @@ -0,0 +1,4 @@ +#! /bin/sh +ls -lAtr /tmp/ | sed -rn ' + /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}} +' | sudo sh diff --git a/mining/bin/ensure-router b/mining/bin/ensure-router new file mode 100755 index 00000000..ec78f610 --- /dev/null +++ b/mining/bin/ensure-router @@ -0,0 +1,27 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +if=eth2 + +if ! ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : + beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : + beep -l 50 -f 2500; /etc/init.d/dnsmasq restart + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE + beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE + if ifconfig $if | grep -q 'inet addr'; then + beep -l 50 -f 2500 -n -l 100 -f 3000 + else + beep -l 50 -f 2500 -n -l 100 -f 1000 + fi +else + case "${1-}" in + (--quiet) : ;; + (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;; + esac +fi diff --git a/mining/bin/ensure-wlan0 b/mining/bin/ensure-wlan0 new file mode 100755 index 00000000..92839a13 --- /dev/null +++ b/mining/bin/ensure-wlan0 @@ -0,0 +1,32 @@ +#! /bin/sh + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +if ! ifconfig wlan0 | grep -q 'inet addr'; then + if ! grep -q wlan0 /etc/network/interfaces; then + cat >> /etc/network/interfaces <&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - -if=eth2 - -if ! ifconfig $if | grep -q 'inet addr'; then - beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : - beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : - beep -l 50 -f 2500; /etc/init.d/dnsmasq restart - beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE - beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE - if ifconfig $if | grep -q 'inet addr'; then - beep -l 50 -f 2500 -n -l 100 -f 3000 - else - beep -l 50 -f 2500 -n -l 100 -f 1000 - fi -else - case "${1-}" in - (--quiet) : ;; - (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;; - esac -fi diff --git a/mining/user/bin/ensure-wlan0 b/mining/user/bin/ensure-wlan0 deleted file mode 100755 index 92839a13..00000000 --- a/mining/user/bin/ensure-wlan0 +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh - -if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - -if ! ifconfig wlan0 | grep -q 'inet addr'; then - if ! grep -q wlan0 /etc/network/interfaces; then - cat >> /etc/network/interfaces < Date: Fri, 8 Jul 2011 18:02:29 +0200 Subject: mining/bin/archlinux-cruise-control added script is pulled out from the original Makefile. added TODO file(because every project needs one --- mining/Makefile | 38 +------------------------------- mining/TODO | 2 ++ mining/bin/archlinux-cruise-control | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 mining/TODO create mode 100755 mining/bin/archlinux-cruise-control (limited to 'mining') diff --git a/mining/Makefile b/mining/Makefile index 21db5091..f8362cda 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -17,40 +17,4 @@ configure: sensors-detect @cat CONFIGURE archlinux: - @echo "!! ARCHLINUX Cruise Control Mining installer !!" - @echo "** adding main network profile" - cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main - echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main - @echo "** adding worker account" - grep -q worker /etc/passwd || adduser worker - @echo "** adding archlinuxfr to pacman.conf" - grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf - - pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers - @echo "** installing tinc" - yaourt -S tinc - sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers - @echo "** Installing ATI drivers" - [ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils - [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook - [ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream - @echo "** installing X" - pacman --needed -S --noconfirm -f xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode xorg-twm - @echo "** copying bin folder" - cp -r bin /home/worker - @echo "** creating new .Xauthority for worker" - sudo -u worker /home/worker/bin/newkey.sh - @echo "configuring X" - @echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter." - @echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here" - @echo "!!press enter to continue" - lspci|grep VGA - read - aticonfig --initial=dual-head - vim /etc/X11/xorg.conf - @echo "** creating xinitrc and start x" - echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc - echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc - echo 'xterm &' >> /home/worker/.xinitrc - echo 'exec awesome' >> /home/worker/.xinitrc - @echo '!! start x with `xinit -- -auth ~/.Xauthority`' + bin/archlinux-cruise-control diff --git a/mining/TODO b/mining/TODO new file mode 100644 index 00000000..bafaa72a --- /dev/null +++ b/mining/TODO @@ -0,0 +1,2 @@ +- fix the sed script in "make archlinux" to replace only the first occurrence +- test the amdoverdrive stuff from the home dir (user) diff --git a/mining/bin/archlinux-cruise-control b/mining/bin/archlinux-cruise-control new file mode 100755 index 00000000..d455d10e --- /dev/null +++ b/mining/bin/archlinux-cruise-control @@ -0,0 +1,44 @@ +#!/bin/bash +set -euf +export EDITOR=vim +echo "!! ARCHLINUX Cruise Control Mining installer !!" +echo "** adding main network profile" +cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main +echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main +echo "** adding worker account" +grep -q worker /etc/passwd || adduser worker +echo "** adding archlinuxfr to pacman.conf" +grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf +pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers +echo "** installing tinc" +[ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc +sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers +echo "** Installing ATI drivers" +[ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils +[ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook +[ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream +echo "** installing X" +pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode xorg-twm +echo "** Installing mining tools and overclocking stuff" +[ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn +echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!" +[ "`yaourt -Q amdoverdrivectrl`" ] || yaourt -S amdoverdrivectrl +echo "** copying bin folder" +cp -r $(readlink -f `dirname $0`)/ /home/worker +echo "** creating new .Xauthority for worker" +sudo -u worker /home/worker/bin/newkey.sh +echo "configuring X" +echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter." +echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here" +echo "!! press enter to continue" +lspci|grep VGA +read +aticonfig --initial=dual-head +vim /etc/X11/xorg.conf +echo "** creating xinitrc and start x" +echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc +echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc +echo 'xterm &' >> /home/worker/.xinitrc +echo 'exec twm' >> /home/worker/.xinitrc +echo '!! start x with `xinit -- -auth ~/.Xauthority`' + -- cgit v1.2.3 From d68cc2cacb434a7d7605c4a50671f4180d1afaba Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 07:11:12 +0000 Subject: mining Makefile: enable auto-configure --- mining/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mining') diff --git a/mining/Makefile b/mining/Makefile index f8362cda..8701920f 100644 --- a/mining/Makefile +++ b/mining/Makefile @@ -14,7 +14,7 @@ fix-linucCoin: configure echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license cp -r user /home configure: - sensors-detect + yes '' | sensors-detect @cat CONFIGURE archlinux: bin/archlinux-cruise-control -- cgit v1.2.3 From 8d5eeef8b3b1d1b78bf2e2cdaece50190a999b9a Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 07:12:45 +0000 Subject: enable-wlan0: handle the nightmare applet --- mining/bin/ensure-wlan0 | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'mining') diff --git a/mining/bin/ensure-wlan0 b/mining/bin/ensure-wlan0 index 92839a13..77587156 100755 --- a/mining/bin/ensure-wlan0 +++ b/mining/bin/ensure-wlan0 @@ -6,20 +6,28 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exit 23 # go to hell fi -if ! ifconfig wlan0 | grep -q 'inet addr'; then - if ! grep -q wlan0 /etc/network/interfaces; then - cat >> /etc/network/interfaces </dev/null +} + +if ! has_internet; then + + ## get rid of the nightmare applet + pkill -9 nm-applet + if test -x "`type -p nm-applet`"; then + rm -vf "`type -p nm-applet`" fi - beep -l 50 -f 2000; /etc/init.d/network-manager restart - beep -l 50 -f 2000; ifdown wlan0 - beep -l 50 -f 2000; ifup wlan0 - if ifconfig wlan0 | grep -q 'inet addr'; then + beep -l 50 -f 2000; pkill wpa_supplicant + beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & + while ! wpa_cli status | grep -q wpa_state=COMPLETED; do + beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 + sleep 1 + done + beep -l 50 -f 2000; dhcpcd -x wlan0 + beep -l 50 -f 2000; dhcpcd wlan0 + #echo nameserver 8.8.8.8 >/etc/resolv.conf + if has_internet; then beep -l 50 -f 2000 -n -l 100 -f 3000 else beep -l 50 -f 2000 -n -l 100 -f 1000 -- cgit v1.2.3 From bae7cf19fdf57b20e29e4d89e68c590f5931c470 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 07:53:10 +0000 Subject: ensure-wlan0: try harder --- mining/bin/ensure-wlan0 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'mining') diff --git a/mining/bin/ensure-wlan0 b/mining/bin/ensure-wlan0 index 77587156..95d626d2 100755 --- a/mining/bin/ensure-wlan0 +++ b/mining/bin/ensure-wlan0 @@ -12,13 +12,16 @@ has_internet() { if ! has_internet; then - ## get rid of the nightmare applet - pkill -9 nm-applet - if test -x "`type -p nm-applet`"; then - rm -vf "`type -p nm-applet`" - fi + ## get rid of the fuckers + for fucker in NetworkManager nm-applet; do + pkill -9 $fucker + if test -x "`type -p $fucker`"; then + rm -vf "`type -p $fucker`" + fi + done - beep -l 50 -f 2000; pkill wpa_supplicant + beep -l 50 -f 2000; pkill wpa + beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/* beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf & while ! wpa_cli status | grep -q wpa_state=COMPLETED; do beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000 -- cgit v1.2.3 From 9c76bcd1eef39df632a7a9ac70584ba7a90fb6b1 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 08:09:58 +0000 Subject: kill fuckers with even more hate --- mining/bin/ensure-wlan0 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'mining') diff --git a/mining/bin/ensure-wlan0 b/mining/bin/ensure-wlan0 index 95d626d2..fa92c4f5 100755 --- a/mining/bin/ensure-wlan0 +++ b/mining/bin/ensure-wlan0 @@ -2,7 +2,7 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then echo "we're going sudo..." >&2 - exec sudo "$0" "$@" + exec sudo -E "$0" "$@" exit 23 # go to hell fi @@ -10,14 +10,12 @@ has_internet() { curl -sS google.com >/dev/null } -if ! has_internet; then +if test "${force-false}" = true || ! has_internet; then ## get rid of the fuckers for fucker in NetworkManager nm-applet; do pkill -9 $fucker - if test -x "`type -p $fucker`"; then - rm -vf "`type -p $fucker`" - fi + (IFS=:; for dir in $PATH; do rm -vf $dir/$fucker; done) done beep -l 50 -f 2000; pkill wpa -- cgit v1.2.3 From aa57527badc83b49a73ac7708976d88079ea8c23 Mon Sep 17 00:00:00 2001 From: Chinaman Date: Sun, 10 Jul 2011 06:23:22 +0200 Subject: updated cruise control, now incompatible with linucCoin! mining/bin/newkey.sh: unused because slime is now in place mining/user/startup.sh: edited paths to miner, NOW INCOMPATIBLE with linucCoin (sucked anyway) temper/Makefile: fixed issue when installing temper (lose suid bit) --- mining/bin/archlinux-cruise-control | 34 ++++++++++++++++++++++++++++++---- mining/bin/newkey.sh | 15 --------------- mining/user/startup.sh | 15 ++++++--------- 3 files changed, 36 insertions(+), 28 deletions(-) delete mode 100755 mining/bin/newkey.sh mode change 100644 => 100755 mining/user/startup.sh (limited to 'mining') diff --git a/mining/bin/archlinux-cruise-control b/mining/bin/archlinux-cruise-control index d455d10e..de5a0fa4 100755 --- a/mining/bin/archlinux-cruise-control +++ b/mining/bin/archlinux-cruise-control @@ -7,9 +7,22 @@ cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main echo "** adding worker account" grep -q worker /etc/passwd || adduser worker +gpasswd -a worker wheel +gpasswd -a worker tty +gpasswd -a worker audio +gpasswd -a worker video +gpasswd -a worker network +gpasswd -a worker power + echo "** adding archlinuxfr to pacman.conf" grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf -pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers +echo "** installing all the required parts" +pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers beep +echo "** doing some tweaks" +rm /usr/bin/python -f +ln -s /usr/bin/python2 /usr/bin/python +echo "syntax on" > /home/worker/.vimrc +echo "syntax on" > /root/.vimrc echo "** installing tinc" [ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers @@ -18,7 +31,10 @@ echo "** Installing ATI drivers" [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook [ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream echo "** installing X" -pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode xorg-twm +pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim +echo "** editing slim configuration" +sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf +sed -i 's/.*auto_login.*/auto_login yes/' /etc/slim.conf echo "** Installing mining tools and overclocking stuff" [ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!" @@ -27,6 +43,13 @@ echo "** copying bin folder" cp -r $(readlink -f `dirname $0`)/ /home/worker echo "** creating new .Xauthority for worker" sudo -u worker /home/worker/bin/newkey.sh +mkdir -p /home/worker/.fluxbox +cp /krebs/mining/user/startup.sh /home/worker/startup.sh +chmod a+x /home/worker/startup.sh +cp /krebs/mining/user/startup.sh /home/worker/.fluxbox/startup +chmod a+x /home/worker/.fluxbox/startup +cp /krebs/mining/user/mining.ovdr /home/worker/ +chown -R worker:users /home/worker echo "configuring X" echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter." echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here" @@ -38,7 +61,10 @@ vim /etc/X11/xorg.conf echo "** creating xinitrc and start x" echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc +echo '/home/worker/startup.sh &' >> /home/worker/.xinitrc echo 'xterm &' >> /home/worker/.xinitrc -echo 'exec twm' >> /home/worker/.xinitrc -echo '!! start x with `xinit -- -auth ~/.Xauthority`' +echo 'exec fluxbox' >> /home/worker/.xinitrc +echo '!! start x with `xinit `' +echo 'add "x:5:respawn:/usr/bin/slim >/dev/null 2>&1" to /etc/inittab to start slim" + diff --git a/mining/bin/newkey.sh b/mining/bin/newkey.sh deleted file mode 100755 index e71ab85b..00000000 --- a/mining/bin/newkey.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -auth=$HOME/.Xauthority -cp /dev/null $auth - -if [ "$1" = "-md5" ]; then - key=`pstat -pfS | md5` -else - key=`perl -e 'srand; printf int(rand(10000000000000))'` - key=$key$key -fi - -xauth add unix:0 . $key - -xauth add ${HOST}:0 . $key diff --git a/mining/user/startup.sh b/mining/user/startup.sh old mode 100644 new mode 100755 index eb2ce13a..6274a892 --- a/mining/user/startup.sh +++ b/mining/user/startup.sh @@ -1,16 +1,13 @@ -sudo pkill xscreensaver sudo pkill tmux -sleep 1 +sleep 5 +source ~/.profile export DISPLAY=:0 - export URL="${URL-http://txgen_chinaman:lolwut@uk.btcguild.com:8332}" #export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334" -slock & tmux start-server tmux new-session -d -s mining -n mining -printenv > /home/user/environment -tmux new-window -t mining:1 'AMDOverdriveCtrl -i 0 mining.ovdr' -tmux new-window -t mining:2 'AMDOverdriveCtrl -i 3 mining.ovdr' +tmux new-window -t mining:1 'cd ~;AMDOverdriveCtrl -i 0 mining.ovdr' +tmux new-window -t mining:2 'cd ~;AMDOverdriveCtrl -i 3 mining.ovdr' sleep 5 -tmux new-window -t mining:3 "cd /opt/miners/phoenix; while sleep 1; do sudo python phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" -tmux new-window -t mining:4 "cd /opt/miners/phoenix; while sleep 1;do sudo python phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=10 FASTLOOPS=false ; done" +tmux new-window -t mining:3 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" +tmux new-window -t mining:4 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done" -- cgit v1.2.3 From a3a68df2e0b3c30eeb3ec7d9e8dbfb1e28e7613f Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 5 Aug 2011 15:37:36 +0200 Subject: ensure-router: also try /etc/rc.d/* --- mining/bin/ensure-router | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mining') diff --git a/mining/bin/ensure-router b/mining/bin/ensure-router index ec78f610..5eedabc9 100755 --- a/mining/bin/ensure-router +++ b/mining/bin/ensure-router @@ -8,10 +8,19 @@ fi if=eth2 +rc() { + for x in /etc/init.d/$1 /etc/rc.d/$1; do + if test -x $x; then + $x restart + break + fi + done +} + if ! ifconfig $if | grep -q 'inet addr'; then beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || : beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || : - beep -l 50 -f 2500; /etc/init.d/dnsmasq restart + beep -l 50 -f 2500; rc dnsmasq restart beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE if ifconfig $if | grep -q 'inet addr'; then -- cgit v1.2.3