[Galaxy S I9000 Android Development] Kino87:
WITH THE NEW CM10 PARTITION LAYOUT THIS SET OF SCRIPTS HAS NO USE ANYMORE, USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING AND YOU ARE SURE YOU NEED THIS.

WHY?

Many people have complained that the new Cyanogenmod 10 partition layout reserved too little space for user application and their data. While I don't find this to be a great deal (having 100+ installed apps usually means many of them are not even used) the solution to the problem is pretty simple, so I've created this tool suite.

FAQ

WHAT DOES THOSE SCRIPTS DO?

Automatic Edition

0.4 AppMover Enabler.zip

When you flash this file if necessary your apk files will be moved to system and a new script will be put in addon.d, this will backup and restore automatically your apps every time you update your rom

This require the rom support, you can check it out HERE if your rom support this function.

0.4 AppMover Disabler.zip

This file will revert everything disabling the automatic backup and restore system and moving apps back to /data. If there is not enough space in /data the script will exit with an error without removing anything.

Developer Edition

0.3dDeveloperEdition.zip

This file contains a modified updater-script and a shell script so that when installing a rom patched with them it will move, backup and restore apks files according to necessity: if the apps are already been moved to /system it will backup them, update the rom and restore the apps; if the apps are still in /data it will update the rom and then move the apps to /system/user_app

Compact Edition

AppToggler.zip

This files moves /data/app to /system/user_app or moves them back to /data/app if you already activated this. If there is not enough space to move the files the script just revert back to a safe condition. You can check the results of the operation in /sdcard/AppMover.txt.

Since the apk files are written only during application installation/updates this should have little to none performance impact while freeing about 70% of the space in /data.

You should use this script just once to move your apk files to the bigger, slower /system partition. Use it again if you want to move them back to the faster /data partition

BackupAndRestore.zip

This files create a backup of /system/user_app to /sdcard/AppBackup.tar. If /system/user_app doesn't exists but there is /sdcard/AppBackup.tar the script assumes you have just updated your rom and restores the backup.

You should use this script

before and after

every rom update since the CM10 update script formats the /system partition wich now contains your apk files

Normal Edition (Discontinued)

AppMover.zip

This script moves /data/app (the folder where downloaded apk are stored) to a new directory in system (/system/user_app) and then create a symlink to that directory.

AppReverter.zip

This script moves back app to /data/app and deletes /system/user_app.

WARNING: Flash this file only if you are sure there is enough space in /data for all the apps! If not you will end with a full /data partition (and relative forcecloses) and you will lose some apps

AppBackup.zip

This script will backup all your app files in an archive in /sdcard

WARNING: Make sure you have enough space in /sdcard for all your apps.

AppRestore.zip

This script will restore the apps from the archive in /sdcard

HOW TO USE:

Automatic Edition

If you want to move your apps to /system just flash AppMover Enabler.zip, this will take care of moving the apk files and preserve them during rom updates

WARNING: During rom updates ensure you have enough space in /emmc and/or /sdcard for the backup of your apk files, if not you will lose all your apps. Ensure your rom is supported (you can check it here). Consider that rom updates will now take longer, even 3 or 4 times what it used to be depending on how many apps you have installed.

If you want to move your apps back to /data flash AppMover Disabler.zip, this will also disable the backup and restore function. If there is not enough space in /data the script will exit with an error before doing anything.

Developer Edition

Replace the rom files with the one in the archive and then flash the rom normally. Make sure you have backupapps.sh in the root of the rom archive and that updater-script is correctly replaced in /META-INF/com/google/android

[YOUTUBE]qZ6fyYkLMnM[/YOUTUBE]​

Compact Edition

To move your apps to /system you have to flash AppToggler.zip.

This should be the first and only time you flash this file since now the fix is applied to a directory level. Newer apps will be installed directly to /system/user_app.

BEFORE flashing/updating your rom you will have to run BackupAndRestore.zip and AFTER flashing the rom you will have to run BackupAndRestore.zip

again

, not doing so will remove all the apps from your phone since at every update /system dir gets formatted.

If you want to move back all your apps to /data you can just flash AppToggler.zip again.

Normal Edition (Discontinued)

To move your apps to /system you have to flash AppMover.zip. This should be the first and only time you flash this file since now the fix is applied to a directory level. Newer apps will be installed directly to /system/user_app.

