Init wrapper : fixed some issues 42/115042/7 accepted/tizen/common/20170220.144418 accepted/tizen/ivi/20170220.223155 accepted/tizen/mobile/20170220.223105 accepted/tizen/tv/20170220.223124 accepted/tizen/wearable/20170220.223141 submit/tizen/20170220.092042
authorSilas Jeon <silas.jeon@samsung.com>
Thu, 16 Feb 2017 06:35:11 +0000 (15:35 +0900)
committerSilas Jeon <silas.jeon@samsung.com>
Mon, 20 Feb 2017 08:23:17 +0000 (17:23 +0900)
Made rootfs as RW after fsck, to make fsck work properly.
Added fsck command for system-data partition before mounting.
Fixed DATAFS to $DATAFS. It was misspelled.
Added some comments.

Change-Id: Id5efd195230815b8826fa81f59dff58a4d3c7d23

scripts/init.wrapper

index 1ee8917..56aef97 100644 (file)
@@ -9,35 +9,31 @@ mount -o nosuid,strictatime,mode=755 -t devtmpfs devtmpfs /dev
 mount -o nosuid,noexec,nodev -t sysfs sysfs /sys
 mount -o nosuid,noexec,nodev -t proc proc /proc
 
+#Find devices with label or partlabel
 ROOTFS=`/sbin/blkid -L rootfs`
 if [ x$ROOTFS = "x" ]
 then
-ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs -o device`
+    ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs -o device`
 fi
 
 DATAFS=`/sbin/blkid -L system-data`
 if [ x$DATAFS = "x" ]
 then
-DATAFS=`/sbin/blkid -t PARTLABEL=system-data -o device`
+    DATAFS=`/sbin/blkid -t PARTLABEL=system-data -o device`
 fi
 
-if [ "$ROOTFS" == "" ]
+#Fsck, resize, mount devices
+if [ x$ROOTFS = "x" ]
 then
     echo "Warning : There is no rootfs partition."
 else
-    /usr/bin/mount | grep "$ROOTFS " > /dev/null
-
-    if [ $? = "0" ]
-    then
-        /usr/bin/mount -o remount,rw $ROOTFS
-    fi
-
-    /sbin/fsck $ROOTFS
+    /sbin/fsck -y $ROOTFS
+    /usr/bin/mount -o remount,rw $ROOTFS
     /sbin/resize2fs -f $ROOTFS
+    /usr/bin/mount -o remount,ro $ROOTFS
 fi
 
-
-if [ "$DATAFS" == "" ]
+if [ x$DATAFS = "x" ]
 then
     echo "Warning : There is no system-data partition."
 else
@@ -45,9 +41,10 @@ else
 
     if [ $? = "0" ]
     then
-        /usr/bin/umount -l "DATAFS"
+        /usr/bin/umount -l "$DATAFS"
     fi
-
+    /sbin/fsck -y $DATAFS
+    /sbin/resize2fs -f $DATAFS
     /usr/bin/mount $DATAFS $SYSTEM_MNT
 fi
 
@@ -58,6 +55,6 @@ fi
 
 echo "======================================================================"
 echo "[/sbin/init] WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-echo "This Message should be never printed. ($INIT execution failure?)"
+echo "This Message should never be printed. ($INIT execution failure?)"
 echo "======================================================================"
 exec /bin/sh