scripts: Do not complain about using loopback devices 99/297799/1
authorŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 10 Aug 2023 19:41:28 +0000 (21:41 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 24 Aug 2023 10:17:04 +0000 (12:17 +0200)
Change-Id: Iaf2b561e8ad9f269ba75fbb1f9a5ab6e35f0f081
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
scripts/tizen/sd_fusing_rpi3.sh
scripts/tizen/sd_fusing_rpi4.sh
scripts/tizen/sd_fusing_vf2.sh

index 10fb3e7..a701d0c 100755 (executable)
@@ -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/<n>] "
+               echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
                tput sgr 0
                read input
                if [ "$input" != "y" ] && [ "$input" != "Y" ]; then
index 05bd3a5..400df71 100755 (executable)
@@ -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/<n>] "
+               echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
                tput sgr 0
                read input
                if [ "$input" != "y" ] && [ "$input" != "Y" ]; then
index ccf82e9..d8c9e06 100755 (executable)
@@ -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/<n>] "
+               echo -n "$(tput setaf 3)$(tput bold)$DEVICE is neither a removable disk nor a loopback, Is it OK? [y/<n>] "
                tput sgr 0
                read input
                if [ "$input" != "y" ] && [ "$input" != "Y" ]; then