Andreas Gampe | 99e2b26 | 2016-07-09 11:44:12 -0700 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | |
| 3 | # |
| 4 | # Copyright (C) 2016 The Android Open Source Project |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | |
| 19 | # This script will move artifacts for the currently active slot. |
| 20 | |
| 21 | SLOT_SUFFIX=$(getprop ro.boot.slot_suffix) |
| 22 | if test -n "$SLOT_SUFFIX" ; then |
| 23 | if test -d /data/ota/$SLOT_SUFFIX/dalvik-cache ; then |
| 24 | log -p i -t otapreopt_slot "Moving A/B artifacts for slot ${SLOT_SUFFIX}." |
| 25 | rm -rf /data/dalvik-cache/* |
| 26 | mv /data/ota/$SLOT_SUFFIX/dalvik-cache/* /data/dalvik-cache/ |
| 27 | rmdir /data/ota/$SLOT_SUFFIX/dalvik-cache |
| 28 | rmdir /data/ota/$SLOT_SUFFIX |
| 29 | else |
| 30 | log -p i -t otapreopt_slot "No A/B artifacts found for slot ${SLOT_SUFFIX}." |
| 31 | fi |
| 32 | exit 0 |
| 33 | else |
| 34 | log -p w -t otapreopt_slot "Slot property empty." |
| 35 | exit 1 |
| 36 | fi |