maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Running root commands with load-applet? (https://talk.maemo.org/showthread.php?t=14730)

frasej 2008-01-09 20:41

Running root commands with load-applet?
 
Before I upgraded to OS2008, I was able to run commands that required root level permissions, from load-applet's Run Command menu item. Unfortunately, I forgot to write down how I did it. :(
I thought it was using sudo, but that doesn't seem to have worked. Does anyone know how to do this? (I'll remember to write down the answer this time)

Update: Since I was running a script file (.sh) I was able to use the following code to get it done. This is a workaround, as I was able to do it from a single line before.

Code:

#!/bin/sh
if [ `id -u` != 0 ] ; then
#if not already root, call itself as root
        exec sudo gainroot <<EOF
exec sh $0 $*
EOF
        exit $?
fi
#real script follows
chroot /mnt/initfs dsmetest -l 3
exit

And thanks to who ever I borrowed this code from. (My memory is getting worse every day :eek: )

iancumihai 2008-01-09 22:54

Re: Running root commands with load-applet?
 
add the command you whant tto run from load applet in /etc/sudoers
and run it from load-applet uusing sudo.

EG: in sudoers add the $CMD (fullpath) and run it as 'sudo $CMD'

Saturn 2008-01-10 09:51

Re: Running root commands with load-applet?
 
Maybe a silly question..

Did you install 'becomeroot' in your new 2008os? (It is needed to run you script).

frasej 2008-01-10 18:14

Re: Running root commands with load-applet?
 
Quote:

Originally Posted by Saturn (Post 124647)
Maybe a silly question..

Did you install 'becomeroot' in your new 2008os? (It is needed to run you script).

Yes. But that wasn't it. The script I posted runs. What I had before was just one line. Something like:
Code:

su chroot /mnt/initfs dsmetest -l 3
But it wasn't su.

johnkzin 2008-01-10 21:32

Re: Running root commands with load-applet?
 
is there a load applet for 2008 that lets you run commands? The one I saw in the 2008 repository doesn't.

frasej 2008-01-11 16:13

Re: Running root commands with load-applet?
 
No, my mistake. It's actually osso-statusbar-cpu version 0.6.1chinook1. Sorry about the confusion.

cdmackay 2008-01-17 01:52

Re: Running root commands with load-applet?
 
really dumb question, please: how do I get osso-statusbar-cpu to run cmdline (i.e. non-UI) commands? I tried "osso-xterm -e blah", but no good...

frasej 2008-01-17 15:26

Re: Running root commands with load-applet?
 
Click on its icon and select "Run command...", or if it's something you want to do repeatedly, click on "Settings...", then the "Commands" button, and enter it as a new command.

tz1 2008-01-18 15:10

Re: Running root commands with load-applet?
 
"echo touch /x | sudo gainroot" where "touch /x" is the program (run as su but with user environment)? This might need to be in a script for some launchers.


All times are GMT. The time now is 01:57.

vBulletin® Version 3.8.8