blob: c8b81cb987a51418c173a23aa91493b978a3cbf3 [file] [log] [blame]
Warren Togamib1637c82012-03-03 22:37:42 -10001#!/sbin/sh
2#
3# /system/addon.d/50-cm.sh
Michael Bestaseb83dba2015-10-07 18:38:03 +03004# During a CM13.0 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