|
|
|
#!/system/bin/sh
|
|
|
|
#
|
|
|
|
# Functions for backuptool_ab.sh
|
|
|
|
#
|
|
|
|
|
|
|
|
export S=/system
|
|
|
|
export C=/postinstall/tmp/backupdir
|
|
|
|
export V=17.0
|
|
|
|
export backuptool_ab=true
|
|
|
|
|
|
|
|
copy_file() {
|
|
|
|
old=`umask`
|
|
|
|
umask 0322
|
|
|
|
mkdir -m755 -p `dirname $2`
|
|
|
|
umask "$old"
|
|
|
|
|
|
|
|
cp -dp --preserve=a "$1" "$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
backup_file() {
|
|
|
|
if [ -e "$1" -o -L "$1" ]; then
|
|
|
|
# dont backup any apps that have odex files, they are useless
|
|
|
|
if ( echo "$1" | grep -q "\.apk$" ) && [ -e `echo "$1" | sed -e 's/\.apk$/\.odex/'` ]; then
|
|
|
|
echo "Skipping odexed apk $1";
|
|
|
|
else
|
|
|
|
copy_file "$1" "$C/$1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
restore_file() {
|
|
|
|
if [ -e "$C/$1" -o -L "$C/$1" ]; then
|
|
|
|
copy_file "$C/$1" "/postinstall/$1";
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
echo "Deleting obsolete file $2"
|
|
|
|
rm "$2";
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|