Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5911b393 authored by razorloves's avatar razorloves
Browse files

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
parent bbd345b2
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -17,6 +17,15 @@ copy_file() {
  cp -dp --preserve=a "$1" "$2"
}

move_file() {
  old=`umask`
  umask 0322
  mkdir -m755 -p `dirname $2`
  umask "$old"

  mv "$1" "$2"
}

backup_file() {
  if [ -e "$1" -o -L "$1" ]; then
    # dont backup any apps that have odex files, they are useless
@@ -30,7 +39,7 @@ backup_file() {

restore_file() {
  if [ -e "$C/$1" -o -L "$C/$1" ]; then
    copy_file "$C/$1" "/postinstall/$1";
    move_file "$C/$1" "/postinstall/$1";
    if [ -n "$2" ]; then
      echo "Deleting obsolete file $2"
      rm "$2";