|
2008-01-07
, 12:39
|
Posts: 130 |
Thanked: 13 times |
Joined on Dec 2007
|
#2
|
|
2008-01-07
, 14:44
|
Posts: 2,152 |
Thanked: 1,490 times |
Joined on Jan 2006
@ Czech Republic
|
#3
|
This is a simple utility for gaining root access. It is similar to (and inspired by) becomeroot, but better in a number of ways
The Following User Says Thank You to fanoush For This Useful Post: | ||
|
2008-01-07
, 20:59
|
Posts: 164 |
Thanked: 132 times |
Joined on Dec 2007
|
#4
|
Even if it is better, it should stay 100% compatible with 'sudo gainroot'. Looks like you tried but still I would suggest to drop '-' after su from /usr/sbin/gainroot to make it more compatible with original version. You can add it to your new root script so it is still 'easy'. So root script would become "sudo gainroot -" and in original gainroot use something like "exec su $@". Using exec will avoid one sh process in calling stack (=save some memory). Same could be done in your new root script so together you will save two waiting shells (try it with ps, top or htop from SDK repository).
|
2008-01-07
, 21:41
|
Posts: 2,152 |
Thanked: 1,490 times |
Joined on Jan 2006
@ Czech Republic
|
#5
|
#!/bin/sh if [ `id -u` != 0 ] ; then #if not already root, call itself as root exec sudo gainroot <<EOF exec $0 $* EOF exit $? fi #real script follows echo "I am `id`" echo "current dir is `pwd`"
|
2008-01-07
, 21:48
|
|
Posts: 3,096 |
Thanked: 1,525 times |
Joined on Jan 2006
@ Michigan, USA
|
#6
|
|
2008-01-07
, 22:16
|
Posts: 164 |
Thanked: 132 times |
Joined on Dec 2007
|
#7
|
|
2008-01-07
, 22:32
|
Posts: 2,152 |
Thanked: 1,490 times |
Joined on Jan 2006
@ Czech Republic
|
#8
|
fanoush -- I see your point. I will try the suggestions in your original post. If they work, I will update the script. Thanks once again for your feedback.
|
2008-01-07
, 22:37
|
|
Posts: 305 |
Thanked: 154 times |
Joined on Aug 2006
@ Colorado
|
#9
|
|
2008-01-07
, 22:56
|
Posts: 164 |
Thanked: 132 times |
Joined on Dec 2007
|
#10
|
* sources .bashrc and other startup scripts when turning on root mode
* correctly sets the home directory for user root
* doesn't force the built-in shell onto the user
In addition, there is now a shortcut for entering root mode - "root".
-----
Edit: newer version of easyroot is backward compatible with 'sudo gainroot'. The features above (e.g. sourcing of .bashrc) are only activated by typing 'root'. Thanks to fanoush for this suggestion.
-----
Sample session
[user@nokia ~]$ root
[root@nokia ~]$
Download easyroot here:
http://maemostuff.com
(PS This works for me, but it may not work for you. Backup your files just in case )
Last edited by ag2; 2008-01-30 at 07:50.