1 #!/system/bin/sh 2 # 3 # Copyright (C) 2016 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # This script copies preloaded content from system_b to data partition 18 19 # create files with 644 (global read) permissions. 20 umask 022 21 22 if [ $# -eq 1 ]; then 23 # Where the system_b is mounted that contains the preloads dir 24 mountpoint=$1 25 dest_dir=/data/preloads 26 log -p i -t preloads_copy "Copying from $mountpoint/preloads" 27 # Parallelize by copying subfolders and files in the background 28 for file in $(find ${mountpoint}/preloads -mindepth 1 -maxdepth 1); do 29 cp -rn $file $dest_dir & 30 done 31 # Wait for jobs to finish 32 wait 33 log -p i -t preloads_copy "Copying complete" 34 exit 0 35 else 36 log -p e -t preloads_copy "Usage: preloads_copy.sh <system_other-mount-point>" 37 exit 1 38 fi 39