Commit graph

144 commits

Author SHA1 Message Date
Arian
504571afb7
Lineage 20.0
Change-Id: I49cf6e7d02ecc36c03b27f50d4b35a70510de6e9
2022-08-23 02:02:19 +03:00
Nolen Johnson
180be0af6b LineageOS 19.1
Change-Id: I52d4109d4e1bacdbc08a5e640dfcdfdd8d319bf3
2022-03-14 17:19:28 +01:00
Han Wang
c52b5a0883
Remove fake wget
* Toybox supports it now, and there is no real need for
   this tool.

Change-Id: I6f3f8e10f148ffc9626cd150ea21275096d2daed
2021-11-14 20:20:53 +02:00
Michael Bestas
e843a047cd Lineage 19.0
Change-Id: I406a755d475de4ca7f92f58164282c7a07a06743
2021-10-07 19:57:15 +02:00
Erik Jensen
31a8d98385 backuptool: Support tab-delimited fstab
Change-Id: Ib3fcde92d0c1ebb8754b11c577e4885d8dd02624
2021-09-04 14:30:36 +02:00
Tim Zimmermann
11c43d2e93
backuptool: use correct BLK_PATH on a-only dynamic partitions devices
Change-Id: I295d39e35245e3541648369acbfe79d88ac21865
2021-05-08 16:17:27 +02:00
Alessandro Astone
02f0ab69db backuptool: Ensure dedicated partitions are not unused before mounting
* Ignore the block devices in case their mount points are symlinks.
  This is common on devices where maintainers have chosen not to use
  real partitions because of their size being too small to be useful

Also `continue` instead of `break`. Oops.

Change-Id: I3e27abe510219066ecacd81d099220ac8e119f9f
2021-04-07 23:08:20 +02:00
Alessandro Astone
adaad8f74f backuptool: Do not set ADDOND_VERSION=2 for a-only
There are addon.d scripts that rely on the value of ADDOND_VERSION
to determine if they're being called from a-only vs a/b backuptool.

If they declare ADDOND_VERSION=3, they shall stop doing that;
otherwise offer them the same environment, that is unset ADDOND_VERSION
for a-only backuptool.

Change-Id: I1be21eda2e6ec9837b3080bb5e7fbe5241318eaa
2021-03-28 18:33:43 +02:00
Alessandro Astone
b5f3a4a72d backuptool: Ensure to cleanup the environment on failure
Change-Id: I6f974a40b4f3f4a0a1f3a4b46bf8e0cfeb81c4ec
2021-03-28 18:33:11 +02:00
Alessandro Astone
f16993e63b backuptool: Correct supported partitions for addon.d v3
* The plan was to support odm & oem too, but it turned out
  unnecessarily complicated due to their symlink setup,
  while being most likely unused.
  The partitions were removed from the list of supported ones
  in a-only backuptool, but were forgotten in ab backuptool.

