[Task] [Root] Flash multiple zips at once, via CWM based recovery

Last Updated:

  1. SUroot

    SUroot Well-Known Member Developer

    I'm a bit fed up of flashing 9 zips every time I upgrade my ROM, so I created this to save me some time and effort. Enjoy.


    Who is this Task for?
    What does this Task do exactly?
    What do I need to know / understand before using this Task?
    The Bash commands
    Note to S3 users
    Note to Other device users
    I want to change this to use a folder of my choice. How?

    Who is this Task for?

    This Task has been created for root users. In particular, those who use a ClockWorkMod (CWM) based recovery to flash zips. It can be annoying when you upgrade your ROM and then have to flash your favourite theme and all your mods, one after another

    What does this Task do exactly?

    This Task, when triggered (Homescreen widget), will boot into recovery and flash all the zips (In alphabetical order) one after another in one folder, then boot back into Android. This prevents you in CWM recovery, having to keep going through the menus to choose the install option and browsing to the folder every time.

    You can add a widget to the homescreen:

    Long press home screen > Add Widget > Task > ZipFlash

    WARNING - There is no confirmation on this as yet. Pressing it will immediately boot into recovery. I recommend if you can spare a homescreen to this on its own, please do

    Since this flashes in Alphabetical order, its best to start all your zip filenames with "01_" and "02_" in the order you want them flashed. Personally I mostly only change the "01_ROM.zip" file. "02_theme.zip" and "03_Mod.zip" tend to remain the same.

    Yes, this task WILL work with Aroma installers. However, do not leave the flashing process unattended. You will still need to ensure you make your Aroma selections as normal. Don't forget to untick the "reboot your device" option at the end of each Aroma instance

    For those of you who don't know what Aroma is, it's not really important but it's like an install wizard (similar to windows programs). Once you flash the zip, the Aroma installer wizard takes over. It presents you a nice GUI to install the options of your choice from the mod or rom. This is something the developer, themer etc would have implemented as part of the zip file. Its not something specific to this task

    What do I need to know / understand before using this Task?

    To use this profile, you need to know the mount points on your phone both in android and recovery.

    For example, on the s3 there is an internal and an external SD card.

    In android (S3) these are:
    internal - /mnt/sdcard
    external - /mnt/extSdCard

    In CWM recovery (S3) these are:
    internal - /data/media
    external - /external_sd

    First you must decide if you are going to use the Internal or External SD card.

    On a phone that has NO external sdcard, you would follow the rationale of the S3's internal sdcard (/mnt/sdcard in android).

    Similarly if you have a phone that has NO internal sdcard, you would still follow the rationale of the internal sdcard (/mnt/sdcard in android).

    Essentially EVERY device will use /mnt/sdcard for their Storage, whether that's an external Micro SD card or Internal SD card. Only devices that have an internal AND external SD card will need to look into that deeper.

    People with root explorers can browse to the root of their device, find the /mnt directory and see what everything is mounted as. You will be able to get everything you need to use for the "in Android" settings. As for recovery, this could vary from device to device so if you don't know, ask in the development thread (Probably XDA) of your device's recovery.

    Note. Mount points are case sensitive. /mnt/extsdcard will not work if it's supposed to be /mnt/extSdCard

    The bash commands

    This task by default uses /mnt/extSdCard/AFLash/zips as the zip folder. You may want to change this to be /mnt/sdcard/folder of your choice later on, as the current default location is my personal folder on the S3 which won't work for all devices

    Here is an extract of the task commands (and what it does):

    Code (Text):
    2. # Lists contents of Zip folder into a file called "ls"
    4. ls /mnt/extSdCard/AFlash/zips/ls
    7. # Prefixes each line contained within the "ls" file with code that will form part of the install command, in a new file called prefix
    9. sed -e 's#^#install_zip("/external_sd/AFlash/zips/#' /mnt/extSdCard/AFlash/zips/ls > /mnt/extSdCard/AFlash/zips/prefix
    12. # Suffixes each line contained within the "prefix" file to complete the install command, in a new file called "extendedcommand"
    14. sed -e 's/$/");/' /mnt/extSdCard/AFlash/zips/prefix > /mnt/extSdCard/AFlash/zips/extendedcommand
    17. # Removes the last line in "extendedcommand", which is the "ls" file created in step 1
    19. sed -i '$d' /mnt/extSdCard/AFlash/zips/extendedcommand
    22. # deletes the unused ls and prefix files
    24. rm /mnt/extSdCard/AFlash/zip/ls /mnt/extSdCard/AFlash/zip/prefix
    27. # Moves the extendedcommand file so recovery can see it
    29. mv /mnt/extSdCard/AFlash/zips/extendedcommand /cache/recovery
    32. #Boots into recovery
    34. reboot recovery
    Before anyone mentions, I know in some places I could have used -i instead of -e and I could have amalgamated some of the commands. I chose not to do that for ease if debugging.

    Note to S3 users

    If you are happy with using the external SD card and my folder structure for zips, this task can be used unmodified

    Note to Other device users

    You will most likely need to change the location of the folder you use for Zips. Ensure you know your mount points and decide on a folder to use

    See again: What do I need to know / understand before using this Task?

    I want to change this to use a folder of my choice. How?

    OK, I'll tell you how. I will assume for the purpose of this explanation that you want to change the location to /mnt/sdcard/myzips

    Please note, this is where you need to know your recovery mount points. I will write this as an S3 user where the recovery mount point for /mnt/sdcard is /data/media

    If you do not know your mount points, see again: What do I need to know / understand before using this Task?

    Modifying xml is the best way to go, BEFORE importing it into tasker. Its best to do this on a computer. Use a notepad or text application that has a "Find and replace" function.

    Find: /mnt/extSdCard/AFlash/zips
    Replace: /mnt/sdcard/myzips

    Find: external_sd
    Replace: data/media

    That's it...


    Attached Files:

    simonwil, shauny13 and silentwitness like this.
  2. simonwil

    simonwil New Member

    Thanks for this - nice job. I just installed the XML task file untouched and it worked fine.

    However, it doesn't work for me since flashing a new ROM. It fails at step 6 when trying to copy the file list. I can copy the generated file manually and then boot into recovery and have the installs work.

    I have tried re-installing PhilZ recovery and fixed permissions etc but no luck. Your Nandroid backup process still works fine for me.

    Any ideas on what I need to do?

    I am running Wanamlite 5.7 with Philz latest recovery on an i9300.
  3. SUroot

    SUroot Well-Known Member Developer

    Ooh that reminds me, must download 5.7 myself...

    So you've upgraded to 5.7 then tried to use the profile but it wont copy to /cache/recovery?

    In Step 6 of the Task, ensure "use root" is still ticked. This step needs root to move to /cache.
  4. simonwil

    simonwil New Member

    It is ticked.

    BTW - thanks for the quick reply.

    Sent from my GT-I9300 using Tapatalk 2
  5. SUroot

    SUroot Well-Known Member Developer

    Can you untick it and save, then re tick it and save please? Disable the "Reboot recovery" step and run the task again?
  6. SUroot

    SUroot Well-Known Member Developer

    Not sure if this is good news or bad news, but I just upgraded to 5.7 (using teh Task) then I disabled the "reboot recovery", ran the task and confirmed extendedcommands was moved to /cache/recovery successfully.
  7. simonwil

    simonwil New Member

    I installed Perseus Kernel and now it works again. :D:thumbup:

    Sent from my GT-I9300 using Tapatalk 2
  8. SUroot

    SUroot Well-Known Member Developer

    Oh ok. I never uninstalled perseus (I untick kernel in Aroma) That's odd though. Wonder what stops it working on that one task when the other does the same.

Share This Page