diff options
author | Iru Cai <mytbk920423@gmail.com> | 2017-06-01 17:20:01 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2017-06-01 17:49:13 +0800 |
commit | 86143b6ce31c76e0a17115df9cba0e79bc01b270 (patch) | |
tree | a61f7f2a71da0aa2e6f0c7702ce746f354e651a1 | |
parent | c37e64eb77755d9eb4a1f16e0b0e93f3c523485a (diff) | |
download | liveusb-builder-86143b6ce31c76e0a17115df9cba0e79bc01b270.tar.xz |
work around an lsblk issue in getdiskbypart
-rw-r--r-- | functions.sh | 13 |
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() { |