Thread Tools
Posts: 153 | Thanked: 81 times | Joined on Oct 2011 @ New Zealand
Ok this is simple when you know how, to utilise opensh within your script.... well I'm being misleading, this way uses two scripts, here's my examples:
# Gain root access and execute copy script.
opensh /home/user/MyDocs/Documents/Scripts/
This script( executes opensh, and hence gains root, it then executes the script.
Having the next command (that calls on the same line as the opensh call like that is the trick.
# Copy overclock modules to their usable destination.
cp /home/user/MyDocs/Documents/oc-modules-pr1.2/*.ko /lib/modules/
As you've probably figured out already, because this script has been executed from a script that has already gained root access, it essentially has root access, you need root access to modify the directory, so the script would not work otherwise.

Obviously these examples are to copy CreamyGoodness's Overclock kernel modules to where they can be used, and are set to how my own MyDocs folder is arranged, you'll most likely have to do a little adjusting for your own use, directory wise.

If you don't know how to run scripts I don't know why you're here, but this post has been awfully noob friendly so far so heres a wee pointer, google something like "helloworld script", there's no shortage of material on how to write and execute scripts. All you people asking for scripts for those modules, well I just laid the groundwork for you, now do it yourself!

Here's my source(forum not code) if you'd like to figure out how to use devel-su within a script, for distribution to people without opensh/Inception etc.
Shell scripts: gain root access - how?
I may edit this post to include a tutorial of that later down the road.

Last edited by HanzBlix; 2012-04-03 at 06:51.

The Following 3 Users Say Thank You to HanzBlix For This Useful Post:
coderus's Avatar
Posts: 6,090 | Thanked: 11,379 times | Joined on Nov 2011 @ Open Mobile Platform, Innopolis, Russia
thanks, Capitan Oblivious =)
opensh -c "cp /home/user/MyDocs/file.ko /lib/***"
devel-su -c "cp /home/user/MyDocs/file.ko /lib/***"

Last edited by coderus; 2012-04-03 at 11:10.

Thread Tools

Forum Jump

All times are GMT. The time now is 05:06.