blob: 724c444a4d7b602044ea213e1df336ddaccb84fa [file] [log] [blame]
Warren Togamib1637c82012-03-03 22:37:42 -10001#!/sbin/sh
2#
3# /system/addon.d/50-cm.sh
David Gasawayfc613a82013-12-22 12:49:37 -10004# During a CM11 upgrade, this script backs up /system/etc/hosts,
Warren Togamib1637c82012-03-03 22:37:42 -10005# /system is formatted and reinstalled, then the file is restored.
6#
7
8. /tmp/backuptool.functions
9
10list_files() {
11cat <<EOF
12etc/hosts
13EOF
14}
15
16case "$1" in
17 backup)
18 list_files | while read FILE DUMMY; do
19 backup_file $S/"$FILE"
20 done
21 ;;
22 restore)
23 list_files | while read FILE REPLACEMENT; do
24 R=""
25 [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
26 [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
27 done
28 ;;
29 pre-backup)
30 # Stub
31 ;;
32 post-backup)
33 # Stub
34 ;;
35 pre-restore)
36 # Stub
37 ;;
38 post-restore)
39 # Stub
40 ;;
41esac