Greg Morgan wrote:
Of course the challenge is doing
something with root.
If you have r&d mode enabled there is easy trick for shell scripts.
#!/bin/sh
# use gainroot to become root and relaunch itself
if [ `id -u` != 0 ] ; then
#if not already root, call itself as root
sudo gainroot <<EOF
$0 $*
EOF
exit
fi
# real script follows
The only problem is that with this stdin is not original console used
for launching. If this is needed there is workaround like adding
TTY=`tty`
before 'sudo gainroot <<EOF' line and using
$0 <$TTY $*
But there should be also check if tty returns 'not a tty'.
Frantisek
_______________________________________________
maemo-developers mailing list
[email protected]
https://maemo.org/mailman/listinfo/maemo-developers