summaryrefslogtreecommitdiffstats
path: root/gold/mining
diff options
context:
space:
mode:
Diffstat (limited to 'gold/mining')
-rwxr-xr-xgold/mining/bin/archlinux-cruise-control13
-rwxr-xr-xgold/mining/bin/cleanup_tmp4
-rwxr-xr-xgold/mining/bin/ensure-wlan013
3 files changed, 21 insertions, 9 deletions
diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control
index de5a0fa4..ba1c35da 100755
--- a/gold/mining/bin/archlinux-cruise-control
+++ b/gold/mining/bin/archlinux-cruise-control
@@ -4,7 +4,7 @@ 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 'POST_UP="cache=\"\$(cat /etc/resolv.conf)\"; echo \"\$cache\" | sed \"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
@@ -25,7 +25,9 @@ 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
+cache="`cat /etc/sudoers`"
+echo "$cache" |
+sed '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
@@ -33,8 +35,11 @@ echo "** Installing ATI drivers"
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 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
+cache="`cat /etc/slim.conf`"
+echo "$cache" | sed '
+ s/.*default_user.*/default_user worker/
+ 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 !!"
diff --git a/gold/mining/bin/cleanup_tmp b/gold/mining/bin/cleanup_tmp
index e1395b19..ce72d906 100755
--- a/gold/mining/bin/cleanup_tmp
+++ b/gold/mining/bin/cleanup_tmp
@@ -1,4 +1,4 @@
#! /bin/sh
-ls -lAtr /tmp/ | sed -rn '
- /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}}
+ls -lAtr /tmp/ | sed -n '
+ /\.so$/{$!{s/.* \([A-Za-z0-9\]\+\.so\)$/rm -v \/tmp\/\1/p}}
' | sudo sh
diff --git a/gold/mining/bin/ensure-wlan0 b/gold/mining/bin/ensure-wlan0
index fa92c4f5..2ede2e8f 100755
--- a/gold/mining/bin/ensure-wlan0
+++ b/gold/mining/bin/ensure-wlan0
@@ -6,10 +6,17 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then
exit 23 # go to hell
fi
+locate_bin() {
+ type -p "$1" || find / | sed -n '/.*bin\/'"$1"'$/{p;q}' | grep .
+}
+
has_internet() {
curl -sS google.com >/dev/null
}
+wpa_supplicant="`locate_bin wpa_supplicant`"
+wpa_cli="`locate_bin wpa_cli`"
+
if test "${force-false}" = true || ! has_internet; then
## get rid of the fuckers
@@ -20,8 +27,8 @@ if test "${force-false}" = true || ! has_internet; then
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; $wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf || $wpa_supplicant -i wlan0 -c /etc/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
@@ -38,4 +45,4 @@ else
(--quiet) : ;;
(*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;;
esac
-fi
+fi 2>&1 | tee /var/log/ensure-wlan0