Active Topics

 


Reply
Thread Tools
Posts: 147 | Thanked: 12 times | Joined on Aug 2007 @ Washington State
#1
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 )

Last edited by frasej; 2008-01-09 at 21:43.
 
iancumihai's Avatar
Posts: 274 | Thanked: 143 times | Joined on Jun 2007 @ Romania
#2
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'
 

The Following User Says Thank You to iancumihai For This Useful Post:
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#3
Maybe a silly question..

Did you install 'becomeroot' in your new 2008os? (It is needed to run you script).
 
Posts: 147 | Thanked: 12 times | Joined on Aug 2007 @ Washington State
#4
Originally Posted by Saturn View Post
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's Avatar
Posts: 1,878 | Thanked: 646 times | Joined on Sep 2007 @ San Jose, CA
#5
is there a load applet for 2008 that lets you run commands? The one I saw in the 2008 repository doesn't.
 
Posts: 147 | Thanked: 12 times | Joined on Aug 2007 @ Washington State
#6
No, my mistake. It's actually osso-statusbar-cpu version 0.6.1chinook1. Sorry about the confusion.
 
Posts: 110 | Thanked: 12 times | Joined on Oct 2007 @ Cambridge, UK
#7
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...
 
Posts: 147 | Thanked: 12 times | Joined on Aug 2007 @ Washington State
#8
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's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
#9
"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.
 
Reply


 
Forum Jump


All times are GMT. The time now is 21:44.