vendor: fix backuptool for O
we run the backuptool scripts now right from system
and no longer copy them into /tmp
also add some debug hooks
Change-Id: I7550942e54e0dfbcd5282da7024489428284ceff
diff --git a/prebuilt/bin/backuptool.functions b/prebuilt/bin/backuptool.functions
index 1d80a9b..2734446 100644
--- a/prebuilt/bin/backuptool.functions
+++ b/prebuilt/bin/backuptool.functions
@@ -6,16 +6,21 @@
export C=/tmp/backupdir
export S=/system
+DEBUG=0
+
backup_file() {
if [ -e "$1" ]; then
local F=`basename "$1"`
local D=`dirname "$1"`
# dont backup any apps that have odex files, they are useless
if ( echo "$F" | grep -q "\.apk$" ) && [ -e `echo "$1" | sed -e 's/\.apk$/\.odex/'` ]; then
- echo "Skipping odexed apk $1";
+ echo "Skipping odexed apk $1"
else
mkdir -p "$C/$D"
- cp -p $1 "$C/$D/$F"
+ cp -p "$1" "$C/$D/$F"
+ if [ $DEBUG -eq 1 ]; then
+ echo backup_file "$1" "$C/$D/$F"
+ fi
fi
fi
}
@@ -25,12 +30,15 @@
local DIR=`dirname "$1"`
if [ -e "$C/$DIR/$FILE" ]; then
if [ ! -d "$DIR" ]; then
- mkdir -p "$DIR";
+ mkdir -p "$DIR"
fi
- cp -p "$C/$DIR/$FILE" "$1";
+ cp -p "$C/$DIR/$FILE" "$1"
+ if [ $DEBUG -eq 1 ]; then
+ echo restore_file "$C/$DIR/$FILE" "$1"
+ fi
if [ -n "$2" ]; then
echo "Deleting obsolete file $2"
- rm "$2";
+ rm "$2"
fi
fi
}