echo " disable - disable dm-verity. reboot is needed"
}
+get_rootfs() {
+ # get partition ab
+ P_SLOT=$([[ $(</proc/cmdline) =~ partition_ab=([ab]) ]]; echo ${BASH_REMATCH[1]})
+ P_SUFFIX=""
+
+ if [ "${P_SLOT}" != "" ]; then
+ P_SUFFIX="_${P_SLOT}"
+ fi
+
+ ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs${P_SUFFIX} -o device -l`
+ if [ -z "$ROOTFS" ]
+ then
+ ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs -o device -l`
+ fi
+ if [ -z "$ROOTFS" ]
+ then
+ ROOTFS=`/sbin/blkid -t LABEL=contain-rootfs -o device -l`
+ fi
+
+ echo "$ROOTFS"
+}
+
format()
{
IMG_FILE=$1
exit 0
fi
- ROOTFS=`/sbin/blkid -L rootfs`
- if [ -z "$ROOTFS" ]
- then
- ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs -o device`
- fi
- if [ -z "$ROOTFS" ]
- then
- ROOTFS=`/sbin/blkid -t LABEL=contain-rootfs -o device`
- fi
+ ROOTFS=$(get_rootfs)
block_count=`/sbin/tune2fs -l $ROOTFS | grep "Block count" | gawk '{print $3}'`
block_size=`/sbin/tune2fs -l $ROOTFS | grep "Block size" | gawk '{print $3}'`
exit 0
fi
- ROOTFS=`/sbin/blkid -L rootfs`
- if [ -z "$ROOTFS" ]
- then
- ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs -o device`
- fi
- if [ -z "$ROOTFS" ]
- then
- ROOTFS=`/sbin/blkid -t LABEL=contain-rootfs -o device`
- fi
+ ROOTFS=$(get_rootfs)
block_count=`/sbin/tune2fs -l $ROOTFS | grep "Block count" | gawk '{print $3}'`
block_size=`/sbin/tune2fs -l $ROOTFS | grep "Block size" | gawk '{print $3}'`