OSDN Git Service

Add a script to run Android-x86 in QEMU
[android-x86/bootable-newinstaller.git] / initrd / init
index a91e4ad..32d6a4e 100755 (executable)
@@ -3,7 +3,7 @@
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
 # and Thorsten Glaser <tg@mirbsd.org>
 #
-# Last updated 2017/03/24
+# Last updated 2017/04/23
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -84,10 +84,14 @@ check_root()
                mkdir /mnt/iso
                mount -o loop /iso/$iso /mnt/iso
                SRC=iso
-       elif [ ! -e /mnt/$SRC/$RAMDISK ]; then
+       fi
+       if [ -e /mnt/$SRC/$RAMDISK ]; then
+               zcat /mnt/$SRC/$RAMDISK | cpio -id > /dev/null
+       elif [ -b /dev/$RAMDISK ]; then
+               zcat /dev/$RAMDISK | cpio -id > /dev/null
+       else
                return 1
        fi
-       zcat /mnt/$SRC/$RAMDISK | cpio -id > /dev/null
        if [ -e /mnt/$SRC/system.sfs ]; then
                mount -o loop,noatime /mnt/$SRC/system.sfs /sfs
                mount -o loop,noatime /sfs/system.img system
@@ -97,6 +101,8 @@ check_root()
        elif [ -d /mnt/$SRC/system ]; then
                remount_rw
                mount --bind /mnt/$SRC/system system
+       elif [ -e /mnt/build.prop ]; then
+               mount --bind /mnt system
        else
                rm -rf *
                return 1
@@ -128,7 +134,7 @@ debug_shell()
 echo -n Detecting Android-x86...
 
 [ -z "$SRC" -a -n "$BOOT_IMAGE" ] && SRC=`dirname $BOOT_IMAGE`
-[ -z "$RAMDISK" ] && RAMDISK=ramdisk.img
+[ -z "$RAMDISK" ] && RAMDISK=ramdisk.img || RAMDISK=${RAMDISK##/dev/}
 
 for c in `cat /proc/cmdline`; do
        case $c in