blob: c65ebbe5a4d39922b399116b3166816b16b95bac [file] [log] [blame]
Anton Hanssonbead54e2018-10-23 16:26:32 +01001#!/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
Anton Hansson95ae6cf2018-11-13 15:04:41 +000017# This script copies preloaded content from system_other to data partition
Anton Hanssonbead54e2018-10-23 16:26:32 +010018
19# create files with 644 (global read) permissions.
20umask 022
21
22if [ $# -eq 1 ]; then
Anton Hansson95ae6cf2018-11-13 15:04:41 +000023 # Where system_other is mounted that contains the preloads dir
Anton Hanssonbead54e2018-10-23 16:26:32 +010024 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
35else
36 log -p e -t preloads_copy "Usage: preloads_copy.sh <system_other-mount-point>"
37 exit 1
38fi