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 10fb3e756aa2b24f8886d14db5a7566981073518..a701d0c045c80ebf4fa18d14bf8215299248dde5 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 05bd3a5bf7afaee8e1ec293028b0d6bd891ec29e..400df71e5d92b6f9288e1f7a4b7e6066f55156e0 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 ccf82e91746481abd5a99e5e5470365919ced9e7..d8c9e06757532748acb9c9689cf789e5fe9d7682 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