OSDN Git Service

d5d7a601bb8ac9a9be3263510e003585abca46f5
[android-x86/bootable-newinstaller.git] / initrd / scripts / 2-mount
1 #
2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2010/12/19
4 #
5 # License: GNU Public License
6 # We explicitely grant the right to use the scripts
7 # with Android-x86 project.
8 #
9
10 mount_data()
11 {
12         mountpoint -q data && return
13         if [ -b "$DATA" ]; then
14                 mount $DATA data
15         elif [ -b "/dev/$DATA" ]; then
16                 mount /dev/$DATA data
17         elif [ -d /mnt/$SRC/data ]; then
18                 remount_rw
19                 mount --bind /mnt/$SRC/data data
20         elif [ -f /mnt/$SRC/data.img ]; then
21                 remount_rw
22                 mount -o loop /mnt/$SRC/data.img data
23         else
24                 device_mount_data || mount -t tmpfs tmpfs data
25         fi
26 }
27
28 mount_sdcard()
29 {
30         mountpoint -q sdcard && return
31         if [ -n "$SDCARD" -a -e /mnt/$SRC$SDCARD ]; then
32                 remount_rw
33                 sddir=`dirname $SDCARD`
34                 mkdir /android$sddir
35                 mount --bind /mnt/$SRC$sddir /android$sddir
36         elif [ "$SDCARD" = "premount" ]; then
37         # WARNING: premount the sdcard is deprecated since froyo-x86.
38         # It is left only for backward compatibility and may be removed
39         # in the future.
40                 if [ -d /mnt/$SRC/sdcard ]; then
41                         remount_rw
42                         mount --bind /mnt/$SRC/sdcard mnt/sdcard
43                 elif [ -d data/sdcard ]; then
44                         mount --bind data/sdcard mnt/sdcard
45                 else
46                         mount -o mode=2777,uid=1000,gid=1015 -t tmpfs tmpfs mnt/sdcard
47                 fi
48         fi
49 }