2010-06-25 03:36:11 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
#
|
|
|
|
# Backup and restore proprietary Android system files
|
|
|
|
#
|
|
|
|
|
|
|
|
C=/tmp/backupdir
|
|
|
|
S=/system
|
2011-11-27 19:56:54 +00:00
|
|
|
V=CyanogenMod-9
|
2010-06-25 03:36:11 +00:00
|
|
|
|
|
|
|
PROCEED=1;
|
|
|
|
|
|
|
|
check_prereq() {
|
|
|
|
if ( ! grep -q "^ro.modversion=.*$V.*" /system/build.prop );
|
|
|
|
then
|
|
|
|
echo "Not backing up files from incompatible version.";
|
|
|
|
PROCEED=0;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_installscript() {
|
2011-05-13 11:56:19 +00:00
|
|
|
if [ -f "/tmp/.installscript" ] && [ $PROCEED -ne 0 ];
|
2010-06-25 03:36:11 +00:00
|
|
|
then
|
2011-05-13 11:56:19 +00:00
|
|
|
# We have an install script, and ROM versions match!
|
|
|
|
# We now need to check and see if we have force_backup
|
|
|
|
# in either /etc or /tmp/backupdir
|
|
|
|
if [ -f "$S/etc/force_backuptool" ] || [ -f "$C/force_backuptool" ];
|
|
|
|
then
|
|
|
|
echo "force_backuptool file found, Forcing backuptool."
|
|
|
|
else
|
|
|
|
echo "/tmp/.installscript found. Skipping backuptool."
|
|
|
|
PROCEED=0;
|
|
|
|
fi
|
2010-06-25 03:36:11 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
get_files() {
|
|
|
|
cat <<EOF
|
2011-11-27 19:56:54 +00:00
|
|
|
vendor/pittpatt/models/recognition/face.face.y0-y0-22-b-N/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/left_eye-y0-yi45-p0-pi45-rn7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/nose_base-y0-yi45-p0-pi45-r0-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/right_eye-y0-yi45-p0-pi45-rp7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/nose_base-y0-yi45-p0-pi45-rp7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/left_eye-y0-yi45-p0-pi45-rp7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/right_eye-y0-yi45-p0-pi45-rn7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/nose_base-y0-yi45-p0-pi45-rn7-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/right_eye-y0-yi45-p0-pi45-r0-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.3/left_eye-y0-yi45-p0-pi45-r0-ri20.2d_n2/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/yaw_roll_face_detectors.3/head-y0-yi45-p0-pi45-rn30-ri30.5/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/yaw_roll_face_detectors.3/head-y0-yi45-p0-pi45-rp30-ri30.5/full_model.bin
|
|
|
|
vendor/pittpatt/models/detection/yaw_roll_face_detectors.3/head-y0-yi45-p0-pi45-r0-ri30.4a/full_model.bin
|
|
|
|
framework/com.google.widevine.software.drm.jar
|
|
|
|
framework/com.google.android.maps.jar
|
|
|
|
framework/com.google.android.media.effects.jar
|
|
|
|
lib/libfilterpack_facedetect.so
|
|
|
|
lib/libfacelock_jni.so
|
|
|
|
lib/libvoicesearch.so
|
|
|
|
etc/permissions/com.google.android.nfc_extras.xml
|
|
|
|
etc/permissions/com.google.android.media.effects.xml
|
|
|
|
etc/permissions/com.google.android.maps.xml
|
|
|
|
etc/permissions/com.google.widevine.software.drm.xml
|
|
|
|
etc/permissions/features.xml
|
|
|
|
app/LatinImeGoogle.apk app/LatinIme.apk
|
|
|
|
app/MediaUploader.apk
|
2010-06-25 03:36:11 +00:00
|
|
|
app/GoogleFeedback.apk
|
2011-11-27 19:56:54 +00:00
|
|
|
app/GoogleTTS.apk
|
|
|
|
app/CalendarGoogle.apk app/Calendar.apk
|
2010-06-25 03:36:11 +00:00
|
|
|
app/MarketUpdater.apk
|
2011-11-27 19:56:54 +00:00
|
|
|
app/BrowserGoogle.apk app/Browser.apk
|
|
|
|
app/GoogleServicesFramework.apk
|
|
|
|
app/CameraGoogle.apk app/Camera.apk
|
|
|
|
app/YouTube.apk
|
|
|
|
app/GenieWidget.apk
|
|
|
|
app/GooglePackageVerifierUpdater.apk
|
2010-07-02 20:33:54 +00:00
|
|
|
app/SetupWizard.apk app/Provision.apk
|
2011-11-27 19:56:54 +00:00
|
|
|
app/GoogleEarth.apk
|
|
|
|
app/ChromeBookmarksSyncAdapter.apk
|
|
|
|
app/ExchangeGoogle.apk app/Exchange.apk
|
|
|
|
app/GoogleQuickSearchBox.apk
|
|
|
|
app/GoogleLoginService.apk
|
2010-06-25 03:36:11 +00:00
|
|
|
app/Talk.apk
|
2011-11-27 19:56:54 +00:00
|
|
|
app/DeskClockGoogle.apk app/DeskClock.apk
|
|
|
|
app/GooglePackageVerifier.apk
|
|
|
|
app/NfcGoogle.apk app/Nfc.apk
|
|
|
|
app/GoogleBackupTransport.apk
|
|
|
|
app/GalleryGoogle.apk app/Gallery.apk
|
|
|
|
app/VideoEditorGoogle.apk app/VideoEditor.apk
|
|
|
|
app/FaceLock.apk
|
2010-06-25 03:36:11 +00:00
|
|
|
app/Vending.apk
|
2011-11-27 19:56:54 +00:00
|
|
|
app/EmailGoogle.apk app/Email.apk
|
|
|
|
app/GoogleContactsSyncAdapter.apk
|
|
|
|
app/Gmail.apk
|
|
|
|
app/OneTimeInitializer.apk
|
|
|
|
app/NetworkLocation.apk
|
|
|
|
app/TagGoogle.apk
|
|
|
|
app/GooglePartnerSetup.apk
|
2010-07-11 06:49:36 +00:00
|
|
|
etc/hosts
|
2010-08-14 21:46:34 +00:00
|
|
|
etc/custom_backup_list.txt
|
2011-01-24 05:47:14 +00:00
|
|
|
etc/force_backuptool
|
2010-06-25 03:36:11 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2010-08-14 21:46:34 +00:00
|
|
|
get_custom_files() {
|
|
|
|
local L
|
|
|
|
if [ -f "$C/custom_backup_list.txt" ];
|
|
|
|
then
|
|
|
|
[ ! -f $C/fixed_custom_backup_list.txt ] && tr -d '\r' < $C/custom_backup_list.txt \
|
|
|
|
> $C/fixed_custom_backup_list.txt
|
|
|
|
L=`cat $C/fixed_custom_backup_list.txt`
|
|
|
|
cat <<EOF
|
|
|
|
$L
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-06-25 03:36:11 +00:00
|
|
|
backup_file() {
|
|
|
|
if [ -e "$1" ];
|
|
|
|
then
|
|
|
|
if [ -n "$2" ];
|
|
|
|
then
|
|
|
|
echo "$2 $1" | md5sum -c -
|
|
|
|
if [ $? -ne 0 ];
|
|
|
|
then
|
|
|
|
echo "MD5Sum check for $1 failed!";
|
|
|
|
exit $?;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
local F=`basename $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";
|
|
|
|
else
|
2010-07-05 23:36:33 +00:00
|
|
|
cp -p $1 $C/$F
|
2010-06-25 03:36:11 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
restore_file() {
|
|
|
|
local FILE=`basename $1`
|
|
|
|
local DIR=`dirname $1`
|
|
|
|
if [ -e "$C/$FILE" ];
|
|
|
|
then
|
|
|
|
if [ ! -d "$DIR" ];
|
|
|
|
then
|
|
|
|
mkdir -p $DIR;
|
|
|
|
fi
|
|
|
|
cp -p $C/$FILE $1;
|
|
|
|
if [ -n "$2" ];
|
|
|
|
then
|
|
|
|
rm $2;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-06-15 08:40:23 +00:00
|
|
|
# don't (u)mount system if already done
|
|
|
|
UMOUNT=0
|
|
|
|
|
2010-06-25 03:36:11 +00:00
|
|
|
case "$1" in
|
|
|
|
backup)
|
2011-06-15 08:40:23 +00:00
|
|
|
if [ ! -f "$S/build.prop" ]; then
|
|
|
|
mount $S
|
|
|
|
UMOUNT=1
|
|
|
|
fi
|
2010-06-25 03:36:11 +00:00
|
|
|
check_prereq;
|
2011-05-13 11:56:19 +00:00
|
|
|
check_installscript;
|
2010-06-25 03:36:11 +00:00
|
|
|
if [ $PROCEED -ne 0 ];
|
|
|
|
then
|
|
|
|
rm -rf $C
|
|
|
|
mkdir -p $C
|
2010-08-14 21:46:34 +00:00
|
|
|
for file_list in get_files get_custom_files; do
|
|
|
|
$file_list | while read FILE REPLACEMENT; do
|
|
|
|
backup_file $S/$FILE
|
|
|
|
done
|
2010-06-25 03:36:11 +00:00
|
|
|
done
|
|
|
|
fi
|
2011-06-15 08:40:23 +00:00
|
|
|
if [ $UMOUNT -ne 0 ]; then
|
|
|
|
umount $S
|
|
|
|
fi
|
2010-06-25 03:36:11 +00:00
|
|
|
;;
|
|
|
|
restore)
|
2011-06-15 08:40:23 +00:00
|
|
|
if [ ! -f "$S/build.prop" ]; then
|
|
|
|
mount $S
|
|
|
|
UMOUNT=1
|
|
|
|
fi
|
2010-06-25 03:36:11 +00:00
|
|
|
check_prereq;
|
2011-05-13 11:56:19 +00:00
|
|
|
check_installscript;
|
2010-06-25 03:36:11 +00:00
|
|
|
if [ $PROCEED -ne 0 ];
|
|
|
|
then
|
2010-08-14 21:46:34 +00:00
|
|
|
for file_list in get_files get_custom_files; do
|
|
|
|
$file_list | while read FILE REPLACEMENT; do
|
|
|
|
R=""
|
|
|
|
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
|
|
|
|
restore_file $S/$FILE $R
|
|
|
|
done
|
2010-06-25 03:36:11 +00:00
|
|
|
done
|
|
|
|
rm -rf $C
|
|
|
|
fi
|
2011-06-15 08:40:23 +00:00
|
|
|
if [ $UMOUNT -ne 0 ]; then
|
|
|
|
umount $S
|
|
|
|
fi
|
|
|
|
sync
|
2010-06-25 03:36:11 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {backup|restore}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|