User:Pike/Shell tools

From Openmoko

< User:Pike
Revision as of 15:05, 27 August 2009 by Pike (Talk | contribs)

Jump to: navigation, search

Contents

Shell Tools

So many GUIs to do so many things - and they all crash or do the wrong thing - and what i need is always so simple.

So lately I keep a bunch of shell scripts to do the job - and link those from /usr/share/applications, as in

Exec=vala-terminal -e "/root/bin/somescript.sh; exit"

No big magic here. YMMV.

keeping the phone from falling asleep

Very usefull when using wifi or a navigator, or a alarm :-D

sleep-off.sh

#!/bin/sh
echo "never sleeping again"
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        Display enabled 
sleep 5

sleep-on.sh

#!/bin/sh
echo "Sleeping when I want"
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        Display auto 
sleep 5

wifi management

wifi-home.sh

This ofcourse requires you have configure your network/interfaces ..

#!/bin/sh

# power up wifi
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        WiFi enabled

# bounce eth0
iwconfig eth0 essid your_essid_here
ifdown eth0; ifup eth0

sleep 30

wifi-off.sh

#!/bin/sh

# power down wifi
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        WiFi disabled

sleep 5

gprs management

gprs-on.sh

#!/bin/sh
echo enabling gprs ..
APN="internet"
USERNAME=" "
PASSWORD=" "
BUSNAME="org.freesmartphone.ogsmd"
OBJECTPATH="/org/freesmartphone/GSM/Device"
METHODNAME="org.freesmartphone.GSM.PDP.ActivateContext"
mdbus -s $BUSNAME $OBJECTPATH $METHODNAME $APN "$USERNAME" "$PASSWORD"
sleep 5

gprs-off.sh

#!/bin/sh
echo "Disabling gprs"
BUSNAME="org.freesmartphone.ogsmd"
OBJECTPATH="/org/freesmartphone/GSM/Device"
METHODNAME="org.freesmartphone.GSM.PDP.DeactivateContext"
mdbus -s $BUSNAME $OBJECTPATH $METHODNAME
sleep 5

change paroli bg

Actually, I've only done this once. Saving it here for reference.

#!/bin/sh

BLAH=/usr/share/paroli/applications/paroli-launcher2/edje/default/images/bg.png
echo "put your bg in $BLAH"

cd /usr/share/paroli/applications/paroli-launcher2
edje_cc -id edje/default/images -id ../common-for-edje/images -fd ../common-for-edje/fonts \
	edje/default/paroli-launcher.edc -o paroli-launcher.edj
chmod +r paroli-launcher.edj
pkill paroli
DISPLAY=:0 paroli &
Personal tools

Shell Tools

So many GUIs to do so many things - and they all crash or do the wrong thing - and what i need is always so simple.

So lately I keep a bunch of shell scripts to do the job - and link those from /usr/share/applications, as in

Exec=vala-terminal -e "/root/bin/somescript.sh; exit"

No big magic here. YMMV.

keeping the phone from falling asleep

Very usefull when using wifi or a navigator, or a alarm :-D

sleep-off.sh

#!/bin/sh
echo "never sleeping again"
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        Display enabled 
sleep 5

sleep-on.sh

#!/bin/sh
echo "Sleeping when I want"
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        Display auto 
sleep 5

wifi management

wifi-home.sh

This ofcourse requires you have configure your network/interfaces ..

#!/bin/sh

# power up wifi
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        WiFi enabled

# bounce eth0
iwconfig eth0 essid your_essid_here
ifdown eth0; ifup eth0

sleep 30

wifi-off.sh

#!/bin/sh

# power down wifi
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage \
        org.freesmartphone.Usage.SetResourcePolicy \
        WiFi disabled

sleep 5

gprs management

gprs-on.sh

#!/bin/sh
echo enabling gprs ..
APN="internet"
USERNAME=" "
PASSWORD=" "
BUSNAME="org.freesmartphone.ogsmd"
OBJECTPATH="/org/freesmartphone/GSM/Device"
METHODNAME="org.freesmartphone.GSM.PDP.ActivateContext"
mdbus -s $BUSNAME $OBJECTPATH $METHODNAME $APN "$USERNAME" "$PASSWORD"
sleep 5

gprs-off.sh

#!/bin/sh
echo "Disabling gprs"
BUSNAME="org.freesmartphone.ogsmd"
OBJECTPATH="/org/freesmartphone/GSM/Device"
METHODNAME="org.freesmartphone.GSM.PDP.DeactivateContext"
mdbus -s $BUSNAME $OBJECTPATH $METHODNAME
sleep 5

change paroli bg

Actually, I've only done this once. Saving it here for reference.

#!/bin/sh

BLAH=/usr/share/paroli/applications/paroli-launcher2/edje/default/images/bg.png
echo "put your bg in $BLAH"

cd /usr/share/paroli/applications/paroli-launcher2
edje_cc -id edje/default/images -id ../common-for-edje/images -fd ../common-for-edje/fonts \
	edje/default/paroli-launcher.edc -o paroli-launcher.edj
chmod +r paroli-launcher.edj
pkill paroli
DISPLAY=:0 paroli &