BEFORE flashing/updating your rom you will have to run AppBackup.zip and AFTER flashing the rom you will have to run AppRestore.zip, not doing so will remove all the apps from your phone since at every update /system dir gets formatted. Note that AppBackup.zip and AppRestore.zip will work both with /system/user_app and with /data/app, so you can use this two file for backup and restore apps (but not their data) in any rom/occasion.

If you want to move back all your apps to /data you can flash AppRevert.zip

If you done everything good and you get a bootloop try to fix permissions in CWR

If the phone works fine but reboots when you try to install new application it is probably because the OS can't write on /system/user_app for some reason.

Try those steps and report if any of those solves the problem:

Open the terminal or use adb shell and type

su
mount -o rw,remount /system

and/or

su
chmod 0777 /data/app
chown 1000:1000 /data/app

In alternative you can try this:

Try to keep in mind that this scripts completely moves /data/app to /system partition. This normally is not a problem, however if you flash something in CWR that needs to read/write something in /data/app (like fixing permissions) make sure to mount /system partition manually

This script should have little to no impact on your rom performance but you may notice some performance loss installing/updating apps.

You may use this script in your rom (integrating the backup/restore into the installation script of a rom would make life simpler for everyone) or improve it, I just ask you to give me some credit.

DISCLAIMER:

This script may contain bugs and is far from perfect. Read instruction twice and make a full nandroid backup before flashing anything, since human errors could be pretty devastating. Anyhow in case of problems I will try to help and improve the scripts but I won't be responsible for any damage to your phone or data, including -but not limited- to: bootloops, app or data loss, alien invasion and thermonuclear war.

==================================================

DOWNLOAD LINK

==================================================
​

CHANGELOG:

23th September 2012

V 0.5 (All versions) - Updated init.d script, renamed again as S99SystemApps to make it work on devil kernel. Now the script renames init.d scripts that doesn't start with S#. Is still possible that some scripts get executed after mine, but should be pretty rare.

V 0.5 Automatic Edition - Modified so that in case of problems the phone will reboot before deleting anything, thanks to Silentbob999 for the idea.

19th September 2012

V 0.4.2 Compact Edition - Fixed a typoes in AppToggler and BackupAndRestore.

V 0.4.2 Automatic Edition - Fixed the error you get if you try to flash the Enabler this just after formatting data (didn't test it, but it should work).

V 0.4.1 Init.d Updater - Published a flashabile file to update the init.d script so that you can use the updated one without having to toggle apps or extract it manually from the archive.

V 0.4.1 Compact Edition - Little update to AppToggler so that even if exits on error it still updates the init.d script

V 0.4.1 (All Versions) - Updated init.d script, added some fixes for problem no norma user should ever experience

17th September 2012

V 0.4 Automatic Edition - Automatic version published

V 0.4 Developer and Compact Edition - Renamed /etc/init.d/S99SystemApps in /etc/init.d/z99SystemApps, this will make less likely that some script gets executed after it and sets back /system to read only

14th September 2012

V 0.3.2 (both) - Hotfix, looks like the hotfix applied to init.d did the trick, same correction applied to remaining scripts

13th September 2012

V 0.3.1 (both) - Hotfix, seems that on some phones /system is mounted as read only. Modified init.d script to remount /system in RW if needed

V 0.3 developer edition - Almost rewritten from scratch, now there should be no problems if flashing from gingerbread and if any problem occurs the script should stop before deleting anything. Completely rewritten log system. Temporary apk backup will now be placed in /data /emmc or /sdcard, according to where there is enough space. Added file in init.d that helps preventing corruptions, hopefully system reboots when new applications are installed are gone.

V 0.3 compact edition - Added a lot of space checks. The backup is now saved on /emmc, if there is not enough space there is saved on /sdcard. If there is not enough space anywhere script will now exit with error. Completely rewritten log system. Added file in init.d that helps preventing corruptions, hopefully system reboots when new applications are installed are gone.

Normal Edition - Dropped unless I get enough requests to work on it, is almost equivalent to the compact version and having to work and test 3 version instead of 2 is just time consuming.

5th September 2012

V 0.2.5 developer edition - New version to replace CM10 stock update script, intended to be used by developers in their rom

30th August 2012

V 0.1c compact edition - Initial compact edition Release

V 0.2.5 - Fixed the error where app folder was restored in /system/user_app for good

25th August 2012

V 0.2 - Fixed an error in AppBackup.zip that could lead to follow recursively the symlink of the app directory (again and again and again..)

22th August 2012

V 0.1 - Initial Release