maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [N900] Script with desktop shortcut (https://talk.maemo.org/showthread.php?t=58613)

blwthompson 2010-07-17 03:36

[N900] Script with desktop shortcut
 
Hi All,

Basically i want to the following commands to run as a script when i press the shortcut on my desktop.

Code:

sudo gconftool -s /apps/osso/hildon-home/task-shortcuts-size -t int 62
sudo cd /usr/share/icons/blue-sky-icons/64x64/hildon
sudo mogrify -resize 48x48! *.png
sudo cd /usr/share/icons/blue-sky-icons/64x64/apps
sudo mogrify -resize 48x48! *.png
sudo cd /usr/share/themes/Blue-sky/
sudo mogrify -resize 62x62! ApplicationShortcutApplet.png
sudo mogrify -resize 62x62! ApplicationShortcutAppletPressed.png

sudo pkill hildon-home

Any ideas how i can achieve this??

Saturn 2010-07-17 14:29

Re: [N900] Script with desktop shortcut
 
2 Attachment(s)
Hi,

Copy the script (as user) at the following folder and give it execute rights:
Quote:

cp BlueSkyResize.sh.txt /usr/local/bin/BlueSkyResize.sh
chmod +x /usr/local/bin/BlueSkyResize.sh
(note, I've modified it a little)

The copy the .desktop file at:
Quote:

cp BlueSkyResize.desktop.txt /usr/share/applications/hildon/BlueSkyResize.desktop
Didn't test it, but should work.

dana.s 2010-07-17 14:39

Re: [N900] Script with desktop shortcut
 
or simply use Desktop Command Execution Widget

Kieron 2010-11-08 19:54

Re: [N900] Script with desktop shortcut
 
How can I do the same and run my script as root? Thanks, sorry to bump an old thread.

JonWW 2010-11-08 20:02

Re: [N900] Script with desktop shortcut
 
Assuming you have rootsh installed
Code:

echo "sh /path/to/script" | root

Kieron 2010-11-08 20:21

Re: [N900] Script with desktop shortcut
 
So something like:

Exec="sh /usr/local/bin/BlueSkyResize.sh" | root

is enough? thanks Jon!

JonWW 2010-11-08 20:58

Re: [N900] Script with desktop shortcut
 
Exec=echo "sh /usr/local/bin/BlueSkyResize.sh" | root

Kieron 2010-11-08 22:43

Re: [N900] Script with desktop shortcut
 
JonWW, another problem...

I've tried what you've said doing the following:

Quote:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Name=Enable Injection
Comment=NeoPwn Control Panel
Exec=echo "rmmod wl12xx; rmmod mac80211; rmmod cfg80211; insmod /home/user/MyDocs/neo/compat.ko; insmod /home/user/MyDocs/neo/rfkill_backport.ko; insmod /home/user/MyDocs/neo/cfg80211.ko; insmod /home/user/MyDocs/neo/mac80211.ko; insmod /home/user/MyDocs/neo/wl1251.ko; insmod /home/user/MyDocs/neo/wl1251_spi.ko" | root
Icon=injection_enable
Terminal=true
Type=Application
Categories=Tools
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
X-Text-Domain=NeoPwn

But its still not running as root. If I manually paste it in Xterm, it doesn't work either. If I type 'root' first, then type it, it works. Get what I mean?

What can I do to get around this?

Thanks again.

Saturn 2010-11-08 23:00

Re: [N900] Script with desktop shortcut
 
Quote:

Originally Posted by Kieron (Post 867480)
JonWW, another problem...

I've tried what you've said doing the following:



But its still not running as root. If I manually paste it in Xterm, it doesn't work either. If I type 'root' first, then type it, it works. Get what I mean?

What can I do to get around this?

Thanks again.

Put your code in a script which starts like:
Code:

#!/bin/sh

# gain superuser rights.

if [ `id -u` != 0 ] ; then
    exec sudo gainroot <<EOF
exec sh $0 $*
EOF
        exit $?
fi 

# put your code below

make it executable and you will be able to call it as user.

Cheers

Kieron 2010-11-08 23:10

Re: [N900] Script with desktop shortcut
 
Saturn, thank you, although that didn't work.

I'm having this issue where I can't run the below commands in a script, for whatever reason. I'm probably doing something wrong. I can run the commands manually, after I've typed 'root', else I get 'no such file or directory' and 'does not exist' errors. Could you assist? If you need more info please don't hesistate to ask, there is some on the neopwn howto thread as I was trying to troubleshoot there to no avail.

Summerising what I said, running the script doesn't work. But if I run this command, once I've rooted, it works.

Code:

rmmod wl12xx; rmmod mac80211; rmmod cfg80211; insmod /home/user/MyDocs/neo/compat.ko; insmod /home/user/MyDocs/neo/rfkill_backport.ko; insmod /home/user/MyDocs/neo/cfg80211.ko; insmod /home/user/MyDocs/neo/mac80211.ko; insmod /home/user/MyDocs/neo/wl1251.ko; insmod /home/user/MyDocs/neo/wl1251_spi.ko
script contents, for reference:

Code:

#!/bin/sh

# gain superuser rights.

if [ `id -u` != 0 ] ; then
    exec sudo gainroot <<EOF
exec sh $0 $*
EOF
        exit $?
fi 

rmmod wl12xx
rmmod mac80211
rmmod cfg80211
insmod /home/user/MyDocs/neo/compat.ko
insmod /home/user/MyDocs/neo/rfkill_backport.ko
insmod /home/user/MyDocs/neo/cfg80211.ko
insmod /home/user/MyDocs/neo/mac80211.ko
insmod /home/user/MyDocs/neo/wl1251.ko
insmod /home/user/MyDocs/neo/wl1251_spi.ko

and the script throws this output when it fails:

Code:

: not foundh: line 2:
does not exist in /proc/modules
does not exist in /proc/modules
does not exist in /proc/modules
': No such file or directoryer/MyDocs/neo/compat.ko
': No such file or directoryer/MyDocs/neo/rfkill_backport.ko
': No such file or directoryer/MyDocs/neo/cfg80211.ko
': No such file or directoryer/MyDocs/neo/mac80211.ko
': No such file or directoryer/MyDocs/neo/wl1251.ko
insmod: error inserting '/home/user/MyDocs/neo/wl1251_spi.ko': -1 Unknown symbol in module

for reference, the permissions of the files are:
Code:

-rwxr-xr-x 1 root staff
again, running the command manually works fine.

there is probably some fundamental flaw the in way im doing things, i just cant seem to figure it. hope you can help.

Thanks again.
K


All times are GMT. The time now is 16:40.

vBulletin® Version 3.8.8