blob: ed4805c10cec842b7e092d8ab922fe315d418532 [file] [log] [blame]
Andrew Dodd0c209012013-09-28 15:34:25 -04001#!/sbin/sh
2#
3# /system/addon.d/50-hosts.sh
4# During a firmware upgrade, this script backs up /system/etc/hosts,
5# /system is formatted and reinstalled, then the file is restored.
6#
7# This script is primarily used as an example of how to use backuptool
8#
9# Originally implemented in CyanogenMod
10
11. /tmp/backuptool.functions
12
13list_files() {
14cat <<EOF
15etc/hosts
16EOF
17}
18
19case "$1" in
20 backup)
21 list_files | while read FILE DUMMY; do
22 backup_file $S/"$FILE"
23 done
24 ;;
25 restore)
26 list_files | while read FILE REPLACEMENT; do
27 R=""
28 [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
29 [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
30 done
31 ;;
32 pre-backup)
33 # Stub
34 ;;
35 post-backup)
36 # Stub
37 ;;
38 pre-restore)
39 # Stub
40 ;;
41 post-restore)
42 # Stub
43 ;;
44esac