Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A postinstall data breaks backup due to set -e #44

Closed
bitstreamout opened this issue Dec 25, 2022 · 2 comments
Closed

A postinstall data breaks backup due to set -e #44

bitstreamout opened this issue Dec 25, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@bitstreamout
Copy link

Device info

Manufacturer: Nokia
Android version: 10.0
Custom ROM/rooted? No
Model: 7 plus

System info

Available disk space: 539213824 kB
Operating system: Linux ... openSUSE Leap 15.3


Describe the issue below.

The command ./backup.sh stops at the line

adb: error: failed to stat remote object '/data/preloads/apps-postinstall/GoogleHandWritingIME/GoogleHandWritingIME.apk': Permission denied

just listed all apps an indeed this is the only one

Nokia/linux-android-backup-master> adb shell pm list packages -3 -f | grep apps-postinstall
package:/data/preloads/apps-postinstall/GoogleHandWritingIME/GoogleHandWritingIME.apk=com.google.android.apps.handwriting.ime

will try to add an exception for this postinstall in the list

@bitstreamout bitstreamout added the bug Something isn't working label Dec 25, 2022
@bitstreamout
Copy link
Author

Here a first workaround ... guess: tar would also work with this method, but due to the visible error I've choosen the adb method

Simple workaround

---
 backup.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- backup.sh
+++ backup.sh   2022-12-25 14:10:06.041313595 +0000
@@ -74,7 +74,7 @@ function get_file() {
   if [ "$export_method" = 'tar' ]; then
     adb exec-out "tar -c -C $1 $2 2> /dev/null" | pv -p --timer --rate --bytes | tar -C $3 -xf -
   else # we're falling back to adb pull if the variable is empty/unset
-    adb pull $1/$2 $3
+    adb pull $1/$2 $3 || echo "Can not backup $2 ignoring it" 1>&2
   fi
 }
 
@@ -221,7 +221,7 @@ then
       # apk_path=/data/app/~~4wyPu0QoTM3AByZS==/com.whatsapp-iaTC9-W1lyR1FxO==/base.apk
       # apk_base=47856542.apk
       get_file $(dirname $apk_path) $(basename $apk_path) ./backup-tmp/Apps
-      mv ./backup-tmp/Apps/$(basename $apk_path) ./backup-tmp/Apps/$apk_base
+      mv ./backup-tmp/Apps/$(basename $apk_path) ./backup-tmp/Apps/$apk_base || echo "Not found $(basename $apk_path)" 1>&2
     )
   done
 

@mrrfv
Copy link
Owner

mrrfv commented Dec 28, 2022

I'll consider adding this workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants