git » misc-scripts.git » commit 2a225ac

Cosmetical fixes

author Rodrigo Campos
2013-09-16 23:08:38 UTC
committer Rodrigo Campos
2013-09-16 23:10:03 UTC
parent 5e182e6cb5e8807b32a6febdb3ba8fbe234c9539

Cosmetical fixes

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>

batrat +3 -3
crous-login.py +1 -0

diff --git a/batrat b/batrat
index 590c843..ecf5fa4 100755
--- a/batrat
+++ b/batrat
@@ -12,10 +12,10 @@ load_power_supplies() {
 		i_dir=$(dirname $i)
 		i_type=$(cat $i)
 
-		if [ "$i_type"x = "Batteryx" ]; then
+		if [ "$i_type" = "Battery" ]; then
 			BATS="$BATS $i_dir"
 		fi
-		if [ "$i_type"x = "Mainsx" ]; then
+		if [ "$i_type" = "Mains" ]; then
 			ADPS="$ADPS $i_dir"
 		fi
 	done
@@ -27,7 +27,7 @@ detect_curr_supply() {
 	running_on="BAT"
 
 	for ac in $ADPS; do
-		if cat ${ac}/online | grep -q 1; then
+		if [ $(cat ${ac}/online) -eq 1 ]; then
 			running_on="AC"
 			return
 		fi
diff --git a/crous-login.py b/crous-login.py
index 5272f3a..e31b66c 100755
--- a/crous-login.py
+++ b/crous-login.py
@@ -25,6 +25,7 @@ def login(user, password):
 
     print "Got the form..."
 
+    # Do the POST to: <the same site we connected>/webauth/loginprocess
     payload = { "user": user, "pass": password }
     r = requests.post("http://google.com/webauth/loginprocess", data=payload)