From 160cf323734ff56981485fdbd5845d2b64f5b2f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 18 Jun 2011 16:34:52 +0200 Subject: initial commit of miner repo --- btc/mining/README | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 btc/mining/README (limited to 'btc/mining') diff --git a/btc/mining/README b/btc/mining/README new file mode 100644 index 00000000..ad8c3468 --- /dev/null +++ b/btc/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 596f87c8de1eee407ddd06a6f75f9557b34a7450 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 --- btc/mining/CONFIGURE | 5 +++++ btc/mining/Makefile | 11 +++++++++++ btc/mining/user/.config/autostart/startup.desktop | 6 ++++++ btc/mining/user/mining.odvr | 16 ++++++++++++++++ btc/mining/user/startup.sh | 16 ++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 btc/mining/CONFIGURE create mode 100644 btc/mining/Makefile create mode 100644 btc/mining/user/.config/autostart/startup.desktop create mode 100644 btc/mining/user/mining.odvr create mode 100644 btc/mining/user/startup.sh (limited to 'btc/mining') diff --git a/btc/mining/CONFIGURE b/btc/mining/CONFIGURE new file mode 100644 index 00000000..6ddce386 --- /dev/null +++ b/btc/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/btc/mining/Makefile b/btc/mining/Makefile new file mode 100644 index 00000000..c673ee3e --- /dev/null +++ b/btc/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/btc/mining/user/.config/autostart/startup.desktop b/btc/mining/user/.config/autostart/startup.desktop new file mode 100644 index 00000000..67c35ef8 --- /dev/null +++ b/btc/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/btc/mining/user/mining.odvr b/btc/mining/user/mining.odvr new file mode 100644 index 00000000..d6cf6fec --- /dev/null +++ b/btc/mining/user/mining.odvr @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/btc/mining/user/startup.sh b/btc/mining/user/startup.sh new file mode 100644 index 00000000..c330b984 --- /dev/null +++ b/btc/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 759b8b44f972a6bf5240bf80733f3645308e51cb Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 21 Jun 2011 17:06:05 +0200 Subject: added btcguild poll script --- btc/mining/poll_btcguild | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 btc/mining/poll_btcguild (limited to 'btc/mining') diff --git a/btc/mining/poll_btcguild b/btc/mining/poll_btcguild new file mode 100644 index 00000000..92a02657 --- /dev/null +++ b/btc/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 d5b7db9f0c0974df32eff95f35f82afdab0bcbc7 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 --- btc/mining/user/mining.odvr | 16 ---------------- btc/mining/user/mining.ovdr | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 btc/mining/user/mining.odvr create mode 100644 btc/mining/user/mining.ovdr (limited to 'btc/mining') diff --git a/btc/mining/user/mining.odvr b/btc/mining/user/mining.odvr deleted file mode 100644 index d6cf6fec..00000000 --- a/btc/mining/user/mining.odvr +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/btc/mining/user/mining.ovdr b/btc/mining/user/mining.ovdr new file mode 100644 index 00000000..d6cf6fec --- /dev/null +++ b/btc/mining/user/mining.ovdr @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + -- cgit v1.2.3 From dda7277f37d4f8ffaa334b528fd63f4389cf966b Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Wed, 22 Jun 2011 00:05:54 +0200 Subject: added ati_temper --- btc/mining/user/bin/ati_temper | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 btc/mining/user/bin/ati_temper (limited to 'btc/mining') diff --git a/btc/mining/user/bin/ati_temper b/btc/mining/user/bin/ati_temper new file mode 100755 index 00000000..283a6024 --- /dev/null +++ b/btc/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 f4acc6cc3d57be693bc79ec28ca05587f9d72b69 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 --- btc/mining/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'btc/mining') diff --git a/btc/mining/Makefile b/btc/mining/Makefile index c673ee3e..0fab7b1f 100644 --- a/btc/mining/Makefile +++ b/btc/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 3cf2e3aeef1f62429281399b2e7e3ae98408260d 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 --- btc/mining/user/startup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'btc/mining') diff --git a/btc/mining/user/startup.sh b/btc/mining/user/startup.sh index c330b984..eb2ce13a 100644 --- a/btc/mining/user/startup.sh +++ b/btc/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 54c2113d4082b9a28e6f317e3409db4821e10bb1 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 --- btc/mining/CONFIGURE | 3 +++ btc/mining/Makefile | 1 + 2 files changed, 4 insertions(+) (limited to 'btc/mining') diff --git a/btc/mining/CONFIGURE b/btc/mining/CONFIGURE index 6ddce386..299cbd53 100644 --- a/btc/mining/CONFIGURE +++ b/btc/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/btc/mining/Makefile b/btc/mining/Makefile index c673ee3e..b8ed2f6c 100644 --- a/btc/mining/Makefile +++ b/btc/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 4fb836b037f322e6228c7bf3267660a87d94f48b 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 --- btc/mining/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'btc/mining') diff --git a/btc/mining/Makefile b/btc/mining/Makefile index 0fab7b1f..11058fb1 100644 --- a/btc/mining/Makefile +++ b/btc/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 1fdcd5c5ed937474ab1ae7f665e4b7d83cd1c44a 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 --- btc/mining/user/bin/ensure-wlan0 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 btc/mining/user/bin/ensure-wlan0 (limited to 'btc/mining') diff --git a/btc/mining/user/bin/ensure-wlan0 b/btc/mining/user/bin/ensure-wlan0 new file mode 100755 index 00000000..92839a13 --- /dev/null +++ b/btc/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... --- btc/mining/user/bin/cleanup_tmp | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 btc/mining/user/bin/cleanup_tmp (limited to 'btc/mining') diff --git a/btc/mining/user/bin/cleanup_tmp b/btc/mining/user/bin/cleanup_tmp new file mode 100755 index 00000000..e1395b19 --- /dev/null +++ b/btc/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 220dd3a504f3c5d30baabfdf9a4fa44d583c297e 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 --- btc/mining/user/bin/ensure-router | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 btc/mining/user/bin/ensure-router (limited to 'btc/mining') diff --git a/btc/mining/user/bin/ensure-router b/btc/mining/user/bin/ensure-router new file mode 100755 index 00000000..987ed5b1 --- /dev/null +++ b/btc/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 6a6b56c1821d435131be8c9b67f4406816b1409a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 Jul 2011 06:34:05 +0000 Subject: masquerade wlan0, eth2 --- btc/mining/user/bin/ensure-router | 2 ++ 1 file changed, 2 insertions(+) (limited to 'btc/mining') diff --git a/btc/mining/user/bin/ensure-router b/btc/mining/user/bin/ensure-router index 987ed5b1..ec78f610 100755 --- a/btc/mining/user/bin/ensure-router +++ b/btc/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 185c18385da6ae11e7325a56bc4bdb0b6755886c 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 --- btc/mining/Makefile | 40 ++++++++++++++++++++++++++++++++++++++- btc/mining/bin/ati_temper | 5 +++++ btc/mining/bin/cleanup_tmp | 4 ++++ btc/mining/bin/ensure-router | 27 ++++++++++++++++++++++++++ btc/mining/bin/ensure-wlan0 | 32 +++++++++++++++++++++++++++++++ btc/mining/bin/newkey.sh | 15 +++++++++++++++ btc/mining/user/bin/ati_temper | 5 ----- btc/mining/user/bin/cleanup_tmp | 4 ---- btc/mining/user/bin/ensure-router | 27 -------------------------- btc/mining/user/bin/ensure-wlan0 | 32 ------------------------------- 10 files changed, 122 insertions(+), 69 deletions(-) create mode 100755 btc/mining/bin/ati_temper create mode 100755 btc/mining/bin/cleanup_tmp create mode 100755 btc/mining/bin/ensure-router create mode 100755 btc/mining/bin/ensure-wlan0 create mode 100755 btc/mining/bin/newkey.sh delete mode 100755 btc/mining/user/bin/ati_temper delete mode 100755 btc/mining/user/bin/cleanup_tmp delete mode 100755 btc/mining/user/bin/ensure-router delete mode 100755 btc/mining/user/bin/ensure-wlan0 (limited to 'btc/mining') diff --git a/btc/mining/Makefile b/btc/mining/Makefile index b867d469..21db5091 100644 --- a/btc/mining/Makefile +++ b/btc/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/btc/mining/bin/ati_temper b/btc/mining/bin/ati_temper new file mode 100755 index 00000000..283a6024 --- /dev/null +++ b/btc/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/btc/mining/bin/cleanup_tmp b/btc/mining/bin/cleanup_tmp new file mode 100755 index 00000000..e1395b19 --- /dev/null +++ b/btc/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/btc/mining/bin/ensure-router b/btc/mining/bin/ensure-router new file mode 100755 index 00000000..ec78f610 --- /dev/null +++ b/btc/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/btc/mining/bin/ensure-wlan0 b/btc/mining/bin/ensure-wlan0 new file mode 100755 index 00000000..92839a13 --- /dev/null +++ b/btc/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/btc/mining/user/bin/ensure-wlan0 b/btc/mining/user/bin/ensure-wlan0 deleted file mode 100755 index 92839a13..00000000 --- a/btc/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 --- btc/mining/Makefile | 38 +--------------------------- btc/mining/TODO | 2 ++ btc/mining/bin/archlinux-cruise-control | 44 +++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 btc/mining/TODO create mode 100755 btc/mining/bin/archlinux-cruise-control (limited to 'btc/mining') diff --git a/btc/mining/Makefile b/btc/mining/Makefile index 21db5091..f8362cda 100644 --- a/btc/mining/Makefile +++ b/btc/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/btc/mining/TODO b/btc/mining/TODO new file mode 100644 index 00000000..bafaa72a --- /dev/null +++ b/btc/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/btc/mining/bin/archlinux-cruise-control b/btc/mining/bin/archlinux-cruise-control new file mode 100755 index 00000000..d455d10e --- /dev/null +++ b/btc/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 e03b7fc183deb56cf71eb9095257356d4c2c54dc Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 07:11:12 +0000 Subject: mining Makefile: enable auto-configure --- btc/mining/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'btc/mining') diff --git a/btc/mining/Makefile b/btc/mining/Makefile index f8362cda..8701920f 100644 --- a/btc/mining/Makefile +++ b/btc/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 4be9983acfdf35e4cfe54dc116163f1ec392f3a9 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 --- btc/mining/bin/ensure-wlan0 | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'btc/mining') diff --git a/btc/mining/bin/ensure-wlan0 b/btc/mining/bin/ensure-wlan0 index 92839a13..77587156 100755 --- a/btc/mining/bin/ensure-wlan0 +++ b/btc/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 87baf64466d7ec70dca49e822dc39aaae180ab65 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 9 Jul 2011 07:53:10 +0000 Subject: ensure-wlan0: try harder --- btc/mining/bin/ensure-wlan0 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'btc/mining') diff --git a/btc/mining/bin/ensure-wlan0 b/btc/mining/bin/ensure-wlan0 index 77587156..95d626d2 100755 --- a/btc/mining/bin/ensure-wlan0 +++ b/btc/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 b5104a43414627d59fb5f507939cefc04bf34c94 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 --- btc/mining/bin/ensure-wlan0 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'btc/mining') diff --git a/btc/mining/bin/ensure-wlan0 b/btc/mining/bin/ensure-wlan0 index 95d626d2..fa92c4f5 100755 --- a/btc/mining/bin/ensure-wlan0 +++ b/btc/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 ce73e24c7559c5e80ad54218c5b2f2ff507dda42 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) --- btc/mining/bin/archlinux-cruise-control | 34 +++++++++++++++++++++++++++++---- btc/mining/bin/newkey.sh | 15 --------------- btc/mining/user/startup.sh | 15 ++++++--------- 3 files changed, 36 insertions(+), 28 deletions(-) delete mode 100755 btc/mining/bin/newkey.sh mode change 100644 => 100755 btc/mining/user/startup.sh (limited to 'btc/mining') diff --git a/btc/mining/bin/archlinux-cruise-control b/btc/mining/bin/archlinux-cruise-control index d455d10e..de5a0fa4 100755 --- a/btc/mining/bin/archlinux-cruise-control +++ b/btc/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/btc/mining/bin/newkey.sh b/btc/mining/bin/newkey.sh deleted file mode 100755 index e71ab85b..00000000 --- a/btc/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/btc/mining/user/startup.sh b/btc/mining/user/startup.sh old mode 100644 new mode 100755 index eb2ce13a..6274a892 --- a/btc/mining/user/startup.sh +++ b/btc/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 ff6394d17bdaed9a522c2add967ffbd5574e68b7 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/* --- btc/mining/bin/ensure-router | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'btc/mining') diff --git a/btc/mining/bin/ensure-router b/btc/mining/bin/ensure-router index ec78f610..5eedabc9 100755 --- a/btc/mining/bin/ensure-router +++ b/btc/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