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

Commit 400e4fa4 authored by Wang Han's avatar Wang Han Committed by Aaron Kling
Browse files

backuptool: Remove backup blacklist/whitelist

Change-Id: Ia89e6fa4c31377a429e0dfa912d0b61393696009
parent a0583ca7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ endif
PRODUCT_COPY_FILES += \
    vendor/lineage/prebuilt/common/bin/backuptool.sh:install/bin/backuptool.sh \
    vendor/lineage/prebuilt/common/bin/backuptool.functions:install/bin/backuptool.functions \
    vendor/lineage/prebuilt/common/bin/50-lineage.sh:system/addon.d/50-lineage.sh \
    vendor/lineage/prebuilt/common/bin/blacklist:system/addon.d/blacklist
    vendor/lineage/prebuilt/common/bin/50-lineage.sh:system/addon.d/50-lineage.sh

ifeq ($(AB_OTA_UPDATER),true)
PRODUCT_COPY_FILES += \
+4 −46
Original line number Diff line number Diff line
@@ -47,45 +47,15 @@ restore_addon_d() {
check_prereq() {
# If there is no build.prop file the partition is probably empty.
if [ ! -r $S/build.prop ]; then
    return 0
    exit 127
fi
if ! grep -q "^ro.lineage.version=$V.*" $S/build.prop; then
  echo "Not backing up files from incompatible version: $V"
  return 0
  exit 127
fi
return 1
}

check_blacklist() {
  if [ -f $S/addon.d/blacklist -a -d /$1/addon.d/ ]; then
      ## Discard any known bad backup scripts
      cd /$1/addon.d/
      for f in *sh; do
          [ -f $f ] || continue
          s=$(md5sum $f | cut -c-32)
          grep -q $s $S/addon.d/blacklist && rm -f $f
      done
  fi
}

check_whitelist() {
  found=0
  if [ -f $S/addon.d/whitelist ];then
      ## forcefully keep any version-independent stuff
      cd /$1/addon.d/
      for f in *sh; do
          s=$(md5sum $f | cut -c-32)
          grep -q $s $S/addon.d/whitelist
          if [ $? -eq 0 ]; then
              found=1
          else
              rm -f $f
          fi
      done
  fi
  return $found
}

# Execute /system/addon.d/*.sh scripts with $1 parameter
run_stage() {
if [ -d /tmp/addon.d/ ]; then
@@ -124,13 +94,7 @@ case "$1" in
  backup)
    mount_system
    mkdir -p $C
    if check_prereq; then
        if check_whitelist system; then
            unmount_system
            exit 127
        fi
    fi
    check_blacklist system
    check_prereq
    preserve_addon_d
    run_stage pre-backup
    run_stage backup
@@ -139,13 +103,7 @@ case "$1" in
  ;;
  restore)
    mount_system
    if check_prereq; then
        if check_whitelist tmp; then
            unmount_system
            exit 127
        fi
    fi
    check_blacklist tmp
    check_prereq
    run_stage pre-restore
    run_stage restore
    run_stage post-restore
+4 −44
Original line number Diff line number Diff line
@@ -47,43 +47,13 @@ restore_addon_d() {
check_prereq() {
# If there is no build.prop file the partition is probably empty.
if [ ! -r /system/build.prop ]; then
    return 0
    exit 127
fi

grep -q "^ro.lineage.version=$V.*" /system/build.prop && return 1

echo "Not backing up files from incompatible version: $V"
return 0
}

check_blacklist() {
  if [ -f /system/addon.d/blacklist -a -d /$1/addon.d/ ]; then
      ## Discard any known bad backup scripts
      cd /$1/addon.d/
      for f in *sh; do
          [ -f $f ] || continue
          s=$(md5sum $f | cut -c-32)
          grep -q $s /system/addon.d/blacklist && rm -f $f
      done
  fi
}

check_whitelist() {
  found=0
  if [ -f /system/addon.d/whitelist ];then
      ## forcefully keep any version-independent stuff
      cd /$1/addon.d/
      for f in *sh; do
          s=$(md5sum $f | cut -c-32)
          grep -q $s /system/addon.d/whitelist
          if [ $? -eq 0 ]; then
              found=1
          else
              rm -f $f
          fi
      done
  fi
  return $found
exit 127
}

# Execute /system/addon.d/*.sh scripts with $1 parameter
@@ -104,24 +74,14 @@ fi
case "$1" in
  backup)
    mkdir -p $C
    if check_prereq; then
        if check_whitelist postinstall/system; then
            exit 127
        fi
    fi
    check_blacklist postinstall/system
    check_prereq
    preserve_addon_d
    run_stage pre-backup
    run_stage backup
    run_stage post-backup
  ;;
  restore)
    if check_prereq; then
        if check_whitelist postinstall/tmp; then
            exit 127
        fi
    fi
    check_blacklist postinstall/tmp
    check_prereq
    run_stage pre-restore
    run_stage restore
    run_stage post-restore

prebuilt/common/bin/blacklist

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line
80f99c594f7b82c4cbe533e3f5447729
29f4bab6bae5959458678869350dc888
77d73f73da664f3592e712b7e7c107c1
a5019b358023a3a6ae8be3f3380ba5ca

prebuilt/common/bin/whitelist

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
b0a27bcb5c7504a81e1450a8313e37cb