{"id":16200016,"url":"https://github.com/rinigus/patcher","last_synced_at":"2025-09-11T06:36:45.248Z","repository":{"id":74209903,"uuid":"70221397","full_name":"rinigus/patcher","owner":"rinigus","description":"Scripts to find the difference between system partition in two Android ZIP files","archived":false,"fork":false,"pushed_at":"2016-10-11T14:02:34.000Z","size":186,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T17:48:55.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rinigus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-07T06:32:29.000Z","updated_at":"2016-10-07T07:24:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"dddda22d-1c85-43d9-bded-0dda99c49c43","html_url":"https://github.com/rinigus/patcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rinigus/patcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinigus%2Fpatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinigus%2Fpatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinigus%2Fpatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinigus%2Fpatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rinigus","download_url":"https://codeload.github.com/rinigus/patcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinigus%2Fpatcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272186207,"owners_count":24888332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T09:29:04.271Z","updated_at":"2025-08-26T06:39:44.732Z","avatar_url":"https://github.com/rinigus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# patcher\nScripts to find the difference between system partition in two Android ZIP files\n\nNB! This is work in progress!\n\n## Aim\n\nThese scripts are tailored for building a flashable ZIP that allows\nyou to update Android system partition from VERSION_OLD to\nVERSION_NEW.\n\nTo generate such flashable ZIP, two installation flashable ZIPs with\ndifferent Android versions should be given.\n\n## Requirements\n\n* python with numpy installed\n* python3 for sdat2img\n* Linux with sudo access\n\n\n## Workflow\n\nNB! All scripts should be executed from the directory with the\nscripts. Android ZIPs can be somewhere else in the system.\n\n* Download two Android ZIPs. In this example we will use\n  cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip and\n  cm-12.1-20160928-UNOFFICIAL-mako.zip.\n\n* Extract and mount system partition via mount-loop. For that, use\n  uncompress-android-zip.sh script. Note that this script will run\n  sudo to mount extracted image in the end of it:\n\n  * `./uncompress-android-zip.sh cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip`\n  * `./uncompress-android-zip.sh cm-12.1-20160928-UNOFFICIAL-mako.zip`\n\n  This would result in system partitions visible under\n  \n  * cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip-uncompressed/system-sf\n  * cm-12.1-20160928-UNOFFICIAL-mako.zip-uncompressed/system-fs\n\n  (note that its system-fs to avoid clashes with possible system\n  folder in Android ZIP).\n\n* Find and copy the files that are different between two system\n  images. Since you want to preserve UID/GID, you have to run the\n  script doing it as sudo:\n\n  * `sudo python patcher.py cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip-uncompressed/system-fs cm-12.1-20160928-UNOFFICIAL-mako.zip-uncompressed/system-fs system`\n\n  The arguments are: \u003cOLD_VERSION_SYSTEMFS\u003e \u003cNEW_VERSION_SYSTEMFS\u003e system\n\n  with the last one being the folder that would contain the\n  difference. Keep it as \"system\" to use the next script.\n\n* **Verify that zip/META-INF/com/google/android/updater-script\n  corresponds to your device!** Right now, its made for Nexus 4 with\n  corresponding binary blob\n  zip/META-INF/com/google/android/update-binary. Take a look on your\n  device Sailfish image to get \n\n  * zip/META-INF/com/google/android/update-binary may need to be replaced\n    with the one from your device (different architecture, for example)\n\n  * Line with assert in zip/META-INF/com/google/android/updater-script\n    has to be updated\n\n  * IMPORTANT! Update lines with mount. Right now its\n\n    * mount(\"ext4\", \"EMMC\", \"/dev/block/platform/msm_sdcc.1/by-name/system\", \"/system\");\n    * mount(\"ext4\", \"EMMC\", \"/dev/block/platform/msm_sdcc.1/by-name/userdata\", \"/data\");\n\n    See what are yours mount options (you could check corresponding\n    scripts for CM and SFOS).\n\n\n* Make flashable ZIP by running\n\n  * `./makezip.sh`\n\n  You maybe be asked for sudo password again to make get all\n  files in system (permissions of some files).\n\n  Flashable ZIP should be under \"zip\" subfolder under name update.android.zip\n\n* Cleanup:\n\n  * unmount loop filesystems:\n    * `sudo umount cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip-uncompressed/system-fs`\n    * `sudo umount cm-12.1-20160928-UNOFFICIAL-mako.zip-uncompressed/system-fs`\n\n  * Delete temp files/folders:\n    * `sudo rm -rf system`\n    * `rm -rf cm-12.1-20151007-SNAPSHOT-YOG4PAO334-mako.zip-uncompressed`\n    * `rm -rf cm-12.1-20160928-UNOFFICIAL-mako.zip-uncompressed`\n\n You would have your new update zip and corresponding tar.bz2 in zip\n folder.\n  \n  \n## Upgrading CM base on device\n\nTo update the base on your device, you have to choose which method do\nyou prefer: flashing from recovery or update on the live\nsystem. Below, the both options are demonstrated:\n\n* Flashing from recovery (THIS IS NOT TESTED, LET ME KNOW IF ANYTHING\n  IS WRONG) (WARNING 2: NOT SURE IT WOULD WORK ON MULTIROM ASIS):\n  \n  * get update.android.zip from zip folder into your device\n  * go to your recovery and flash it on the top of Sailfish\n    installation.\n\n\n* Update CM system base in MultiROM in 'live' system. I had to use\n  this approach since my version of MultiROM did not allow to flash on\n  top of Sailfish installation. \n\n\t* download update-system.tar.gz into your device\n\t* enable Developer mode\n\t* enter developer mode (devel-su) and under it:\n\t  * cd /data/.stowaways/sailfishos/system\n\t  * tar zxvf ~nemo/update-system.tar.gz\n\n\tThe last line assumed that downloaded update-system.tar.gz was in\n    ~nemo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinigus%2Fpatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frinigus%2Fpatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinigus%2Fpatcher/lists"}