maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] easyroot -- an even better way of becoming root (https://talk.maemo.org/showthread.php?t=14583)

fanoush 2008-01-07 23:44

Re: [Announce] easyroot -- an even better way of becoming root
 
Well, you can join the club and use same trick as above in your root script if you wish. Just modify gainroot as becomeroot does, possibly leaving out the echo, useless test for MODE etc, and launch su - from your root script via sudo gainroot like above. Would that be acceptable?

ag2 2008-01-08 01:26

Re: [Announce] easyroot -- an even better way of becoming root
 
I've made the changes suggested by fanoush. Version 1.0-2 should now be backward-compatible with 'sudo gainroot', plus I use exec whenever possible. Please give it a try.

BruceL 2008-01-08 04:36

Re: [Announce] easyroot -- an even better way of becoming root
 
Seems to work! Thanks!
EDIT: Oops that was premature. See next post.

BruceL 2008-01-08 04:50

Re: [Announce] easyroot -- an even better way of becoming root
 
Oops. No it doesn't work...
I do get root, but no sourcing of .profile or .bashrc and I still get the 7 lines of output.

ag2 2008-01-08 05:04

Re: [Announce] easyroot -- an even better way of becoming root
 
Are you typing 'root'?

Regarding 7 lines output, I realized that my package only saves 1 line. If you want to eliminate logging entirely, install bash from a parallel thread.

BruceL 2008-01-08 05:30

Re: [Announce] easyroot -- an even better way of becoming root
 
Yes I typed 'root' and it did take me to root. I tried rebooting. I tried both .profile and .bashrc. I could source them manually of course.

Thanks for the tip about bash.

fanoush 2008-01-08 08:42

Re: [Announce] easyroot -- an even better way of becoming root
 
Yes, '-' is missing after running su from /usr/sbin/gainroot in this version.
BTW the $@ expands to all arguments so you may get unexpected arguments inside [ ], try running it like "sudo gainroot 1 2 3". Maybe something easier like
Code:

if [ "$1" = "--use-su" ] ; then
or maybe even
Code:

[ "$1" = "--use-su" ] && exec su -
could do the trick.

ag2 2008-01-08 09:14

Re: [Announce] easyroot -- an even better way of becoming root
 
Quote:

Originally Posted by BruceL (Post 123044)
Yes I typed 'root' and it did take me to root. I tried rebooting. I tried both .profile and .bashrc. I could source them manually of course.

Thanks for the tip about bash.

I see. This works fine in bash, but not in busybox. I will switch back to 'su -' then. Thanks for reporting this.

ag2 2008-01-08 09:40

Re: [Announce] easyroot -- an even better way of becoming root
 
Quote:

Originally Posted by ag2 (Post 123101)
I see. This works fine in bash, but not in busybox. I will switch back to 'su -' then. Thanks for reporting this.

Should work better now. Please give it another try.

fanoush - thanks for the tip about $@.

|tbb| 2008-01-08 11:55

Re: [Announce] easyroot -- an even better way of becoming root
 
for those who will use becomeroot anyway and dont want to type sudo gainroot anytime, just make an alias like i do and save it under /home/user/.profile
file contains
alias sg="sudo gainroot"

from now u only have to type sg to "becomeroot"


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

vBulletin® Version 3.8.8