Is there a way for me to run shell script in an app without needing root?
Sent from my Incredible using XDA App
Certainly. As long as the script doesn't do anything that needs elevated privileges (i.e. it can only run in the context of your app and only modify world-writable files, etc.)
What do you need your script to do?
Code:
Runtime.getRuntime().exec( "cmd" );
after I root is there some kind of linux command line utility I can use or are my newbie underpants showing. Just want to feel like I know what's going on underneath the covers.
paulmceh said:
after I root is there some kind of linux command line utility I can use or are my newbie underpants showing. Just want to feel like I know what's going on underneath the covers.
Click to expand...
Click to collapse
You can use terminal emulator good free app from the market. Just type su when you start the app each time so you have full access to the file system.
Crsdr37 said:
You can use terminal emulator good free app from the market. Just type su when you start the app each time so you have full access to the file system.
Click to expand...
Click to collapse
Awesome. Thanks a ton.
Crsdr37 said:
You can use terminal emulator good free app from the market. Just type su when you start the app each time so you have full access to the file system.
Click to expand...
Click to collapse
Don't forget to pick up busybox off the market so you have more useful commands similar to typical linux command line functions. It not required exactly, but does extend what you can do and there are plenty of other apps that will need it.
Or to properly root it and much easier 1 time only, use gingerbreak
http://forum.xda-developers.com/showthread.php?t=1055354
enjoy
Ok, to keep this short, i have an init.d script which executes a script in a different directory. The reason being is because the script in the different directory has a sleep statement where it waits until its done booting to execute the actual commands. However, the init.d script waits until the other script to finish before exiting, how can i exit the init.d script but let the other scrip run in background?
I looked it up, and google says to use nohup (in linux) but android says no apple found for nohup. And i believe if i used nohup it will work. so does anyone know how to do what im trying?
Hi all!
How I can configure the pie so it takes a screenshot?
up!
There is a forum specifically for questions (Hint: This isn't it)
You shouldn't bump your own threads
You should ask in the LMT thread itself: http://forum.xda-developers.com/showthread.php?t=1330150
There's a native "screencap" binary that can be setup to execute in a shell script, that you can then assign the script to run for specific pie location.
Sample code:
Code:
#command line screen capture
sleep 1
screencap -p /sdcard/Pictures/Screenshots/screencap_$(date +"%Y-%m-%d_%H-%M-%S").png
Adjust to your needs / location where you want the captures saved.
Drop your script in a file, such as "screen.sh", push to your phone, change permissions to make executable, point PIE to the script, and you're good to go.
styckx said:
There is a forum specifically for questions (Hint: This isn't it)
You shouldn't bump your own threads
You should ask in the LMT thread itself: http://forum.xda-developers.com/showthread.php?t=1330150
Click to expand...
Click to collapse
Sorry, I didn't know it.
JsChiSurf said:
There's a native "screencap" binary that can be setup to execute in a shell script, that you can then assign the script to run for specific pie location.
Sample code:
Code:
#command line screen capture
sleep 1
screencap -p /sdcard/Pictures/Screenshots/screencap_$(date +"%Y-%m-%d_%H-%M-%S").png
Adjust to your needs / location where you want the captures saved.
Drop your script in a file, such as "screen.sh", push to your phone, change permissions to make executable, point PIE to the script, and you're good to go.
Click to expand...
Click to collapse
Thanks
Edit: How I change permissions? I don't understand : point PIE to the script
Dejotaa said:
Sorry, I didn't know it.
Thanks
Edit: How I change permissions? I don't understand : point PIE to the script
Click to expand...
Click to collapse
From adb shell you can 'chmod' the file, or if you don't use adb, use a file manager instead. In adb, "chmod 777 screen.sh" should do the trick
In LMT, once your script is in place, and tested to work from the command line and/or terminal emulator, go to the 'PIE' tab, select the piece piece, i.e. "Pie item 1 longpress', scroll to 'Advanced Commands', select 'Script', point to the location where you placed the script, such as "/system/screen.sh, profit.
JsChiSurf said:
From adb shell you can 'chmod' the file, or if you don't use adb, use a file manager instead. In adb, "chmod 777 screen.sh" should do the trick
In LMT, once your script is in place, and tested to work from the command line and/or terminal emulator, go to the 'PIE' tab, select the piece piece, i.e. "Pie item 1 longpress', scroll to 'Advanced Commands', select 'Script', point to the location where you placed the script, such as "/system/screen.sh, profit.
Click to expand...
Click to collapse
Can you do the instructions for "dummies" ?
Edit:
Where I have to put the Screenshot.sh file for use "chmod 777 screenshot.sh" in adb?
Many things have changed within Ubuntu Touch. All of the tips and tweaks mentioned here have not been tested with newer Ubuntu Touch builds and many links are broken (and I can't fix them because I don't have all the files). If you do still want to try them proceed with caution!
Everyone is encouraged to share new tweaks in this thread. If you want I can add you to the first post so you can get the "Thank you" and all Ubuntu Touch users can easily find tweaks.
Old posts:
I want to explain you how to do simple UI changes (installing apps...) in Ubuntu Touch and do some other things under the hood.
First: Check out the Release notes. A lot of tweaking is explained there (changing language or keyboard layout).
I want to start with changing the system time zone:
Connect your device via SSH to your computer (explained in the release notes).
The type into a terminal:
sudo dpkg-reconfigure tzdata
Click to expand...
Click to collapse
root password is phablet
1. Change the system time zone
2. How to change the wallpaper.
3. How to update Ubuntu Touch without a PC
4. Create a simple web app
5. Installing Core Apps
If you see this smiley: You should type in the Terminal this: : p without the space.
How do I change my Ubuntu Touch Wallpaper?
This is really simple! Thanks to blmvxer showing us the path where all those wallpapers are! He made a really nice script for changing it. Check it out here: http://forum.xda-developers.com/showthread.php?t=2387117
First of all upload the script to a cloud storage (Google Drive does not work; I use Ubuntu One).
Optional: Create a goo.gl link out of this (easier; otherwise you might not know the filename).
I will post the script first:
wget http://goo.gl/{ID} && mv {ID} /usr/share/unity8/graphics/tablet_background.jpg && wget http://goo.gl/{ID} && mv {ID} /usr/share/unity8/graphics/phone_background.jpg
Click to expand...
Click to collapse
The first wget downloads the script. After that we move it to the right path (thanks again to blmvxer to show us the path). Then it downloads it again and replaces the second wallpaper. After a reboot you will have a new background.
How do I update the whole Ubuntu Touch without a PC?
Note: You can't update everything in the current builds but you can update a lot!
The first thing you have to do is adding a new repository to your Ubuntu Touch device. Open a Terminal and type:
sudo add-apt-repository ppahablet-team/ppa
Click to expand...
Click to collapse
After that hit
sudo apt-get update && sudo apt-get upgrade -y
Click to expand...
Click to collapse
. This updates your system. You can do this as often as you want.
I have created a simple script so I do not have to type in so much:
sudo apt-get update -y && sudo apt-get upgrade -y && sudo bash {myWallpaperchangescript} && sudo reboot
Click to expand...
Click to collapse
I have added the wallpaper change script because if unity gets updated you have to run it again because you have the purple wallpaper back again.
How to create a web app?
Create a *.desktop file with a text editor (I used gedit because it just works ).
Copy the following into the file:
[Desktop Entry]
Type=Application
Terminal=false
Exec=webbrowser-app --chromeless https://{put_URL_in_here}
Name={put_application_name_here]
Icon=/usr/share/{application_name}/{picturename}.png
X-Ubuntu-Touch=true
X-Ubuntu-StageHint=SideStage
Name[en_GB]=
Click to expand...
Click to collapse
Replace the text in “{}” with the variables of your choice.
Save the file.
Search for an icon which represents your web application. (You can find these icons on Google Play or anywhere else)
How do install my new web app?
Upload the file to a cloud storage of your choice (Google Drive does not work; I use http://one.ubuntu.com/) and create a public link. Copy the link.
Now we are going to create a script with a text editor:
{put_a_name_in_here}.sh
Now we are going to put content in:
wget http://{cloudservicelink}/{filename_or_ID}
Click to expand...
Click to collapse
This line downloads the *.desktop file onto your Ubuntu Touch device into the current folder. For my test app it would be: “wget http://ubuntuone.com/337i5uukUMjH4gtPehpdXq ”.
Second line:
mv {fileID} /usr/share/applications/{applicationname}.desktop
Click to expand...
Click to collapse
This moves the app into the directory where all the other apps are located. For my test-app it would be: “mv 337i5uukUMjH4gtPehpdXq /usr/share/applications/stadtbremerhaven.desktop”
In the third line we have to create a new directory for the icon:
mkdir /usr/share/{applicationname}
Click to expand...
Click to collapse
Important: You have to use the same path like in the *.desktop file!
In the fourth line we have to download the icon (I use the one from the Google Play Store):
wget http://goo.gl/{ID}
Click to expand...
Click to collapse
It is important to use http://goo.gl/ because other shorteners do not work!
An the last line:
mv {goo.glID} /usr/share/{applicationname}/{picturename}.png
Click to expand...
Click to collapse
This moves the icon into the right directory. It is important to use the picturename used in the *.desktop file.
My line looks like the following: “mv 0wEYju /usr/share/stadtbremerhaven/unnamed.png”
Great! You have now your first Ubuntu Touch web app (it is as REALLY simple one ).
Now we you have to connect the lines. Remove all new lines so it is a really long line and put between the different actions “&&”.
So for my app it looks like this:
wget http://ubuntuone.com/337i5uukUMjH4gtPehpdXq && mv 337i5uukUMjH4gtPehpdXq /usr/share/applications/stadtbremerhaven.desktop && mkdir /usr/share/stadtbremerhaven && wget http://goo.gl/0wEYju && mv 0wEYju /usr/share/stadtbremerhaven/unnamed.png
Click to expand...
Click to collapse
If you want to add more programms just add them after the last command with “&&”.
So for me it looks like this:
wget http://ubuntuone.com/337i5uukUMjH4gtPehpdXq && mv 337i5uukUMjH4gtPehpdXq /usr/share/applications/stadtbremerhaven.desktop && mkdir /usr/share/stadtbremerhaven && wget http://goo.gl/0wEYju && mv 0wEYju /usr/share/stadtbremerhaven/unnamed.png && wget http://ubuntuone.com/0f2KoDkZnre5lQMWqwsrP6 && mv 0f2KoDkZnre5lQMWqwsrP6 /usr/share/applications/duckduckgo.desktop && mkdir /usr/share/duckduckgo && wget http://goo.gl/Mzklu8 && mv Mzklu8 /usr/share/duckduckgo/unnamed.png
Click to expand...
Click to collapse
You can write a really large installer script with all of your web apps.
I have heard there is a mail client and there are other cool apps, too. Where can I f
To install all those apps you have to add a new repository. So type into a Terminal:
sudo add-apt-repository ppa:ubuntu-touch-coreapps-drivers/daily && sudo apt-get update
Click to expand...
Click to collapse
Now you have to install the right package:
sudo apt-get install touch-coreapps && sudo reboot
Click to expand...
Click to collapse
After the reboot you have those apps installed!
I hope you can understand everything, because I am not a native English speaker.
If you have any questions feel free to write a comment!
If you have tweaks and tips to share with the community it would be nice to post them in this thread so beginners can find them easily.
thx , gone try ubuntu touch later this day and wil use some of you tweaks / tricks
May I ask a question? Maybe sounds stupid.
Do these all mod applicable to non-nexus Ubuntu touch phone.
I mean the phone not directly supported by Ubuntu.
Sent from my Xperia S using xda app-developers app
All mods except this one should work. I don't know if you can update the whole Ubuntu Touch system with a not official supported device and I wouldn't try it. So juse the other tipps to make Ubuntu Touch your own.
To98 said:
This is really simple! Thanks to blmvxer showing us the path where all those wallpapers are! He made a really nice script for changing it. Check it out here: http://forum.xda-developers.com/showthread.php?t=2387117
First of all upload the script to a cloud storage (Google Drive does not work; I use Ubuntu One).
Optional: Create a goo.gl link out of this (easier; otherwise you might not know the filename).
I will post the script first:
The first wget downloads the script. After that we move it to the right path (thanks again to blmvxer to show us the path). Then it downloads it again and replaces the second wallpaper. After a reboot you will have a new background.
Click to expand...
Click to collapse
Thanks mate.
I have used a slightly different approach.
Open terminal on phone (Nexus 4 is mine) and enter
Code:
[B][I]sudo passwd root[/I][/B]
You will be prompted to enter a new password for the "root" user and then retype it.
OK that done I used the guide on this page, https://wiki.ubuntu.com/Touch/ReleaseNotes, to use sftp and FileZilla to login as "root". Now I could replace the phone_background.jpg file.
Crude and dirty, but works!
Best thing now is I can use sftp and FileZilla from Linux, Windows and Mac PC's/laptops.
Rasputin007 said:
...to use sftp and FileZilla to login as "root". Now I could replace the phone_background.jpg file.
Crude and dirty, but works!
Best thing now is I can use sftp and FileZilla from Linux, Windows and Mac PC's/laptops.
Click to expand...
Click to collapse
Interesting idea using FTP to change the background! Only one problem for me: After every update you have to do it again.
When you write a script you can add it to an updater script and you don't have to do it again.
But really interesting way of changing the wallpaper.
I am so used to use ftp/sftp with FileZilla for years now to mess with the phone file system. It started with the Linux based Motomagx OS from the Motorola V8, then I used it on the iPhones and like to use it on the Nexus 4 as well.
The problem with being logged in as "phablet" user is you can not replace files that belong to "root".
As "root" you can do anything, but then with great power comes great responsibility.
Another alternative could be a symlink. That's the nice thing about Linux, there is always more then one way to achieve the goal.
How to change brightness.
With the new Ubuntu Touch updates you can't change the brightness.
I have figured out how can adjust it via Terminal.
Open the Terminal and type
cd /sys/class/backlight
Click to expand...
Click to collapse
now type
cd
Click to expand...
Click to collapse
and press [TAB] and press [ENTER].
After that type
sudo nano brightness
Click to expand...
Click to collapse
and hit [ENTER]. Enter your password and change the value to everything you want. The problem with this is that you have to change it after every reboot.
If you have other tipps, please share them in this thread!
How can I block ads with Ubuntu Touch (or other unwanted sites)?
This is really easy.
Open the Terminal (or connect via SSH) and type
sudo nano /etc/hosts
Click to expand...
Click to collapse
Add you unwanted sites under the lines containing "localhost".
For Adblock search the internet for an adblocking hosts file and add the sites to your /etc/hosts file.
How can I change my hostname?
You want to change your Ubuntu Phone's hostname?
Type into a Terminal
sudo nano /etc/hostname && sudo nano /etc/hosts
Click to expand...
Click to collapse
In the first file change "phablet" (or any other current hostname) to the hostname of your choice. In the second change "phablet" (or any other current hostname) to the hostname you have set in /etc/hostname.
How can I change my password from "phablet" to something more secure to prevent installing of malware?
Type into a Terminal
passwd
Click to expand...
Click to collapse
enter the current password (phablet) and enter your new secure one. But be aware! You can't change the password back to "phablet" because it is to insecure.
To98 said:
With the new Ubuntu Touch updates you can't change the brightness.
I have figured out how can adjust it via Terminal.
Open the Terminal and type
now type and press [TAB] and press [ENTER].
After that type and hit [ENTER]. Enter your password and change the value to everything you want. The problem with this is that you have to change it after every reboot.
If you have other tipps, please share them in this thread!
Click to expand...
Click to collapse
I got no problem changing brightness , using the battery tab on the status bar
on nexus 4
davjan said:
I got no problem changing brightness , using the battery tab on the status bar
on nexus 4
Click to expand...
Click to collapse
With a recent update to unity8 you can't change the brightness.
Sent from my LG-LS970 using xda app-developers app
---------- Post added at 09:45 AM ---------- Previous post was at 09:42 AM ----------
To98 said:
With the new Ubuntu Touch updates you can't change the brightness.
I have figured out how can adjust it via Terminal.
Open the Terminal and type
now type and press [TAB] and press [ENTER].
After that type and hit [ENTER]. Enter your password and change the value to everything you want. The problem with this is that you have to change it after every reboot.
If you have other tipps, please share them in this thread!
Click to expand...
Click to collapse
Echo the brightness with an init.d script.
Or rename the modified file .bak and at startup have it replace the original.
Sent from my LG-LS970 using xda app-developers app
blmvxer said:
Echo the brightness with an init.d script.
Or rename the modified file .bak and at startup have it replace the original.
Sent from my LG-LS970 using xda app-developers app
Click to expand...
Click to collapse
I thought about that for me but I do not restart my phone often and when we are able to change brightness again, I have to delete the script.
But for other people it is a better workaround than mine.
To98 said:
The problem with this is that you have to change it after every reboot.
Click to expand...
Click to collapse
What about this command line?
Code:
[B]sudo chmod 0444 brightness[/B]
It would change the file property to read-only, meaning even the "system" user can not change this file.
Rasputin007 said:
What about this command line?
Code:
[B]sudo chmod 0444 brightness[/B]
It would change the file property to read-only, meaning even the "system" user can not change this file.
Click to expand...
Click to collapse
Does not work. It changes the brightness back. I have already tried that.