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