OSDN Git Service

mount source as read-only, and remount read-write later if necessary
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 22 Jul 2009 11:03:03 +0000 (19:03 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 22 Jul 2009 13:01:58 +0000 (21:01 +0800)
initrd/init
initrd/scripts/2-mount

index 2359183..5d7ba74 100755 (executable)
@@ -35,7 +35,7 @@ while [ 1 ]; do
        mdev -s
 
        for device in /dev/sr* /dev/sd[a-z]*; do
-               mount $device /mnt || continue
+               mount -o ro $device /mnt || continue
                cd /mnt/$SRC
                if [ ! -e ramdisk.img -o ! -e system.img ]; then
                        umount /mnt
index 722a822..d2c15a9 100644 (file)
@@ -14,6 +14,7 @@ mount_data()
        elif [ -b "/dev/$DATA" ]; then
                mount /dev/$DATA data
        elif [ -d /mnt/$SRC/data ]; then
+               mount -o remount,rw /mnt
                mount --bind /mnt/$SRC/data data
        else
                mount -t tmpfs tmpfs data
@@ -32,6 +33,7 @@ mount_sdcard()
                sed -i "s|\(^ *block_device *\)\(/dev/.*\)|\1/dev/block/$SDCARD|g" mountd.conf
        else
                if [ -d /mnt/$SRC/sdcard ]; then
+                       mount -o remount,rw /mnt
                        mount --bind /mnt/$SRC/sdcard sdcard
                else
                        mount -t tmpfs tmpfs sdcard