From 04f389b40fee5e6fcb578c16119bc1d51fc00973 Mon Sep 17 00:00:00 2001 From: Silas Jeon Date: Thu, 16 Feb 2017 15:35:11 +0900 Subject: Init wrapper : fixed some issues 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 | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/scripts/init.wrapper b/scripts/init.wrapper index 1ee8917..56aef97 100644 --- a/scripts/init.wrapper +++ b/scripts/init.wrapper @@ -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 -- cgit v1.2.3