blob: f436ca240b29b1727b5925f1816a50850892a256 [file] [log] [blame]
Paul Crowley1a965262017-10-13 13:49:50 -07001#!/system/bin/sh
2#
3# Copyright (C) 2017 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
17set -e
18
19case "$3" in
20 *[!0-9]* | '')
21 echo "Invalid user id"
22 exit -1
23 ;;
24esac
25
26if [ x"$4" != x ] ; then
27 echo "Volume must be root volume"
28 exit -1;
29fi
30
31case "$1" in
32 misc_de|misc_ce)
33 computed_path="/data/$1/$3"
34 if [ x"$computed_path" != x"$2" ] ; then
35 echo "Parameter path didn't match computed path: " $computed_path
36 exit -1;
37 fi
38 /system/bin/prepare_dir --mode 700 --uid 0 --gid 0 -- "$computed_path"/vold
39 ;;
40 *)
41 echo "Unknown type: $1"
42 exit -1;
43 ;;
44esac