Skip to content

Commit

Permalink
nc-format-USB: fix when ZRAM active
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 21, 2018
1 parent d82a635 commit de5d9fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions etc/ncp-config.d/nc-format-USB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ careful, this will destroy any data in the USB drive
configure()
{
# count all disk devices except mmcblk0
local NUM=$(( $( lsblk -l -n | grep -v zram | awk '{ print $6 }' | grep disk | wc -l ) - 1 ))
local NUM=$(( $( lsblk -ln | grep -v zram | awk '{ print $6 }' | grep disk | wc -l ) - 1 ))

# only one plugged in
[[ $NUM != 1 ]] && {
Expand All @@ -40,7 +40,7 @@ configure()
done

# do it
local NAME=( $( lsblk -l -n | grep -v mmcblk | grep disk | awk '{ print $1 }' ) )
local NAME=( $( lsblk -ln | grep -v -e mmcblk -e zram | grep disk | awk '{ print $1 }' ) )
[[ ${#NAME[@]} != 1 ]] && { echo "unexpected error"; return 1; }

wipefs -a -f /dev/"$NAME" || return 1
Expand Down

0 comments on commit de5d9fb

Please sign in to comment.