Copy only modified files in s folder? - Tasker Tips & Tricks

I have a folder and I want to only copy the files in it to a different folder, there are other folders in it that I do not want to copy. The files have various extensions and some have none. I can copy the whole folder but that will also sub the other folders in it, I am not sure how to do this.

Use a list files action to create a variable with everything (files and directories) in the directory you want to copy files from:
Code:
A1: List Files [
Dir: Download
Match:
Include Hidden Files: Off
Use Root: Off
Sort Select: Alphabetic
Variable: %testfiles
]
Then open FOR loop so you can act on each item in the variable created above:
Code:
A2: For [
Variable: %testfile
Items: %testfiles()
]
Now test to see if you're dealing with a file or not:
Code:
A3: Test File [
Type:Type
Data: %testfile
Store Result In: %test
Use Root: Off
]
If the entry tests as a file, copy it to the new location:
Code:
A4: Copy File [
From: %testfile
To: test/
Use Root: Off
] If [ %test ~ file ]
End the FOR loop:
Code:
A5: End For
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers

Related

[Help] Save MMS On Received

I have this setup and its working but not how I want.*
Code:
Save (66)
A1: List Files [ Dir:/data/data/com.android.providers.telephony/app_parts/ Match: Include Hidden Files:eek:n Use Root:eek:n Variable:%Pics ]
A2: Variable Set [ Name:%ContactName To:%SMSRN Do Maths:eek:ff Append:eek:ff ]
A3: For [ Variable:%Pics Items:%Pics() ]
A4: Copy File [ From:%Pics To:DCIM/Contact Pics/%SMSRN_%SMSRT.mp4 Use Root:eek:n ] If [ %Pics ~ *.mp4* & %SMSRT ~ %SMSRT ]
A5: Copy File [ From:%Pics To:DCIM/Contact Pics/%SMSRN_%SMSRT.jpg Use Root:eek:n ] If [ %Pics ~ *.jpg* & %SMSRT ~ %SMSRT ]
A6: Delete File [ File:%Pics Shred Level:0 Use Root:eek:n ]
A7: End For
What I have is not in this but when this runs it then deletes the file. Which in turns makes it so it's removed from message thread. How can I make this only copy new files and retain the old ones?
Sent from my Nexus 6P using Tapatalk
Save (66)
A1: List Files [ Dir:/data/data/com.android.providers.telephony/app_parts/ Match: Include Hidden Filesn Use Rootn Variable:%Pics ]
A2: Variable Set [ Name:%ContactName To:%SMSRN Do Mathsff Appendff ]
A3: Variable Set [ Name:%LastDate To:%FileDate Do Mathsff Appendff ]
A4: For [ Variable:%Pics Items:%Pics() ]
A5: Test File [ Type:Modified Data:%Pics Store Result In:%FileDate Use Rootn ]
A6: Copy File [ From:%Pics ToCIM/Contact Pics/%SMSRN_%SMSRT.mp4 Use Rootn ] If [ %Pics ~ *.mp4* & %FileDate > %LastDate ]
A7: Copy File [ From:%Pics ToCIM/Contact Pics/%SMSRN_%SMSRT.jpg Use Rootn ] If [ %Pics ~ *.jpg* & %FileDate > %LastDate ]
A8: End For
This seems to work I'd anyone else wants to use it
Sent from my Nexus 6P using Tapatalk
Hey so this code is good but not great. Anyone know how to write it better? Its really resource heavy.
Save (66)
A1: List Files [ Dir:/data/data/com.android.providers.telephony/app_parts/ Match: Include Hidden Filesn Use Rootn Variable:%Pics ]
A2: Variable Set [ Name:%ContactName To:%SMSRN Do Mathsff Appendff ]
A3: Variable Set [ Name:%LastDate To:%FileDate Do Mathsff Appendff ]
A4: For [ Variable:%Pics Items:%Pics() ]
A5: Test File [ Type:Modified Data:%Pics Store Result In:%FileDate Use Rootn ]
A6: Copy File [ From:%Pics ToCIM/Contact Pics/%SMSRN_%SMSRT.mp4 Use Rootn ] If [ %Pics ~ *.mp4* & %FileDate > %LastDate ]
A7: Copy File [ From:%Pics ToCIM/Contact Pics/%SMSRN_%SMSRT.jpg Use Rootn ] If [ %Pics ~ *.jpg* & %FileDate > %LastDate ]
A8: [X] Delete File [ File:%Pics Shred Level:0 Use Rootn ]
A9: End For
Sent from my Nexus 6P using Tapatalk

[HOW TO] Integrate Tasker with Allo (requires root)

