maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   xterminal "top" shortcut (https://talk.maemo.org/showthread.php?t=35858)

b666m 2010-02-19 17:10

Re: xterminal "top" shortcut
 
hi folks... i'm struggeling with this one...

my desktop-file:
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=RandomVid
Exec=/usr/bin/osso-xterm /etc/hildon-welcome.d/lalala.sh
Icon=terminal
#X-Window-Icon=
X-Window-Icon=   
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

i did chmod:
Code:

chmod 755 /etc/hildon-welcome.d/lalala.sh
chmod a+x doesn't seem to help too.

and my script:
Code:

#!/bin/bash

# determine number of files in /dconfs
cd /etc/hildon-welcome.d/dconfs/
nof=$(ls *.conf | wc -l)

# get random number
rn=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

# in range of 1 - nof
let "rr = $rn % $nof + 1"

# choose random conf
rf="$rr.conf"
echo "$rr.conf"

# copy it over to default.conf
cp $rf ../default.conf

# exit
exit 0

if i click on the shortcut a terminal opens up but then closes itself after a few seconds.

when i try to execute it (i'm already in the right folder) with:
Code:

lalala.sh
or
Code:

./lalala.sh
there is an error "/bin/sh: lalala.sh: not found" or "/bin/sh: ./lalala.sh: not found" :(

it only works with
Code:

sh lalala.sh
the echo-line shows up and my file gets replaced correctly :D

but i can't get the shortcut to work ;(

help appreciated! thanks in advance! :)

b666m 2010-02-19 17:47

Re: xterminal "top" shortcut
 
hmpf... i have to execute this whole script as root or a few commands in it... how do i do that!? o.O

b666m 2010-02-19 18:21

Re: xterminal "top" shortcut
 
tried to start it with
Exec=osso-xterm "sudo sh /etc/hildon-welcome.d/lalala.sh"
then i'm asked for the root password... -.-

even if i edit my script and write "sudo" before every command which have to be executed as root i'm getting asked for this password....

then i tried "sudo gainroot" as first line of my script.
it opens xterm but my script isn't executed...

it's driving me crazy o.O

ToJa92 2010-02-19 18:23

Re: xterminal "top" shortcut
 
I just type 'root' in the terminal when I want root access. I have installed rootsh, that may be it.

b666m 2010-02-19 18:43

Re: xterminal "top" shortcut
 
i have installed rootsh too.
and i can get root-access to my files via "sudo gainroot" in xterm.

but my problem is following:
i have a script and a desktop-shortcut to this script.

and now i have to execute this script with root-rights.
so how can this be done?

do i have to write something special after Exec= in the desktop-file?
do i have to write something special before the critical commands in the script?
what do i have to do!? i've tried so many things till now - nothing worked :(

fatalsaint 2010-02-19 18:48

Re: xterminal "top" shortcut
 
Code:

Exec=/bin/busybox sh -c 'echo /etc/hildon-welcome.d/lalala.sh | sudo gainroot'
Thanks goes here.

b666m 2010-02-19 19:13

Re: xterminal "top" shortcut
 
thanks for your reply... but that also doesn't work... :/

fatalsaint 2010-02-19 19:14

Re: xterminal "top" shortcut
 
Try adding the SH before it:

Quote:

Exec=/bin/busybox sh -c 'echo sh /etc/hildon-welcome.d/lalala.sh | sudo gainroot'

b666m 2010-02-19 19:19

Re: xterminal "top" shortcut
 
nope :(

i have added some echos in my script for watching where the problem might be...

but... if i click on the shortcut... a terminal opens up... it just says "randomvid", with a progress indicator to the right and a big black screen under the top bar...

after a few seconds the window closes itself :(

should i see my script running? (with all these echos in the terminal?!)

fatalsaint 2010-02-19 19:19

Re: xterminal "top" shortcut
 
As user.. run this in a terminal window:

echo sh /etc/hildon-welcome.d/lalala.sh | sudo gainroot


All times are GMT. The time now is 19:34.

vBulletin® Version 3.8.8