If /system is empty, /tmp/addon.d/ will not exist, "*sh" won't be
expanded, md5sum will not generate any output and the variable $s
will be empty. Therefore grep, which will receive only one arg, will
start to read the standard input and never exit, causing the
installation to never end. Fix this checking whether we have files
to read or not.
Change-Id: I656eab42e54b3f81da8c5ac81374b9deddcf8484
Add a function that allows to copy files preserving their SELinux
context that is generic enough to work with both busybox and toybox.
Change-Id: If2c245863df5675c18dbf43b6bcedeb33383fc38
We should not test symlinks using -e or -f, otherwise the order in
which the files are backed up and restored matters.
Change-Id: I9b87972b27a63ef562c0c5f46f943eafd0a08ce1
* Add the addon.d folder creation to preserve_addon_d
before copying the files back to /system/addon.d
* On CM based ROMs, the path exists for built elements,
but on other AOSP-based ROMs where this script might
be used, the folder might not be created on build and
copy fails, breaking backuptool on second ROM update
Change-Id: I7438823b8d7ad0972649d2bf491d0f6fe423bc99
Shells based on busybox, such as found in CM 12.1 recovery and TWRP, do not
properly handle pattern based parameter expansion for variables longer than
4kb. This throws our naive little XML parser into an infinite loop. Since
all such lines are associated with external app certs, just skip them.
Change-Id: I203b65c1ffd62bf3261b3ae315327314a5006952
Rewrite the packages.xml parser to be slightly less brittle. Read
lines from packages.xml and save off the interesting values, then
compare with expected results afterward.
This both avoids using grep's -A option, which is not supported in
toybox, and allows the script to recognize the cert tag regardless
of its position inside the package tag.
Change-Id: Idc0006e38f4a3f9d5aec223a8a1571f5c11fe3bb
* Lots of stuff in the wild actually uses wget, and Toybox doesn't
provide it. We already have Curl which does the same thing just
with some different arguments. This wrapper script can handle it.
Change-Id: Ic02da709fcd29808b96fabcd1ac4ddd9465f635f
If the --wipe_data command is being passed to recovery, skip the
signature check since the data will be wiped after the update is
installed
Change-Id: I6641f25abd044110faaf170ab2f7982460e77bcb
It appears that some versions of sed do not work with the + symbol.
Instead of checking for one or more digits, check for a digit,
followed by zero or more digits.
Change-Id: I064df6a2bac4a634a3684ac1a5289dca1f4ba29c
* Remove all this stuff. If a device wants ZRAM, it should be
enabled by the maintainer and properly configured and tuned.
* This stuff currently causes a conflict with the ZRAM support
added in Kitkat. Kill it.
Change-Id: Ib2488ea4463e32ec44b65fe786f732145b5b6e23
This reverts commit ea14a88a2a.
Using the Package Manager prevents any danling wakelock from
killed service/receiver.
Change-Id: Ie3162ca4b18a7bc9c55613af39e88ea980407e5f
- remove SpareParts: it's disabled and broken, the options it provides
are either useless/broken or available in development settings
- remove modelid_cfg.sh: no devices are using this any more
- remove opticharger: it's not used any more
Change-Id: I68c86b2407486c4b40998288cf1f70b7cb8170f4
Keep a blacklist of md5 sums for scripts known to cause issues, and
ignore them when installing new builds
Change-Id: I19a88b58194a32da5eb5fe278f2c5b9a145b57be
backuptool should not be messing with whether /system is mounted
or not as it screws up the expectations of other scripts run
in the install process. instead the mounting/unmounting
functionality has been moved to ota_from_target_files
Change-Id: I0711afd517638e7d0a0c39369d3a776748245dd2
Tips & Tricks
=============
* 50-cm.sh contains only a reference implementation. You may customize the methods however you wish.
For example, 20-foobar.sh pre-backup can use a loop with conditionals to generate a dynamic backup list in
/tmp/foobar_file_list which is later printed by list_files() so the backup method will act on those files.
* Optional methods pre-backup, post-backup, pre-restore, or post-restore may be defined for special purposes.
* Inject new files into /tmp/addon.d/ prior to backuptool.sh backup if you want to act during the current CM upgrade.
* Delete files from /tmp/addon.d/ during post-restore if you want to permanently remove files from /system/addon.d/
Addons may use this approach to run a script only once.
* Scripts run in sort -n order. Prefix with numbers 00 through 99 if want to run in a particular order.
* You can have two separate scripts, implementing only backup in one, and only restore in the other with a different
number prefix of each. This allows even greater control the backup/restore order even further.
* You could use pre-backup to generate a one-time use backup script in /tmp/addon.d/ that deletes itself in
post-restore.
Patch Series
============
http://review.cyanogenmod.com/#change,13265
CyanogenMod/android_build
* edify generator
http://review.cyanogenmod.com/#change,13266
CyanogenMod/android_system_core
* permissions on /system/addon.d
http://review.cyanogenmod.com/#change,13267
CyanogenMod/android_vendor_cm
* 50-cm.sh reference backup script
* modular backuptool.sh
* support backuptool.functions used by /system/addon.d/*.sh scripts
Change-Id: Ifd5eaf9dcfd68d92e5043c21d1bae1dc0ad54860
Currently the tool only backs up the lib, but not the apk.
Seeing as how the market version of voice search is still not
up to date with the current release, it should still be backed
up with this script.
Change-Id: Ia130bb3e289fc3c2206a60ed0fcfd7dab816425d
Since the destination for all backed up files during an installation was
/tmp, all files sharing a name (like the full_model.bin files from
the various face detectors) ended up being restored as copies of
the last such file, effectively breaking the backup.
As a fix, when backing up files, use the entire original path to make
sure they're kept separate and restorable.
Change-Id: I399f7a9433a225871d97e0ecaeb051a90e68696b