Change-Id: I58a01cdc3f5c4239048b204f3313f4bf697dd60a
2021-02-18 14:34:21 +01:00
Alessandro Astone
c63fa8441b backuptool: Support seamless backup and restore to extra partitions
For scripts declaring ADDOND_VERSION=3 automatically mount
vendor, product, system_ext and others (when they're dedicated partitions).

Also expose the get_output_path() function to get the path to where
a file is mounted in case it lives in a dedicated partition.

ab exapmles:
get_output_path "system/product/priv-app/MyApp.apk"  = "/postinstall/product/priv-app/MyApk.apk"
get_output_path "system/app/MySystemApp.apk"         = "/postinstall/system/app/MySystemApp.apk"

a-only examples:
get_output_path "/mnt/system/system/product/priv-app/MyApp.apk" = "/mnt/system/system/product/priv-app/MyApp.apk"

******************************************************************
Instead of cycling all scripts for each stage, run
pre-backup -> backup -> post-backup in quick succession
(and likewise for restore), to ensure backwards compatibility
with scripts that wrongly assumed their environment not to
change between steps.
This is needed because we want to undo any mounting done for V3
scripts when executing V2 scripts. If a V2 script did mounting in
pre-restore and expected things to still be mounted in restore,
we would break their (yes incorrect) assumption.

Change-Id: I73fbad6f45824fed99e4482128769435348588f5
2021-02-07 20:07:09 +01:00
Alessandro Astone
6245873019 backuptool_ab: Make tmp actually tmpfs
Change-Id: I668e0f24486197d762981bef4c9f2437c4fa9c14
2021-02-07 20:07:09 +01:00
Bruno Martins
e1df13eb4a Lineage 18.1 is here for Xmas
Change-Id: Ic7bd96c188eb97c53cf245f79c85cc0e0d14a094
2020-12-12 03:26:14 +01:00
razorloves
48ab00f925 backuptool_ab: Use mv instead of cp for restore step
Using cp instead of mv during the restore step resulted in double the
amount of free space and inodes being used.
For example, a nano arm64 opengapps install uses around 500M. But during
a backup/restore process when the Updater is used, it temporarily uses
1G on the other slot.  That causes failed updates on devices that
don't have that much free space on the system partition.

Change-Id: I57ba2e0f52d328d4ff91d47a3db45f47bb8402af
2020-09-25 03:50:30 +02:00
Jan Altensen
dd29a4766a Lineage 18.0
Change-Id: Icda4887efd1a965530213f82fbbf8ae908843b05
2020-09-13 19:45:42 +02:00
z3DD3r
284ec83fee backuptool: Fix backup/restore functionality
Backup/restore functionality was broken in the
Ia1f4ae95c9e4dae4df844853e81c264bc838f177 change
because of incorrect check of the function's result.

check_prereq() function refactored to return 0 if
backuping/restoration is possible. Any work should be
performed only if check_prereq() succeeds.

Change-Id: Ic977dba675df58a228ef4b882b25beb66cc9d2c6
2020-03-04 20:32:58 +03:00
z3DD3r
fa8a442ba2 backuptool: Properly unmount system partition
For non AB devices system partition should be unmounted
if check_prereq function fails.

This patch also refactors backuptool a bit for AB devices
in order to look same as backuptool for non AB devices.

Change-Id: Ia1f4ae95c9e4dae4df844853e81c264bc838f177
2020-03-04 12:42:10 +03:00
Wang Han
e43d699cfe backuptool: Remove backup blacklist/whitelist
Change-Id: Ia89e6fa4c31377a429e0dfa912d0b61393696009
2020-03-03 16:12:08 +01:00
Davide Garberi
18745cffe8 prebuilt: backuptool: Drop addond version check on A-only
* This check was supposed to check whether the script
   addon.d version was lower than backuptool's

 * Given that the backuptool addon.d version is 1, this
   isn't going to happen ever making this check completely
   unuseful

Change-Id: I2464749b52bf4e8825e0b4ef42500ee7d3bbfa61
2020-02-09 11:33:21 +01:00
Davide Garberi
497a6aef36 backuptool: Execute check_blacklist from the current directory
* For some odd reasons executing `cd /system/addon.d` makes the system
   hang and unmount error:
     umount: /system_root: Device or resource busy
 * Don't change directory to not allow the system partition hang

Change-Id: I3d30bdc59c2f05d16823e99046c1dce2e1e6eb73
2020-02-03 14:47:59 +01:00
Davide Garberi
6b83f943ad backuptool: Run check_{black, white}list with proper system path
* If any of these two function gets run on a recovery mounting system
   to /system, /system/addon.d won't exist while /system/system/addon.d will.
 * Run the functions with $S as argument to make this work correctly

Change-Id: I02e7b91429a9e74d28bdb77e56955dad97ca75ac
2020-02-03 14:47:59 +01:00
Davide Garberi
23d677b5de backuptool: Fix addon.d version check for A-only
* The path /postinstall exists only for A/B, causing:
   grep: /postinstall/tmp/addon.d/*sh: No such file or directory

Change-Id: Ia07b3029e949c3e08302457cd08798a4dde00ef6
2020-02-03 14:47:59 +01:00
Davide Garberi
e40c31887d prebuilt: backuptool: Implement dynamic system mount for A-only
* Dynamically mount system to the path chosen by the recovery through backuptool
* This can be helpful because of the fragmentation that will happen with system mount in recovery after Q

Change-Id: I2d1e775efcf87e33319bc7790d1e54bca72116d3
2020-01-10 19:15:42 +01:00
Bruno Martins
8f3d941706 addond: Remove versioning
It doesn't make sense to keep updating this file on
every new version.

Change-Id: I865764eda559407d29364d686603b4ad80a6b445
2020-01-03 15:55:43 +02:00
Michael Bestas
42020e23f5 Lineage 17.1
Change-Id: Iaf3b75e49677b616a19431da8087c338ee7eb8da
2020-01-03 02:03:00 +02:00
Luca Stefani
243b877ea4 Kill sysinit
Change-Id: Ia8d46d794ff829f3fc39ff48d57fdb6f9c03262d
2019-10-23 01:29:31 +02:00
Rashed Abdel-Tawab
b6b3421188 Lineage 17.0
Change-Id: Ib166a6218d18cf192aa314477e4044892b068e97
2019-09-05 10:38:36 +02:00
Luca Stefani
c4e288c467 backuptool_ab: Make copy_file preserve file/directory attrs
Change-Id: I52c7b124ff8364464643c51b3f17dba4e4e49435
2019-08-24 12:18:05 +02:00
LuK1337
57490e6120 lineage: Support system-as-root A-only backuptool
Change-Id: I8336e5ab3c9d03fae7426044066318b987653d99
2018-12-06 17:45:15 +01:00
Rashed Abdel-Tawab
6326caafb8 Lineage 16.0
Change-Id: Id892a06aac619efaef9c76aea8ced19af49672a6
2018-08-10 19:37:27 +01:00
Bruno Martins
920f209fff backuptool_ab: Pick LineageOS properties from build.prop
* The LineageOS versions properties were removed from the build.prop,
    which is resolved properly in commit:
    "lineage: Keep LineageOS versions properties in build.prop"
    Change-Id: I0060141c097b3d14c3710eee1e0caf7110634967

Change-Id: Ib11670474641d6fd14a00f8421e9fe8d1879bbc2
2018-08-10 20:35:01 +02:00
Adrian DC
05ab72add7 backuptool: Resolve incompatible version grep syntax
* The grep errorlevel output was not properly used by the if,
    therefore allowing a device to upgrade with old addons
    instead of aborting the backuptool steps

 * The LineageOS versions properties were removed from the build.prop,
    which is resolved properly in commit:
    "lineage: Keep LineageOS versions properties in build.prop"
    Change-Id: I0060141c097b3d14c3710eee1e0caf7110634967

 * Introduced in the following commit:
    "backuptool: Take into account new location for system default props"
    Change-Id: I62046447876c2198a0c4f88a4f36f4723d417617

This reverts commit 1022cc7c50.
Change-Id: I7f5a3510f64f0ecabfe9d15b5dbc1a667b210eb8
Signed-off-by: Adrian DC <radian.dc@gmail.com>
2018-08-10 20:35:01 +02:00
Adrian DC
29fca646a6 backuptool: Revert "Temporarily render version check permissive"
This reverts commit fa279c980512c5d25de6bbd4f8d6397a2ae2b252.
Change-Id: Ib3e88ef3ff80bd466c9ec73edc8224713d331657
2018-08-10 20:35:01 +02:00
Michael Bestas
95621f3c73 Revert "ota: Validate any installed data's signature against our own"
* otasigcheck doesn't work on encrypted devices and makes
  the zip installation fail since oreo.
* The build part of this was never ported to oreo.

This reverts commit aff5e54c4e.

Change-Id: I411f33c1db64844091c1692ef4706ae541925d4f
2018-08-04 17:46:35 +03:00
Dan Pasanen
524fe03bfb backuptool: introduce addon.d script versioning
* Since A/B addon.d scripts are going to need to do things in a
  specific way or things could go horribly wrong for a user, let's
  introduce versioning so that scripts can claim to be compatible.

* A script can denote it is compatible with addon.d version 2 by
  adding: "# ADDOND_VERSION=2" somewhere in its script.

* Only A/B will require version 2 scripts for now, and version 2
  scripts will still run on non-A/B. Additionally if a script does
  not explicitly denote its version, assume its version 1.

* Version 1: The same old scripts we've always used. We cannot assume
             these will all work with A/B backuptools.

* Version 2: Scripts that denote they are compatible with version 2
             must be aware of the fact that A/B devices will run this
             script for a rom, during a seamless update, mounted at
             /postinstall. The best way to ensure compatibility would
             be to use the pre-designated functions found in the
             backuptool[,_ab].functions scripts.

Change-Id: I5573018dabd21bb64c7c964e2081806072a75243
2018-06-22 16:24:09 +02:00
Dan Pasanen
4a049b563c vendor: add custom backuptools and postinstall script for A/B OTAs
* A/B OTA devices wont run backuptools in recovery (because they don't
  go in to recovery to do an OTA). In these cases let's use a modified
  version to backup/restore from within android upon postinstall.

* Add backuptool_postinstall.sh which will be run prior to the normal
  postinstall script in order to backup/restore via addon.d scripts.

* This needs to be done in such a manner because we need /postinstall
  mounted rw instead of the ro with context= options which are used for
  the normal postinstall (dexopt) script.

Change-Id: I51511870634dd1ec5388adafddb446f95cc5a950
2018-06-22 16:09:56 +02:00
Adrian DC
9dde3d63e8 backuptool: Temporarily render version check permissive
* Due to both following commits, backuptool went permissive
    and lineage properties got lost from the system on devices
    that do not have BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED

    "backuptool: Take into account new location for system default props"
    Change-Id: I62046447876c2198a0c4f88a4f36f4723d417617

    "lineage: Move to Google's method of defining system default props"
    Change-Id: I6cb0e28a7599b010b389cc541015a37010a00f4b

 * Once the properties issue is properly resolved in the sources,
    a period of time is required for "most" of the users to upgrade
    their system with fixed lineage properties before we break addons
    by repairing the backuptool script globally

Change-Id: Iea8865ea9bb05eed56a8a0a7b95e3f04b01c4bae
2018-05-18 22:04:29 +02:00
Bruno Martins
1022cc7c50 backuptool: Take into account new location for system default props
* System default props defined using PRODUCT_SYSTEM_DEFAULT_PROPERTIES
   are stored into /system/etc/prop.default, so that's the location where
   ro.lineage.version prop needs to be checked now. Although, fallback
   to the old location to allow sucessful upgrades.

Change-Id: I62046447876c2198a0c4f88a4f36f4723d417617
2018-03-03 00:46:45 +00:00
Adrian DC
93256e4ac9
vendor: lineage: Upgrade to LineageOS 15.1
* Update backuptool versions
 * Update text references
 * Set version minor to 1

Change-Id: I30eea1f1cb01e2165311364cc62b589669bb1290
2017-12-07 01:36:18 +01:00
Luca Stefani
5c60e4fd24
lineage: Complete the rebrand
* TODO: Rebrand cmsdk when it's in a working state

Change-Id: I0d8d573f9e0032110ae3a0f54ebe11a877b83137
2017-08-23 17:33:22 +03:00
Gabriele M
4fe35097b3 fix check_blacklist function to work on wiped /system partition
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
2017-06-04 19:46:13 +00:00
Gabriele M
0e2d72ecc7 backuptool: Preserve the SELinux context of the files
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
2017-02-27 17:20:28 +01:00
Gabriele M
556246b27b backuptool: Don't rely on the order of the elements in the list
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
2017-02-26 21:07:13 +00:00
Gabriele M
2aad96bf6e backuptool: Preserve symlinks
Without -d, we copy the file sysmlinked rather than the symlink.

Change-Id: Ie0fdd43f29e53334464188c846dd7a3b7bb770cc
2017-02-26 11:40:10 +01:00
Dan Pasanen
0344771b53 vendor: we are now LineageOS
* Change necessary bits to support our project move

Change-Id: I085470d448a243cc9d60b4ce920dee52086f64cd
2016-12-28 19:44:28 +00:00
Steve Kondik
2fd50c4369 Merge branch 'cm-14.0' of git://github.com/CyanogenMod/android_vendor_cm into HEAD 2016-10-26 17:08:11 -07:00
Michael Bestas
89450fb971
More 14.0 -> 14.1 changes
Change-Id: I38a2589e5743aac0d8b13799b3d79cb2dab8e5d6
2016-10-26 22:35:18 +03:00
Adrian DC
13512fb86f backuptool: /system/addon.d explicit creation
* 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
2016-10-26 02:30:46 -07:00
Adrian DC
9b4114ee47
vendor: cm: Updates for CM-14.0
* Fix the backuptool for the new version
 * Update text references

Change-Id: I3d557cc4eb5feb07ebbff372dae6d165d29d94ee
2016-09-03 20:31:52 +02:00
Tom Marshall
139e798bf9 otasigcheck: Avoid long lines in XML
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
2016-01-04 10:26:54 -08:00