I woud like to share the task I created to send commands to Allo.
The concept is very simple.
1) Insert a record on Allo's database and call the app to trigger the query.
2) Set a profile that get the notification and read the answer directly from the database.
3) Use the result to do anything you want: TTS, set a widget (Zooper, Minimalistic, etc)
It requires ROOT and Sqlite binary installed to read the database. In this case, I'm using sqlite's binary that comes with Titanium Backup (/data/data/com.keramidas.TitaniumBackup/files/sqlite3)
Before you run this task you need to set %sqlite variable with sqlite full path, also you will need enable the accessibility settings to Tasker in order to intercept the system notifications.
This task has to be called with the command as a parameter, or you can edit %text variable with your command directly
Code:
Allo - Send (152)
A1: Stop [ With Error:eek:ff Task: ] If [ %par1 !Set ]
A2: Variable Set [ Name:%text To:%par1 Do Maths:eek:ff Append:eek:ff ]
<Set SQLITE path>
A3: Variable Set [ Name:%sqlite To:/data/data/com.keramidas.TitaniumBackup/files/sqlite3 Do Maths:eek:ff Append:eek:ff ]
<Insert command into Allo database table>
A4: Run Shell [ Command:%sqlite /data/data/com.google.android.apps.fireball/databases/fireball.db "insert into messages (message_id, conversation_id, sender_id, received_timestamp, server_timestamp, message_status, seen, read_status, text, initial_insert_timestamp,type) VALUES (lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(6))), (SELECT _id FROM conversations WHERE participant_normalized_destination = 'google' limit 1), 1, strftime('%s000', 'now'), strftime('%s000000', 'now'), 3, 1, 1, '%text', strftime('%s000', 'now'), 2);
select last_insert_rowid() ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
<Store the inserted record ID into a global variable>
A5: Variable Set [ Name:%ALLO_ID To:%out Do Maths:eek:ff Append:eek:ff ]
<Launch Allo to process the command>
A6: Launch App [ App:Allo Data: Exclude From Recent Apps:eek:ff Always Start New Copy:eek:ff ]
A7: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
<This is necessary in order to receive an Allo notification with the answer>
A8: Go Home [ Page:0 ]
You will notice the global variable %ALLO_ID used to set the _id of the inserted record. You will need it later in order to recover Allo's answers.
This is a Task example to read the answer and say it by "text to speech". But you can do other automation tasks as you need.
Code:
Allo - Say (154)
A1: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A2: Variable Set [ Name:%sqlite To:/data/data/com.keramidas.TitaniumBackup/files/sqlite3 Do Maths:eek:ff Append:eek:ff ]
A3: Run Shell [ Command:%sqlite /data/data/com.google.android.apps.fireball/databases/fireball.db "select text from messages where message_id like 'R:google%' and text is not null and _id > '%ALLO_ID' ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A4: If [ %out !Set ]
A5: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A6: Run Shell [ Command:%sqlite3 /data/data/com.google.android.apps.fireball/databases/fireball.db "select text from messages where message_id like 'R:google%' and text is not null and _id > '%ALLO_ID' ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A7: End If
A8: Flash [ Text:%out Long:eek:ff ]
A9: Say [ Text:%out Engine:Voice:default:default Stream:3 Pitch:4 Speed:4 Respect Audio Focus:eek:n Network:eek:ff Continue Task Immediately:eek:ff ]
Sample Project with the Tasks:
View attachment Allo.prj.xml
Share yours Allo's commands here. What would you automate with this ?
ok, this looks pretty awesome ..I'm trying to get Google spoken search results on my huawei watch and this looks promising
ok, yeah, this is super awesome .. I now have 'limited' spoken Google search results on my huawei watch ... ( I'm a junkie addicted to autovoice+wearshell+ tasker ) ...
QUESTION: spoken search results are limited because many of the answers Google Assistant provides aren't just plain text ... so, how could the notification from Allo be parsed or converted or whatever? could AutoNotifications tasker plugin accomplish this? or some other tasker plugin?
...this project is still awesome as is though wow
I have imported the Project, Tested it gives me error when I run the Say Task after running the Test Task.
I have titaniumbackup pro installed and also set fullpath to variable.
There is error on the Run Shell Action. What can I do>?
Also tested Tasker has Root by using shell action input taps.
fenchai said:
I have imported the Project, Tested it gives me error when I run the Say Task after running the Test Task.
I have titaniumbackup pro installed and also set fullpath to variable.
There is error on the Run Shell Action. What can I do>?
Also tested Tasker has Root by using shell action input taps.
Click to expand...
Click to collapse
my import worked and I DID NOT set the fullpath variable ... I also have Titanium Backup pro installed ...
try deleting the project, then back fully out of tasker, then import project again and MAKE NO CHANGES .. just run the test and see what happens
pablo71 said:
my import worked and I DID NOT set the fullpath variable ... I also have Titanium Backup pro installed ...
try deleting the project, then back fully out of tasker, then import project again and MAKE NO CHANGES .. just run the test and see what happens
Click to expand...
Click to collapse
Yeah, Did it, fully backed out twice after importing too. Gives me error on the Say Test task. Maybe its because I am using Magisk root. But I already tested Tasker has root access. Even checked superuser to make sure. Error on Both Shell Runs
fenchai said:
Maybe its because I am using Magisk root.
Click to expand...
Click to collapse
I bet you are right .. I'm still on KitKat so I don't need systemless root, but I've read in other threads that strange issues were fixed by creating the file "su" in system folder (or something like that) by using the touch command ... can't remember the threads or procedure exactly but doing that helps some apps realize root really exists (according to those users it fixed problems for) ... best of luck
Update: this breaks Android Pay but...
from this post by Chainfire:
Yes, some apps look for the su binary in hardcoded locations. SuperSU in systemless mode by default does not touch /system, but if you create /system/bin/su and/or /system/xbin/su yourself (with the above statement in mind, doing so from Recovery is probably best), it will override those files with the correct binary each boot. This should fix most misbehaving apps (that do not rely on modifying /system on a device which currently does not allow this).
and:
I haven't tested this, but from looking at the script in the SuperSU.zip file, I think you can do the following after installing systemless root:
adb shell
su
mount -o remount,rw /system
touch /sbin/su /system/bin/su /system/xbin/su
mount -o remount,ro /system
exit
I ran these commands over ADB in Recovery and lo and behold, Secure Settings works again.
pablo71 said:
ok, yeah, this is super awesome .. I now have 'limited' spoken Google search results on my huawei watch ... ( I'm a junkie addicted to autovoice+wearshell+ tasker ) ...
QUESTION: spoken search results are limited because many of the answers Google Assistant provides aren't just plain text ... so, how could the notification from Allo be parsed or converted or whatever? could AutoNotifications tasker plugin accomplish this? or some other tasker plugin?
...this project is still awesome as is though wow
Click to expand...
Click to collapse
Unfortunally several answers are not in plain text, for that reason I had to include: " and text is not null" condition to SQL I think it would be difficult to read because the answer is on BLOB fields..
I'm also an addict to Tasker/Autovoice using my MotoX voice commands..
hotsync100 said:
I'm also an addict to Tasker/Autovoice using my MotoX voice commands..
Click to expand...
Click to collapse
most excellent! .. that's the only way .. this thread explains how to get sql to read the text in BLOB fields .. http://stackoverflow.com/questions/828650/how-do-i-get-textual-contents-from-blob-in-oracle-sql I can figure it out but shucks, maybe you know a faster way to plug in the the command string to what you wrote .. I bang my head against lots of walls because i sometimes get different results
pablo71 said:
this thread explains how to get sql to read the text in BLOB fields ..
Click to expand...
Click to collapse
Unfortunally that functions are for Oracle and we are using Sqlite..
We can get the hex value of BLOB field using this command:
"select hex(blob_data) from messages where message_id like 'R:google%' and text is null limit 1"
.. but, it is huge for Tasker.. and still we have to convert it to ascii to be readable.. there is no tasks to convert it in tasker .. Only from hex to decimal.
hotsync100 said:
Unfortunally that functions are for Oracle and we are using Sqlite..
We can get the hex value of BLOB field using this command:
"select hex(blob_data) from messages where message_id like 'R:google%' and text is null limit 1"
.. but, it is huge for Tasker.. and still we have to convert it to ascii to be readable.. there is no tasks to convert it in tasker .. Only from hex to decimal.
Click to expand...
Click to collapse
ahhh ... now I get it ... we're gonna need a bigger boat
pablo71 said:
I bet you are right .. I'm still on KitKat so I don't need systemless root, but I've read in other threads that strange issues were fixed by creating the file "su" in system folder (or something like that) by using the touch command ... can't remember the threads or procedure exactly but doing that helps some apps realize root really exists (according to those users it fixed problems for) ... best of luck
Update: this breaks Android Pay but...
from this post by Chainfire:
Yes, some apps look for the su binary in hardcoded locations. SuperSU in systemless mode by default does not touch /system, but if you create /system/bin/su and/or /system/xbin/su yourself (with the above statement in mind, doing so from Recovery is probably best), it will override those files with the correct binary each boot. This should fix most misbehaving apps (that do not rely on modifying /system on a device which currently does not allow this).
and:
I haven't tested this, but from looking at the script in the SuperSU.zip file, I think you can do the following after installing systemless root:
adb shell
su
mount -o remount,rw /system
touch /sbin/su /system/bin/su /system/xbin/su
mount -o remount,ro /system
exit
I ran these commands over ADB in Recovery and lo and behold, Secure Settings works again.
Click to expand...
Click to collapse
Hi, Yeah, I have also tried it. I dont think its the systemless method. Maybe its android 6.0. We would need more people to confirm.
@pablo71 I found a way to convert hex to ascii using Javascript ..
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
but unfortunally there is not much text on results..
hotsync100 said:
@pablo71 I found a way to convert hex to ascii using Javascript ..
View attachment 3906968
but unfortunally there is not much text on results..
View attachment 3906969 View attachment 3906967
Click to expand...
Click to collapse
you're amazing! this is a start!
This is a Task example to get data for a BLOB field..
View attachment Allo___Blob.tsk.xml
fenchai said:
Hi, Yeah, I have also tried it. I dont think its the systemless method. Maybe its android 6.0. We would need more people to confirm.
Click to expand...
Click to collapse
I think this is not related with Android 6.0, because my MotoX has that version and works fine!
hotsync100 said:
This is a Task example to get data for a BLOB field..
View attachment 3907008
Click to expand...
Click to collapse
hey this so appreciated .. I'm gonna be off work in an hour and I'm gonna plug this as soon as I get home ... this is really cool!!! Having this feature on my watch is going to be so much faster than pulling out my phone and talking into it or typing on it
3 hours later: I think I'm seeing some ways tasker could use variable splitters and search/replace actions to extract useful text .. this looks pretty promising
Hi, i don't really get android shells commands, so i would like to know if we can send a message with this?
Regards,
How empty variable from sqlite?
I've developed new appreciation for this project the past couple months, and I've been using it more and more often to get spoken Google Results on my watch ... I've learned to stick with simple questions using precise words and I'm happy with the results! (how old is George Lucas, how many original star trek episodes were there, what is the deepest point in the Pacific ocean, etc )... I still haven't found a good way to extract text from the blob fields, BUT THIS PROJECT PRODUCES RESULTS! ... it's good enough as is ... GREAT WORK!!

Tasker can't delete root folders...

Hi everyone I'm trying to make a task which will delete a folder in /system/app/ folder but Tasker always gives me error 1 when I try to perform action. I already tried to mount /system rw with Tasker remount action but didn't helped. Also Tasker's file explorer seems like can't see root folders so I have to write path manually so I think it's may be Tasker related problem and I give every permission Tasker asks for solve this but not worked. It's already have root, modify system, usage access permissions.
Running Android 8.1 LOS 15.1
Here is the error log;
Code:
08.30.27/FileUtil nrda: need request: /system/app/BasicDreams: false
08.30.27/E checkSDPath: /system/app/BasicDreams useRoot: true there: true file: false dir: true
08.30.27/E Delete Directory: checkSDPath: /system/app/BasicDreams useDocFile: false
08.30.27/Shell runSync test -e '/system/app/BasicDreams' root: true timeout: 3000
08.30.27/Shell have process
08.30.27/Shell write cmd: test -e '/system/app/BasicDreams'
08.30.27/Shell start process timeout timer 3000ms for: test -e '/system/app/BasicDreams'
08.30.27/Shell start process-thread ID 559
08.30.27/Shell joined with 559
08.30.27/Shell exit result: 0
08.30.27/Shell non-null timeout
08.30.27/Shell runSync test -f '/system/app/BasicDreams' root: true timeout: 3000
08.30.27/Shell have process
08.30.27/Shell write cmd: test -f '/system/app/BasicDreams'
08.30.27/Shell start process timeout timer 3000ms for: test -f '/system/app/BasicDreams'
08.30.27/Shell start process-thread ID 561
08.30.27/Shell joined with 561
08.30.27/Shell exit result: 1
08.30.27/Shell non-null timeout
08.30.27/Shell runSync test -d '/system/app/BasicDreams' root: true timeout: 3000
08.30.27/Shell have process
08.30.27/Shell write cmd: test -d '/system/app/BasicDreams'
08.30.27/Shell start process timeout timer 3000ms for: test -d '/system/app/BasicDreams'
08.30.27/Shell start process-thread ID 563
08.30.27/Shell joined with 563
08.30.27/Shell exit result: 0
08.30.27/Shell non-null timeout
08.30.27/E Delete Directory: checkSDPath: /system/app/BasicDreams ok true
08.30.27/Shell runSync rm -r -f '/system/app/BasicDreams' root: true timeout: 7000
08.30.27/Shell have process
08.30.27/Shell write cmd: rm -r -f '/system/app/BasicDreams'
08.30.27/Shell start process timeout timer 7000ms for: rm -r -f '/system/app/BasicDreams'
08.30.27/Shell start process-thread ID 565
08.30.27/Shell joined with 565
08.30.27/Shell exit result: 1
08.30.27/Shell non-null timeout
08.30.27/E One or more failures deleting /system/app/BasicDreams.
08.30.27/E result: stop task (error)
08.30.27/E Error: 1
08.30.27/MacroEdit action finished exeID 1 action no 5 code 408 status: Err next 5
Could you export and post the description (not XML) of the task foot this please.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
Could you export and post the description (not XML) of the task foot this please.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
Code:
Do Stuff (52)
A1: Flash [ Text:Mounting /system rewritable... Long:eek:ff ]
A2: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A3: Remount [ Path:/system Writeable:eek:n ]
A4: Flash [ Text:Deleting files and directories... Long:eek:n ]
A5: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A6: Delete Directory [ Dir:/system/app/BasicDreams Recurse:eek:n Use Root:eek:n ] [I]ERROR HAPPENS AT THIS ACTION[/I]
A7: Delete Directory [ Dir:/system/app/Calendar Recurse:eek:n Use Root:eek:n ]
A8: Delete Directory [ Dir:/system/app/Email Recurse:eek:n Use Root:eek:n ]
A9: Delete Directory [ Dir:/system/app/Jelly Recurse:eek:n Use Root:eek:n ]
A10: Delete Directory [ Dir:/system/app/LatinIME Recurse:eek:n Use Root:eek:n ]
A11: Delete Directory [ Dir:/system/app/messaging Recurse:eek:n Use Root:eek:n ]
A12: Delete Directory [ Dir:/system/app/PhotoTable Recurse:eek:n Use Root:eek:n ]
A13: Delete Directory [ Dir:/system/app/webview Recurse:eek:n Use Root:eek:n ]
A14: Delete Directory [ Dir:/system/priv-app/AudioFX Recurse:eek:n Use Root:eek:n ]
A15: Delete Directory [ Dir:/system/priv-app/Contacts Recurse:eek:n Use Root:eek:n ]
A16: Delete File [ File:/system/priv-app/Dialer/Dialer.apk Shred Level:0 Use Root:eek:n ]
A17: Delete Directory [ Dir:/system/priv-app/Eleven Recurse:eek:n Use Root:eek:n ]
A18: Delete Directory [ Dir:/system/priv-app/Gallery2 Recurse:eek:n Use Root:eek:n ]
A19: Delete Directory [ Dir:/system/priv-app/Snap Recurse:eek:n Use Root:eek:n ]
A20: Delete Directory [ Dir:/system/priv-app/Trebuchet Recurse:eek:n Use Root:eek:n ]
A21: Flash [ Text:Copying files... Long:eek:n ]
A22: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A23: Copy File [ From:Chandler Muriel Bing/Portbag/Google Phone v23.0.apk To:/system/priv-app/Dialer/Dialer.apk Use Root:eek:n ]
A24: Copy File [ From:Chandler Muriel Bing/Portbag/MIUI 9.5 Ringtones/Mi.ogg To:/system/media/audio/ringtones/ Use Root:eek:n ]
A25: Copy File [ From:Chandler Muriel Bing/Portbag/MIUI 9.5 Ringtones/Mi.ogg To:/system/media/audio/alarms/ Use Root:eek:n ]
A26: Copy File [ From:Chandler Muriel Bing/Portbag/MIUI 9.5 Ringtones/Fresh.ogg To:/system/media/audio/notifications/ Use Root:eek:n ]
A27: Copy File [ From:Chandler Muriel Bing/myDevice/LOS/bootanimation.zip To:/system/media/ Use Root:eek:n ]
A28: Flash [ Text:Setting permissions... Long:eek:n ]
A29: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A30: Run Shell [ Command:chmod 644 /system/priv-app/Dialer/Dialer.apk Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A31: Run Shell [ Command:chmod 644 /system/media/alarms/Mi.ogg Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A32: Run Shell [ Command:chmod 644 /system/media/ringtones/Mi.ogg Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A33: Run Shell [ Command:chmod 644 /system/media/notifications/Fresh.ogg Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A34: Run Shell [ Command:chmod 644 /system/media/bootanimation.zip Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
A35: Flash [ Text:Mounting /system read-only... Long:eek:n ]
A36: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A37: Remount [ Path:/system Writeable:eek:ff ]
A38: Flash [ Text:Rebooting... Long:eek:n ]
A39: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A40: Run Shell [ Command:reboot Timeout (Seconds):0 Use Root:eek:n Store Output In: Store Errors In: Store Result In: ]
OK, I can run that exactly as written without trouble on my device (not running on LOS).
What root are you using? LOS superuser or Magisk?
I don't think it's an SELinux enforcing issue because I am enforcing and it works. But, you could try setting SELinux to permissive just to test. Run a shell action as root "setenforce 0" for permissive and "setenforce 1" for enforcing. If you want to flash which mode you are in, use a shell action: "getenforce" as root and make sure to assign a variable to the "store output in" field. Then flash that variable. It will return enforcing or permissive.
My last thought is to try the command in a terminal and see if there is any enlightenment as a result.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
OK, I can run that exactly as written without trouble on my device (not running on LOS).
What root are you using? LOS superuser or Magisk?
I don't think it's an SELinux enforcing issue because I am enforcing and it works. But, you could try setting SELinux to permissive just to test. Run a shell action as root "setenforce 0" for permissive and "setenforce 1" for enforcing. If you want to flash which mode you are in, use a shell action: "getenforce" as root and make sure to assign a variable to the "store output in" field. Then flash that variable. It will return enforcing or permissive.
My last thought is to try the command in a terminal and see if there is any enlightenment as a result.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
I'm using Magisk v17.1 and I don't think this issue is root related, but I'm gonna try SELinux mode and post result here thanks!
SELinux didn't worked... But I assume I found issue issue is Tasker can't mount system rw, for test it I used terminal and type command; "mount -o rw,remount /system" command worked without error then write that command; "rm /system/app/BasicDreams/BasicDreams.apk" terminal asks yes or no typed y and gived error read-only system...
I'm not familiar with LOS, but it's possible the boot.img (kernel) doesn't permit remount. Maybe someone in your rom thread could help.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
ktmom said:
I'm not familiar with LOS, but it's possible the boot.img (kernel) doesn't permit remount. Maybe someone in your rom thread could help.
"find somebody that you think is undeserving of your compassion and give it to them" - Christian Picciolini
Click to expand...
Click to collapse
Actually I think I solved this, there is a system mirror folder in /sbin/.core/mirror/ which contains exact same files on /system/ so I tried to create a file there and it's created on /system/ too and deleted it guess what? IT'S DELETED ON /system/ TOO so I changed every action on Tasker to /sbin/. core/mirror/system/... and worked! So like you said before it's related with Magisk's systemless specification. Thanks again ?
Now Tasker can't change /sbin folder too ?

How to convert image to base64 and store it in a variable

I am trying to convert image saved by the AutoNotifications but it's not working.
Code:
GET APP DETAILS (3)
A1: AutoNotification Query [ Configurationersistency Type: Non-Persistent Only
Package: %evtprm(1)
Get All Fields : true Timeout (Seconds):2 Structure Output:On ]
A2: Variable Split [ Name:%anstatusbaricon Splitter:, Delete Base:Off Regex:Off ]
A3: Text Dialog [ Title:. Text:%anstatusbaricon1 Button 1: Button 2: Button 3: Close After (Seconds):30 Use HTML:Off ]
A4: Read Binary [ File:%anstatusbaricon1 To Var:%b64img ]
A5: Text Dialog [ Title:Base 64 string Text:%b64img Button 1:Ok Button 2: Button 3: Close After (Seconds):30 Use HTML:Off ]

How To Guide How to install and configure the Android OS via script

Update 18.04.2023/bs
see How to install Magisk v26.0 or newer via script for how to install Magisk v26 via script
Note:
The instructions below work in my environment - they should work for others after adjusting the configuration. But of course I can't guarantee that.
After creating all the other scripts to install and configure the Android OS without user intervention I finally wrote a script to do all the steps necessary to install and configure the Android OS using these scripts.
For this purpose I used another script that I wrote some time ago and use also for a lot of other things: execute_tasks.sh.
execute_tasks.sh reads a list of defined tasks from one or more include files and executes one or more of these tasks one after the other. One or more parameter for the tasks are supported. It's also possible to define task groups with one or more tasks that can be used like single tasks.
The usage for execute_tasks.sh is :
Spoiler: ./execute_tasks.sh -h
Code:
[ OmniRom 13 Dev - [email protected] /data/develop/scripts ] $ ./execute_tasks.sh -h
[17.01.2023 18:42 ] ### execute_tasks.sh started at 17.01.2023 18:42:44 (The PID of this process is 655162)
[17.01.2023 18:42 ] ### Processing the parameter ...
[17.01.2023 18:42 ] Tasks to execute are: ""
[17.01.2023 18:42 ] Parameter for the function init_tasks are: ""
Usage: execute_tasks.sh [-v|--verbose] [-q|--quiet] [-f|--force] [-o|--overwrite] [-y|--yes] [-n|--no] [-l|--logfile filename]
[-d{:dryrun_prefix}|--dryrun{:dryrun_prefix}] [-D|--debugshell] [-t fn|--tracefunc fn] [-L]
[-T|--tee] [-V|--version] [--var name=value] [--appendlog] [--nologrotate] [--noSTDOUTlog] [--disable_tty_check] [--nobackups]
[--print_task_template [filename]] [--create_include_file_template [filename]] [--list [taskmask]] [--list_tasks [taskmask]]
[--list_task_groups [groupmask]] [--list_default_tasks] [--abort_on_error] [--abort_on_task_not_found] [--abort_on_duplicates]
[--checkonly] [--check] [--singlestep] [--unique] [--trace] [--info] [--print_includefile_help] [-i|--includefile [?]filename]
[--no_init_tasks[ [--no_finish_tasks] [--only_list_tasks] [--disabled_tasks task1[...,task#]] [--list_disabled_tasks] [--enable_all_tasks]
[task1] [... task#] [-- parameter_for_init_tasks]
Current environment: ksh version: 93 | change function code supported: yes | tracing feature using $0 supported: yes
[17.01.2023 18:42 ] ### The logfile used was /var/tmp/execute_tasks.sh.log
[17.01.2023 18:42 ] ### The start time was 17.01.2023 18:42:44, the script runtime is (day:hour:minute:seconds) 0:00:00:00 (= 0 seconds)
[17.01.2023 18:42 ] ### execute_tasks.sh ended at 17.01.2023 18:42:44 (The PID of this process is 655162; the RC is 0)
[ OmniRom 13 Dev - [email protected] /data/develop/scripts ] $
To get a more detailed usage description either download the script and execute it with the parameter -H or use this link .
The include file with the tasks to install and configure the Android OS, prepare_phone.include, can be downloaded here.
To use that file either use
Code:
./execute_tasks.sh -i prepare_phone.include [task1 ... task#]
or create the symbolic link prepare_phone.sh for execute_tasks.sh :
Bash:
ln -s ./execute_tasks.sh ./prepare_phone.sh
and use it like this
Code:
./prepare_phone.sh [task1 ... task#]
Note:
./prepare_phone.sh and prepare_phone.include must be in the same directory. In the rest of this post I use this method.
To list all defined tasks in the include file prepare_phone.include use the parameter --list, e.g:
Spoiler: ./prepare_phone.sh --list -v
Code:
[ OmniRom 13 Dev - [email protected] /data/develop/android ] $ ./scripts_on_linux/prepare_phone.sh --list -v
[27.01.2023 12:25 ] ### prepare_phone.sh started at 27.01.2023 12:25:09 (The PID of this process is 1024201)
[27.01.2023 12:25 ] ### Processing the parameter ...
[27.01.2023 12:25 ] Tasks to execute are: ""
[27.01.2023 12:25 ] Parameter for the function init_tasks are: ""
[27.01.2023 12:25 ] ### The logfile used is /var/tmp/prepare_phone.sh.log
[27.01.2023 12:25 ] INFO: Searching the default include file "prepare_phone.include" ...
[27.01.2023 12:25 ] INFO: "/data/develop/android/scripts_on_linux/prepare_phone.include" found.
[27.01.2023 12:25 ] INFO: Checking and reading the include file(s) "/data/develop/android/scripts_on_linux/prepare_phone.include " now ...
[27.01.2023 12:25 ] Checking the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" ...
[27.01.2023 12:25 ] INFO: The version of the include file "/data/develop/android/scripts_on_linux/prepare_phone.include", "1.0.0.0", is okay.
[27.01.2023 12:25 ] INFO: Function "init_tasks" found in the include file "/data/develop/android/scripts_on_linux/prepare_phone.include"
[27.01.2023 12:25 ] INFO: Function "finish_tasks" found in the include file "/data/develop/android/scripts_on_linux/prepare_phone.include"
[27.01.2023 12:25 ] Reading the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" ...
[27.01.2023 12:25 ] INFO: Found this list of tasks to be excluded from "all" in the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" :
[27.01.2023 12:25 ] INFO: Found this list of tasks for "all" in the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" :
[27.01.2023 12:25 ] INFO: enable_disable_abort_on_error:enable
[27.01.2023 12:25 ] INFO: boot_phone_from_twrp_image
[27.01.2023 12:25 ] INFO: install_os:noreboot:factory_reset
[27.01.2023 12:25 ] INFO: install_twrp:noreboot:next
[27.01.2023 12:25 ] INFO: install_magisk_in_boot_partition_only:noreboot:next
[27.01.2023 12:25 ] INFO: enable_adb:reboot
[27.01.2023 12:25 ] INFO: #
[27.01.2023 12:25 ] INFO: install_magisk_in_data_adb_only:noreboot:copy_apk
[27.01.2023 12:25 ] INFO: enable_root_access_for_the_shell:reboot
[27.01.2023 12:25 ] INFO: wait_for_access_via_adb:60:kill
[27.01.2023 12:25 ] INFO: install_the_magisk_app
[27.01.2023 12:25 ] INFO: enable_disable_abort_on_error:disable
[27.01.2023 12:25 ] INFO: install_essential_scripts
[27.01.2023 12:25 ] INFO: install_essential_apps
[27.01.2023 12:25 ] INFO: install_essential_magisk_modules
[27.01.2023 12:25 ] INFO: enable_root_access_for_apps:reboot
[27.01.2023 12:25 ] INFO: execute_script_on_the_phone:ignorerc
Include files used are:
/data/develop/android/scripts_on_linux/prepare_phone.include
Tasks defined are:
Task: boot_phone_from_twrp_image Usage: boot_phone_from_twrp_image [ignorerc] [twrp_image] parameter_for_the_script]
Task: boot_phone_into_android Usage: boot_phone_into_android [ignorerc] [force]
Task: boot_phone_into_bootloader Usage: boot_phone_into_bootloader [ignorerc]
Task: boot_phone_into_fastboot Usage: boot_phone_into_fastboot [ignorerc]
Task: boot_phone_into_recovery Usage: boot_phone_into_recovery [ignorerc]
Task: boot_phone_into_safemode Usage: boot_phone_into_safemode [ignorerc] [timeout=timeout_in_seconds] # Default: 30 seconds; Note: The phone must be booted into the AndroidOS for this task
Task: check_config Usage: check_config
Task: download_scripts Usage: download_scripts [target_dir|default|pwd] [backup|nobackup] [ignorerc] # default: download the scripts to the current directory
Task: enable_adb Usage: enable_adb [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [parameter_for_the_script] # default is: no reboot
Task: enable_disable_abort_on_error Usage: enable_disable_abort_on_error [yes|no] # default is yes
Task: enable_root_access_for_apps Usage: enable_root_access_for_apps [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [parameter_for_the_script] # default is: no reboot
Task: enable_root_access_for_the_shell Usage: enable_root_access_for_the_shell [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [parameter_for_the_script] # default is: no reboot
Task: execute_script_on_the_phone Usage: execute_script_on_the_phone [ignorerc] [script_to_execute] # default: post_install.sh in the current directory
Task: factory_reset_via_twrp Usage: factory_reset_via_twrp [reboot|noreboot|reboot=no|reboot=yes] [twrp_imagefile] [ignorerc] [force|noforce]
Task: install_apps Usage: install_apps [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [apkfile1 ... apkfile#] # default is: no reboot
Task: install_essential_apps Usage: install_essential_apps [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [dir_with_the_apk_files_to_install] # default is: no reboot
Task: install_essential_magisk_modules Usage: install_essential_magisk_modules [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [dir_with_the_magisk_modules_to_install] # default is: no reboot
Task: install_essential_scripts Usage: install_essential_scripts [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [dir_with_the_scripts_to_install] # default is: no reboot
Task: install_magisk_in_boot_partition Usage: install_magisk_in_boot_partition [slot] [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [magisk_apkfile] [parameter_for_the_script] # default is: reboot
Task: install_magisk_in_boot_partition_only Usage: install_magisk_in_boot_partition_only [slot] [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [magisk_apkfile] [parameter_for_the_script] # default is: no reboot
Task: install_magisk_in_data_adb_only Usage: install_magisk_in_data_adb_only [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [magisk_apkfile] [parameter_for_the_script] # default is: no reboot
Task: install_magisk_modules Usage: install_magisk_modules [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [magisk_module1 ... magisk_module#] # default is: no reboot
Task: install_os Usage: install_os [slot] [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [reset] [imagefile] [parameter_for_the_script] # default is: no reboot
Task: install_the_magisk_app Usage: install_the_magisk_app [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [magisk_apk_file] # default is: no reboot
Task: install_twrp Usage: install_twrp [slot] [reboot|noreboot|reboot=no|reboot=yes] [ignorerc] [twrp_imagefile] [parameter_for_the_script] # default is: no reboot
Task: kill_adb_daemon Usage: kill_adb_daemon [reboot|noreboot|reboot=no|reboot=yes] [ignorerc]
Task: restore_titanium_backup Usage: restore_titanium_backup [license=license_file] [zip=zipfile] [app=titanium_app] [ignorerc]
Task: set_os_image_to_install Usage: set_os_image_to_install [os_image] # there is no default value
Task: update_include_file Usage: update_include_file [target_dir|target_file] [ignorerc] [keep|nokeep] # default: nokeep (= delete temporary files)
Task: wait_for_access_via_adb Usage: wait_for_access_via_adb [ignorerc] [kill] [[timeout=]timeout_in_seconds] # default: 30 seconds
Task: wait_for_phone_state Usage: wait_for_phone_state [ignorerc] [state|state=#] [timeout=timeout_in_seconds] # default: 3 30 ; use 0 for infinite; set TIMEOUT_VALUE to define the timeout value via env variable
Task: wait_n_seconds Usage: wait_n_seconds [wait_time] [step_count] # default for wait_time is 60 and default for step count is 5
Task: wipe_dalvik_and_cache_via_twrp Usage: wipe_dalvik_and_cache_via_twrp [reboot|noreboot|reboot=no|reboot=yes] [twrp_imagefile] [ignorerc] [force|noforce]
33 task(s) defined.
Defined Task groups are:
abort_on_error :
task_enable_disable_abort_on_error:enable
install_magisk :
install_the_magisk_app
install_magisk_in_boot_partition:current
wait_for_access_via_adb:60:kill
enable_root_access_for_the_shell:reboot
wait_for_access_via_adb:60:kill
check_root_access
install_essential_magisk_modules:reboot
no_abort_on_error :
task_enable_disable_abort_on_error:disable
refresh :
task_update_include_file
refresh_all :
download_scripts:default
task_update_include_file
update_os :
enable_disable_abort_on_error:enable
boot_phone_from_twrp_image
install_os:noreboot
install_twrp:noreboot:next
install_magisk_in_boot_partition:reboot:next
wait_for_androidos :
task_wait_for_phone_state:3
wait_for_bootloader :
task_wait_for_phone_state:4
wait_for_fastboot :
task_wait_for_phone_state:5
wait_for_lineageos_recovery :
task_wait_for_phone_state:7
wait_for_safemode :
task_wait_for_phone_state:6
wait_for_sideload :
task_wait_for_phone_state:8
wait_for_twrp_image :
task_wait_for_phone_state:1
wait_for_twrp_recovery :
task_wait_for_phone_state:2
Note: use ":" to separate the task name and the parameter
[27.01.2023 12:25 ] ### The logfile used was /var/tmp/prepare_phone.sh.log
[27.01.2023 12:25 ] ### The start time was 27.01.2023 12:25:09, the script runtime is (day:hour:minute:seconds) 0:00:00:00 (= 0 seconds)
[27.01.2023 12:25 ] ### prepare_phone.sh ended at 27.01.2023 12:25:09 (The PID of this process is 1024201; the RC is 0)
[ OmniRom 13 Dev - [email protected] /data/develop/android ] $
The tasks in the include files use the other scripts I wrote to install and configure the Android OS. Therefor you should first download the current version of these scripts either manual (see below) or using the task download_scripts:
Bash:
./prepare_phone.sh download_scripts
The task download_scripts will download all necessary scripts from https://bnsmb.de/files/public/Android to the current directory; to download the scripts to another directory add the target directory as task parameter, e.g. to download the scripts into the directory /var/tmp/scripts use:
Bash:
./prepare_phone.sh download_scripts:/var/tmp/scripts
Next either edit the default values for the various variables in the file prepare_phone.include or, better, create the config file prepare_phone.conf with the necessary config entries like this:
Code:
[ OmniRom 13 Dev - [email protected] /data/develop/android/scripts_on_linux ] $ cat ./prepare_phone.conf
SCRIPT_DIR="/data/develop/android/scripts_on_linux"
OS_IMAGE_TO_INSTALL="/data/develop/android/OmniROM_13.0/out/target/product/zenfone8/omni-13-20230115-zenfone8-MICROG.zip"
TWRP_IMAGE="/data/backup/ASUS_ZENFONE8/twrp/twrp-3.7.0_12-0-I006D-enhanced.img"
MAGISK_APK_FILE="/data/backup/Android/EssentialApps/Magisk-v25.2.apk"
ESSENTIAL_APPS_DIR="/data/backup/Android/EssentialApps"
ESSENTIAL_SCRIPTS_DIR="/data/backup/Android/EssentialScripts/"
ESSENTIAL_MAGISK_MODULES_DIR="/data/backup/Android/EssentialMagiskModules"
SCRIPT_DIR_ON_THE_PHONE="/data/local/tmp/scripts"
UPLOAD_DIR_FOR_SCRIPTS_ON_THE_PHONE="/sdcard/Download/scripts"
UPLOAD_DIR_FOR_MAGISK_MODULES_ON_THE_PHONE="/sdcard/Download/MagiskModules"
APPS_FOR_ROOT_ACCESS="com.mixplorer,com.keramidas.TitaniumBackup,io.github.muntashirakon.AppManager,com.matoski.adbm,com.fox2code.mmm"
POST_INSTALL_SCRIPT="post_install.sh"
[ OmniRom 13 Dev - [email protected] /data/develop/android/scripts_on_linux ] $
It's also possible to define other variables used by the various scripts executed by the tasks in prepare_phone.include in this file, an example for the file prepare_phone.conf can be downloaded here.
The config file "prepare_phone.conf" is searched in the current directory, the home directory "${HOME}" and in the directory /etc (in this order),
When done use the task check_config to check the configuration, e.g.
Bash:
./prepare_phone.sh check_config
The task check_config will check that all required variables are set and, if possible, that the values of these variables are valid. It also checks that all scripts used by the tasks in the include file exist.
The include file defines a task group called all that can be used to install and configure a phone attached via USB from scratch.
To list the tasks that will be done if the parameter all is used use the parameter --list-default-tasks, e.g.
Spoiler: ./prepare_phone.sh --list_default_tasks
Code:
[ OmniRom 13 Dev - [email protected] /data/develop/android/scripts_on_linux ] $ ./prepare_phone.sh --list_default_tasks
[25.01.2023 19:48 ] ### prepare_phone.sh started at 25.01.2023 19:48:03 (The PID of this process is 510292)
[25.01.2023 19:48 ] ### Processing the parameter ...
[25.01.2023 19:48 ] Tasks to execute are: ""
[25.01.2023 19:48 ] Parameter for the function init_tasks are: ""
[25.01.2023 19:48 ] ### The logfile used is /var/tmp/prepare_phone.sh.log
[25.01.2023 19:48 ] Checking the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" ...
[25.01.2023 19:48 ] Reading the include file "/data/develop/android/scripts_on_linux/prepare_phone.include" ...
Include files used are:
/data/develop/android/scripts_on_linux/prepare_phone.include
Tasks defined are
16 default task(s) defined:
enable_disable_abort_on_error:enable
boot_phone_from_twrp_image
install_os:noreboot:factory_reset
install_twrp:noreboot:next
install_magisk_in_boot_partition_only:noreboot:next
enable_adb:reboot
install_magisk_in_data_adb_only:noreboot:copy_apk
enable_root_access_for_the_shell:reboot
wait_for_access_via_adb:60:kill
install_the_magisk_app
enable_disable_abort_on_error:disable
install_essential_scripts
install_essential_apps
install_essential_magisk_modules
enable_root_access_for_apps:reboot
execute_script_on_the_phone:ignorerc
0 task(s) will be ignored if the parameter "all" is used:
[25.01.2023 19:48 ] ### The logfile used was /var/tmp/prepare_phone.sh.log
[25.01.2023 19:48 ] ### The start time was 25.01.2023 19:48:03, the script runtime is (day:hour:minute:seconds) 0:00:00:00 (= 0 seconds)
[25.01.2023 19:48 ] ### prepare_phone.sh ended at 25.01.2023 19:48:03 (The PID of this process is 510292; the RC is 0)
[ OmniRom 13 Dev - [email protected] /data/develop/android/scripts_on_linux ] $
Hopefully the task names are self-explanatory ...
In principle the tasks executed if the parameter all is used will
do a factory reset
install the OS using TWRP
install the TWRP recovery into the boot partition
install Magisk into the boot partition
enable access via adb using Magisk
install Magisk
enable root access for the shell via Magisk
copy all scripts from the local directory ${ESSENTIAL_SCRIPTS_DIR} to the directory ${SCRIPT_DIR_ON_THE_PHONE} on the phone
install all apk files found in the local directory ${ESSENTIAL_APPS_DIR}
install all Magisk Modules found in the local directory ${ESSENTIAL_MAGISK_MODULES_DIR}
enable root access for the applications listed in the variable ${APPS_FOR_ROOT_ACCESS}
copy the script post_install.sh to the phone and execute it there (only if it exists)
To install and configure a phone attached via USB use the command:
Bash:
./prepare_phone.sh all
Sample output of an installation and configuration done using the script with the parameter all can be found here.
Other task groups defined are:
Task group install_magisk
The tasks in this task group will
install the Magisk app
install Magisk into the boot partition
enable root access for the shell.
install the essential Magisk Modules found in the local directory ${ESSENTIAL_MAGISK_MODULES_DIR}
Task group update_os
The tasks in this task group will
install the OS into the passive boot slot
install TWRP into the boot partition for the passive boot slot
install Magisk into the boot partition of the passive boot slot
change the active slot and reboot the phone
The task group update_os can be used together with the task set_os_image_to_install to update an existing OS, e.g:
Bash:
./prepare_phone.sh set_os_image_to_install:/data/develop/android/OmniROM_13.0/out/target/product/zenfone8/omni-13-20230121-zenfone8-MICROG.zip update_os
Sample output of an OS update using these tasks can be found here.
To install and configure the phone manually using my other scripts use these commands:
Spoiler: Manual installation and configuration of the phone
Bash:
export OS_IMAGE_TO_INSTALL="/data/develop/android/OmniROM_13.0/out/target/product/zenfone8/omni-13-20230115-zenfone8-MICROG.zip"
export TWRP_IMAGE="/data/backup/ASUS_ZENFONE8/twrp/twrp-3.7.0_12-0-I006D-enhanced.img"
export MAGISK_APK_FILE="/data/backup/Android/EssentialApps/Magisk-v25.2.apk"
cd /data/develop/android/scripts_on_linux
./boot_phone_from_twrp.sh
./install_os_via_twrp.sh factory_reset noreboot $OS_IMAGE_TO_INSTALL
./install_twrp.sh next noreboot
./install_magisk_via_twrp.sh next copy_apk delete_adb_dir noreboot magisk_apk_file=$MAGISK_APK_FILE
./enable_access_via_adb.sh reboot
adb wait-for-device
./install_magisk_via_twrp.sh adb_only copy_apk noreboot
./init_magisk_db.sh reboot
./install_apk.sh $MAGISK_APK_FILE
adb shell pm grant com.topjohnwu.magisk android.permission.POST_NOTIFICATIONS
# to install an app (example)
./install_apk.sh /data/backup/Android/EssentialApps/MiXplorer_v6.58.8_B23010320.apk
# to install a Magisk Module (example)
adb push /data/backup/Android/EssentialMagiskModules/addbin-v1.3.0.0.zip /sdcard/Download/MagiskModules/addbin-v1.3.0.0.zip
adb shell su - -c magisk --install-module /sdcard/Download/MagiskModules/addbin-v1.3.0.0.zip
# to enable root access for other apps (example)
#
./init_magisk_db.sh apps=+com.mixplorer,com.keramidas.TitaniumBackup,io.github.muntashirakon.AppManager,com.matoski.adbm,com.fox2code.mmm
To update the OS manual using the scripts use these commands (assuming Magisk is already installed):
Spoiler: Manual update the OS on the phone
Bash:
export OS_IMAGE_TO_INSTALL="/data/develop/android/OmniROM_13.0/out/target/product/zenfone8/omni-13-20230115-zenfone8-MICROG.zip"
export TWRP_IMAGE="/data/backup/ASUS_ZENFONE8/twrp/twrp-3.7.0_12-0-I006D-enhanced.img"
cd /data/develop/android/scripts_on_linux
./boot_phone_from_twrp.sh
./install_os_via_twrp.sh noreboot $OS_IMAGE_TO_INSTALL
./install_twrp.sh next noreboot
./install_magisk_via_twrp.sh next reboot
Note:
Reinstalling an ASUS Zenfone 8 with OmniROM from scratch including a factory reset takes about 12 minutes with these scripts, and updating the operating system in the passive slot takes about 5 minutes.
Please note that while writing the global script I updated and corrected some of the other scripts. Therefor it's recommended to download the current versions of the scripts.
Some hints for trouble shooting
Each task is a function in the include file with the name task_<taskname>, e.g. the function used to implement the task enable_adb is task_enable_adb.
Task parameter must be added to the taskname using the colon ":" as delimiter, example: install_magisk_in_boot_partition_only:noreboot:next
To execute the tasks in verbose mode use the parameter --info; to execute the complete script in verbose mode use the parameter --verbose.
To execute the tasks with "set -x" use the parameter --trace.
To execute the tasks in single step mode use the parameter --single-step.
The global initialisation of the script is done in the function init_tasks; all script parameter after "--" are parameter for the function init_tasks. To execute the function init_tasks with "set -x" use the parameter "-- trace"; to view the known parameter for the function init_tasks use the parameter "-- help".
To execute the tasks in dry-run mode use the init_tasks parameter " -- dryrun"
In the default configuration execute_tasks.sh will stop executing the remaining tasks if one of the tasks ends with an error. To disable this functionality for one task use the task parameter ignorerc; to disable this functionality global use the the task enable_disable_abort_on_error:disable and to enable it again use the task enable_disable_abort_on_error:enable.
Use the parameter "-h -v" to get the detailed usage help
Notes
The scripts used by this script can be downloaded manually from these URLs:
https://bnsmb.de/files/public/Android/boot_phone_from_twrp.sh
https://bnsmb.de/files/public/Android/enable_access_via_adb.sh
https://bnsmb.de/files/public/Android/enable_adb_using_magisk.sh
https://bnsmb.de/files/public/Android/enable_root_access_via_magisk.sh
https://bnsmb.de/files/public/Android/init_magisk_db.sh
https://bnsmb.de/files/public/Android/install_apk.sh
https://bnsmb.de/files/public/Android/install_magisk_via_twrp.sh
https://bnsmb.de/files/public/Android/install_os_via_twrp.sh
https://bnsmb.de/files/public/Android/install_twrp_from_within_twrp.sh
https://bnsmb.de/files/public/Android/install_twrp.sh
The documentation for these scripts can be found on my home page https://bnsmb.de/My_HowTos_for_Android.html or in the various HowTos in the XDA Forum that I wrote.
Update 02.02.2023
See here for how to configure WiFi in Android via script
Update 18.04.2023/bs
see How to install Magisk v26.0 or newer via script for how to install Magisk v26 via script

Categories

Resources