Here's exactly what I'm looking for - I need an 'update.zip' file that can copy a file (example):


to another folder:


and then it would rename the 'file-to-copy.apk' in the 'system' folder to:


and copy it back to:


It would have to overwrite an already existing 'renamed-file.apk' in 'system/framework' folder.

Note: The permissions can NOT change.

Is it even possible to do this?

Any help would be appreciated!

  • To tell the truth, I just need the correct commands and syntax for update-script or updater-script. – Key-Six Dec 18 '12 at 10:30

Actually you can do that by using the run_program syntax in updater-script to execute a shell script that moves/copies/pastes files while in recovery. But of course, you must extract the files that are to be pasted in somewhere (/tmp for instance).

Part of the updater-script:

package_extract_dir("stuff", "/tmp/stuff");
set_perm(0, 0, 0755, "/tmp/stuff/movefiles.sh");

The sample shell script can be like this (named movefiles.sh in this case):

# Backup files
cp /system/framwork/something.apk /path/you/want

# Paste files
cp /tmp/somethingssss.apk /system/framework/something.apk

# Set back permissions (the copied file has the same permissons, but the new ones does not)
chmod 644 /system/framework/something.apk

But remember, the EOL of updater-script and the shell script must be the same, in UNIX format, or else it won't work.


Copy a file (-p preserves permissions and ownership):

run_program("/sbin/cp", "-p", "/system/framework/file-to-copy.apk", "/system/file-to-copy.apk");

Rename a file (-f forces overwriting the existing file):

run_program("/sbin/mv", "-f", "/system/file-to-copy.apk", "/system/renamed-file.apk");

For reference, the syntax for Edify scripts (that's what they're called) is here: Edify syntax

  • I know this is a couple years old but I wanted to comment on @bmaupin above. The run_program method works great, but the rename method doesn't seem to be recognized by Edify. I can't find any other sources which specify that this method exists. I don't know if it did 2-3 years ago, but if you are looking to do this now, use the run_program. – BenH May 24 '18 at 1:19
  • Good catch! I've been doing most of my work on Motorola devices, and apparently rename is specific to Motorola. I'll update my answer to reflect that. – bmaupin May 24 '18 at 12:08

You cannot execute zip files.

You can move/delete/rename a file in /system/ via adb but you must remount /system/ as writable.

  • Actually, you can 'execute' .zip files via the recovery mode. I cannot use ADB because my device is half-bricked and the USB debugging isn't enabled. – Key-Six Dec 17 '12 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.