From 3e470e226670067ef61091c04d8cde9a6fbdf0d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Thu, 10 Aug 2023 21:41:28 +0200 Subject: [PATCH] scripts: Do not complain about using loopback devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Iaf2b561e8ad9f269ba75fbb1f9a5ab6e35f0f081 Signed-off-by: Łukasz Stelmach --- scripts/tizen/sd_fusing_rpi3.sh | 5 +++-- scripts/tizen/sd_fusing_rpi4.sh | 5 +++-- scripts/tizen/sd_fusing_vf2.sh | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index 10fb3e756a..a701d0c045 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -406,9 +406,10 @@ function check_device () { DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk "/^disk/ { print \\\$2 }"` local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l` - if [ "$REMOVABLE" == "0" ]; then + local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l` + if [ "$REMOVABLE" == "0" -a "$LOOPBACK" = "0" ]; then echo "" - echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/] " + echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/] " tput sgr 0 read input if [ "$input" != "y" ] && [ "$input" != "Y" ]; then diff --git a/scripts/tizen/sd_fusing_rpi4.sh b/scripts/tizen/sd_fusing_rpi4.sh index 05bd3a5bf7..400df71e5d 100755 --- a/scripts/tizen/sd_fusing_rpi4.sh +++ b/scripts/tizen/sd_fusing_rpi4.sh @@ -513,9 +513,10 @@ function check_device () { DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk '/^(disk|loop)/ { print $2 }'` local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l` - if [ "$REMOVABLE" == "0" ]; then + local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l` + if [ "$REMOVABLE" == "0" -a "$LOOPBACK" = "0" ]; then echo "" - echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/] " + echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/] " tput sgr 0 read input if [ "$input" != "y" ] && [ "$input" != "Y" ]; then diff --git a/scripts/tizen/sd_fusing_vf2.sh b/scripts/tizen/sd_fusing_vf2.sh index ccf82e9174..d8c9e06757 100755 --- a/scripts/tizen/sd_fusing_vf2.sh +++ b/scripts/tizen/sd_fusing_vf2.sh @@ -363,9 +363,10 @@ function check_device () { DEVICE=/dev/`lsblk $DEVICE -o TYPE,KNAME | awk '/^(disk|loop)/ { print $2 }'` local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l` - if [ "$REMOVABLE" == "0" ]; then + local LOOPBACK=`lsblk $DEVICE -nd -o TYPE | grep loop | wc -l` + if [ "$REMOVABLE" == "0" -a "$LOOPBACK" == "0" ]; then echo "" - echo -n "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/] " + echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/] " tput sgr 0 read input if [ "$input" != "y" ] && [ "$input" != "Y" ]; then -- 2.34.1