View Single Post
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.