Warren Togami | b1637c8 | 2012-03-03 22:37:42 -1000 | [diff] [blame] | 1 | #!/sbin/sh |
Luca Stefani | 5c60e4f | 2017-08-17 19:28:48 +0200 | [diff] [blame] | 2 | # |
Dan Pasanen | 524fe03 | 2018-01-26 10:26:47 -0600 | [diff] [blame] | 3 | # ADDOND_VERSION=2 |
| 4 | # |
Luca Stefani | 5c60e4f | 2017-08-17 19:28:48 +0200 | [diff] [blame] | 5 | # /system/addon.d/50-lineage.sh |
Rashed Abdel-Tawab | b6b3421 | 2019-09-04 15:08:51 -0700 | [diff] [blame] | 6 | # During a LineageOS 17.0 upgrade, this script backs up /system/etc/hosts, |
Warren Togami | b1637c8 | 2012-03-03 22:37:42 -1000 | [diff] [blame] | 7 | # /system is formatted and reinstalled, then the file is restored. |
| 8 | # |
| 9 | |
| 10 | . /tmp/backuptool.functions |
| 11 | |
| 12 | list_files() { |
| 13 | cat <<EOF |
| 14 | etc/hosts |
| 15 | EOF |
| 16 | } |
| 17 | |
| 18 | case "$1" in |
| 19 | backup) |
| 20 | list_files | while read FILE DUMMY; do |
| 21 | backup_file $S/"$FILE" |
| 22 | done |
| 23 | ;; |
| 24 | restore) |
| 25 | list_files | while read FILE REPLACEMENT; do |
| 26 | R="" |
| 27 | [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT" |
| 28 | [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R" |
| 29 | done |
| 30 | ;; |
| 31 | pre-backup) |
| 32 | # Stub |
| 33 | ;; |
| 34 | post-backup) |
| 35 | # Stub |
| 36 | ;; |
| 37 | pre-restore) |
| 38 | # Stub |
| 39 | ;; |
| 40 | post-restore) |
| 41 | # Stub |
| 42 | ;; |
| 43 | esac |