From e2ae36d1a45ae80b671e004597383e77a6b0df42 Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Thu, 6 Apr 2017 10:58:13 +0900 Subject: [PATCH] Make caching file for imporoving performance. Previously, init.sh resize and check the filesystem every time. It makes growing in booting time. To reduce this, init.sh makes chache file for checking first boot or not. Only when boot the first time, init.sh will resize and check the filesystem. Change-Id: I31dbe37e59029365098b45cdfcb0dba95a11d8c0 Signed-off-by: Yunmi Ha --- scripts/init.sh | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/scripts/init.sh b/scripts/init.sh index 56c51e5..e23f161 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -5,6 +5,7 @@ mount -o nosuid,noexec,nodev -t sysfs sysfs /sys mount -o nosuid,noexec,nodev -t proc proc /proc /bin/mkdir /sysroot +/bin/mkdir /opt #Find devices ROOTFS=`/sbin/blkid -L rootfs` @@ -26,10 +27,27 @@ then fi #Check and mount devices +FIRSTBOOT=1 +if [ x"$DATAFS" != "x" ] +then + /bin/mount $DATAFS /opt + + if [ -e /opt/var/.fsck_done ] + then + FIRSTBOOT=0 + else + echo " " > /opt/var/.fsck_done + /bin/umount /opt + fi +fi + if [ x$ROOTFS != "x" ] then - /sbin/fsck -y $ROOTFS - /sbin/resize2fs -f $ROOTFS + if [ "$FIRSTBOOT" = "1" ] + then + /sbin/resize2fs -f $ROOTFS + /sbin/fsck -y $ROOTFS + fi /bin/mount $ROOTFS /sysroot else echo "WARNING : THERE IS NO ROOTFS." @@ -38,16 +56,24 @@ fi if [ x$MODULES != "x" ] then - /sbin/fsck -y $MODULES - /sbin/resize2fs -f $MODULES + if [ "$FIRSTBOOT" = "1" ] + then + /sbin/resize2fs -f $MODULES + /sbin/fsck -y $MODULES + fi /bin/mount $MODULES /sysroot/usr/lib/modules fi if [ x"$DATAFS" != "x" ] then - /sbin/fsck -y $DATAFS - /sbin/resize2fs -f $DATAFS - /bin/mount $DATAFS /sysroot/opt + if [ "$FIRSTBOOT" = "1" ] + then + /sbin/resize2fs -f $DATAFS + /sbin/fsck -y $DATAFS + /bin/mount $DATAFS /sysroot/opt + else + /bin/mount -M /opt /sysroot/opt + fi fi cd /sysroot -- 2.7.4