NEED_RESIZEFS=1
USERFS_ENCRYPTED=0
+BLKID_LINES=()
+
+function get_blk_dev_path()
+{
+ PART_REGEX="(^|[ ])$1($|[ ])"
+
+ for LINE in ${BLKID_LINES[@]}; do
+ if [[ $LINE =~ $PART_REGEX ]]; then
+ IFS=':'
+ SPLITTED=($LINE)
+ echo "${SPLITTED[0]}"
+ IFS=$'\n'
+ return
+ fi
+ done
+}
+
function find_partitions()
{
P_SLOT=$([[ $(</proc/cmdline) =~ partition_ab=([ab]) ]]; echo ${BASH_REMATCH[1]})
echo "Using A/B slot: ${P_SLOT}"
fi
- ROOTFS=`/sbin/blkid -t PARTLABEL=rootfs${P_SUFFIX} -o device`
+ IFS_BACKUP=$IFS
+ IFS=$'\n'
+ BLKID_LINES=($(/sbin/blkid))
+
+ ROOTFS=`get_blk_dev_path "PARTLABEL=\"rootfs${P_SUFFIX}\""`
if [ x$ROOTFS = "x" ]
then
- ROOTFS=`/sbin/blkid -L rootfs`
+ ROOTFS=`get_blk_dev_path "LABEL=\"rootfs\""`
fi
if [ x$ROOTFS = "x" ]
then
- ROOTFS=`/sbin/blkid -t LABEL=contain-rootfs -o device`
+ ROOTFS=`get_blk_dev_path "LABEL=\"contain-rootfs\""`
fi
- DATAFS=`/sbin/blkid -t PARTLABEL=system-data -o device`
+ DATAFS=`get_blk_dev_path "PARTLABEL=\"system-data\""`
if [ x$DATAFS = "x" ]
then
- DATAFS=`/sbin/blkid -L system-data`
+ DATAFS=`get_blk_dev_path "LABEL=\"system-data\""`
fi
if [ x$DATAFS = "x" ]
then
- DATAFS=`/sbin/blkid -t LABEL=contain-sysdata -o device`
+ DATAFS=`get_blk_dev_path "LABEL=\"contain-sysdata\""`
fi
- USERFS=`/sbin/blkid -t PARTLABEL=user -o device`
+ USERFS=`get_blk_dev_path "PARTLABEL=\"user\""`
if [ x$USERFS = "x" ]
then
- USERFS=`/sbin/blkid -L user`
+ USERFS=`get_blk_dev_path "LABEL=\"user\""`
fi
if [ x$USERFS = "x" ]
then
- USERFS=`/sbin/blkid -t LABEL=contain-user -o device`
+ USERFS=`get_blk_dev_path "LABEL=\"contain-user\""`
fi
- MODULES=`/sbin/blkid -t PARTLABEL=modules${P_SUFFIX} -o device`
+ MODULES=`get_blk_dev_path "PARTLABEL=\"modules${P_SUFFIX}\""`
if [ x$MODULES = "x" ]
then
- MODULES=`/sbin/blkid -L modules`
+ MODULES=`get_blk_dev_path "LABEL=\"modules\""`
fi
- HALFS=`/sbin/blkid -t PARTLABEL=hal${P_SUFFIX} -o device`
+ HALFS=`get_blk_dev_path "PARTLABEL=\"hal${P_SUFFIX}\""`
if [ x$HALFS = "x" ]
then
- HALFS=`/sbin/blkid -L hal`
+ HALFS=`get_blk_dev_path "LABEL=\"hal\""`
fi
+
+ IFS=$IFS_BACKUP
}
function check_flags()