summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2017-06-01 17:20:01 +0800
committerIru Cai <mytbk920423@gmail.com>2017-06-01 17:49:13 +0800
commit86143b6ce31c76e0a17115df9cba0e79bc01b270 (patch)
treea61f7f2a71da0aa2e6f0c7702ce746f354e651a1
parentc37e64eb77755d9eb4a1f16e0b0e93f3c523485a (diff)
downloadliveusb-builder-86143b6ce31c76e0a17115df9cba0e79bc01b270.tar.xz
work around an lsblk issue in getdiskbypart
-rw-r--r--functions.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/functions.sh b/functions.sh
index cbf25aa..b1c804f 100644
--- a/functions.sh
+++ b/functions.sh
@@ -92,7 +92,18 @@ getuuid() {
}
getdiskbypart() {
- lsblk -s --raw -o NAME -n "$1" | tail -n1
+ # util-linux may have bug when using -s --raw
+ # so it needs some work around
+ local _devlist
+ local _type
+ _devlist=($(lsblk -s --raw -o NAME -n "$1"))
+ for i in "${_devlist[@]}"
+ do
+ _type=$(lsblk -o TYPE -n "/dev/$i" | head -n1)
+ if [[ "$_type" == "disk" ]]; then
+ echo $i
+ fi
+ done
}
as-root() {