Hidden Shutdown Options - How do they work?

Se7enLC

Active Member
Joined
Nov 16, 2009
Messages
1,262
Reaction score
0
-Hidden Shutdown Options using keys (credit to Pete):
To Remove These Options Delete /system/bin/shutdown

*Shutdown: hold power & half pressed camera button
*Reboot: hold power & volume down button
*Reboot Recovery: hold power & volume up button


I was intrigued when the way to disable this new feature was to erase /system/bin/shutdown, so I looked at the contents of that script:

Code:
#!/system/bin/sh

stop;
stop dhcpcd;

sleep 1;

for i in `cat /proc/mounts | cut -f 2 -d " "`;
do
   busybox mount -o remount,ro $i 2>&1 > /dev/null;
done

sync;

if [ "$1" = "-r" ];
then
   toolbox reboot;
fi

if [ "$1" = "-rr" ];
then
   toolbox reboot recovery;
else 
   reboot -p;
fi

Looks pretty straightforward to me. That must not be what actually checks the keys, though. I looked at a diff between the V01 and V02 update files - and that shutdown script is the only change!

Does this mean that the hidden recovery options were there all along and the shutdown script was just missing? Did you have to do something else to enable this feature, Pete?

I'm tempted to go one step further and map those keys to OTHER things by editing this script. It'll be a little (a lot) kludgy to have a shutdown script that does other stuff that isn't shutting down, but remapping hardware keys to custom linux scripts can't be a bad thing...
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
I was trying to figure out how to just disable the camera button shutdown, but keep the reboot options. Tried adding this to the beginning of the script but not having any luck.

Code:
if [[ "$1" != "-r" && "$1" != "-rr" ]];
then
exit 0;
fi
 
OP
S

Se7enLC

Active Member
Joined
Nov 16, 2009
Messages
1,262
Reaction score
0
I was trying to figure out how to just disable the camera button shutdown, but keep the reboot options. Tried adding this to the beginning of the script but not having any luck.

Code:
if [[ "$1" != "-r" && "$1" != "-rr" ]];
then
exit 0;
fi

Try single brackets instead of double?
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
nope no go, on both versions none of the shutdown combos work after i've added the if statement.
 
OP
S

Se7enLC

Active Member
Joined
Nov 16, 2009
Messages
1,262
Reaction score
0
nope no go, on both versions none of the shutdown combos work after i've added the if statement.

Are you editing the file on the phone, or pushing it from a computer? I've been having some problems with files made on the phone for some reason. I think the semicolon key is wrong, perhaps?

Anyway, I pasted almost your exact change into the script, and changed all the actual commands to "echo" so I could test it without rebooting all the time. Running it from the commandline directly seems to work fine, only does something when you give it -r and -rr, does nothing when you give it no command.
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
got it, instead of creating the file on my pc and pushing it to the phone, i just edited the current shutdown script and it worked.

only thing is now, instead of shutdown with the camera button, it now just locks up the phone and i have to do a battery pull. the reboot ones work fine. Should i be exiting the script a different way than "exit 0;" ?
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
nope no go, on both versions none of the shutdown combos work after i've added the if statement.

Are you editing the file on the phone, or pushing it from a computer? I've been having some problems with files made on the phone for some reason. I think the semicolon key is wrong, perhaps?

Anyway, I pasted almost your exact change into the script, and changed all the actual commands to "echo" so I could test it without rebooting all the time. Running it from the commandline directly seems to work fine, only does something when you give it -r and -rr, does nothing when you give it no command.

hah, just saw this
 
OP
S

Se7enLC

Active Member
Joined
Nov 16, 2009
Messages
1,262
Reaction score
0
Here's the real (working) version. I just tested it out - the volume buttons still do stuff, camera button doesn't.

Make sure you chmod 0755 the file once you copy it in.
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
Here's the real (working) version. I just tested it out - the volume buttons still do stuff, camera button doesn't.

Make sure you chmod 0755 the file once you copy it in.

you sure this is the same one you tested? camera button still shuts down on me
 
OP
S

Se7enLC

Active Member
Joined
Nov 16, 2009
Messages
1,262
Reaction score
0
Here's the real (working) version. I just tested it out - the volume buttons still do stuff, camera button doesn't.

Make sure you chmod 0755 the file once you copy it in.

you sure this is the same one you tested? camera button still shuts down on me

Positive. But I'm running a non-standard shell for /system/bin/sh, so that could be it. I'll look into it a little closer later, perhaps.
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
Here's the real (working) version. I just tested it out - the volume buttons still do stuff, camera button doesn't.

Make sure you chmod 0755 the file once you copy it in.

you sure this is the same one you tested? camera button still shuts down on me

Positive. But I'm running a non-standard shell for /system/bin/sh, so that could be it. I'll look into it a little closer later, perhaps.

ah could be it, i'll keep digging. Thanks for the help
 

Tallica

Premium Member
Premium Member
Rescue Squad
Joined
Mar 17, 2010
Messages
3,259
Reaction score
1
Location
Middleboro, MA
This is how you stop it.

-Hidden Shutdown Options using keys (credit to Pete):
To Remove These Options Delete /system/bin/shutdown

to just disable rename the file to shutdown.bak
 

jgaikwad

New Member
Joined
May 25, 2010
Messages
14
Reaction score
0
This is how you stop it.

-Hidden Shutdown Options using keys (credit to Pete):
To Remove These Options Delete /system/bin/shutdown

to just disable rename the file to shutdown.bak


agreed, but i don't want to stop it all, just want to disable the camera button one.
 

Reserved Name

Member
Joined
Mar 7, 2010
Messages
59
Reaction score
0
magnets.jpg

magnets
 
Top