Skip to content

Commit

Permalink
Fixed blockdev issue when reading empty DVD tray + added 'lsblk'
Browse files Browse the repository at this point in the history
  • Loading branch information
rmetrich committed Aug 6, 2018
1 parent 8255680 commit b4fd97f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions usr/share/rear/conf/GNU/Linux.conf
Expand Up @@ -185,6 +185,7 @@ w
dosfslabel
sysctl
blockdev
lsblk
)

# the lib* serves to cover both 32bit and 64bit libraries!
Expand Down
9 changes: 3 additions & 6 deletions usr/share/rear/lib/layout-functions.sh
Expand Up @@ -556,9 +556,8 @@ get_disk_size() {
local disk_name=$1

if has_binary blockdev; then
blockdev --getsize64 /dev/${disk_name##*/} # sda/sda1 -> sda1 ; sda -> sda
StopIfError "Reading the size of disk ${disk_name##*/} failed"
return
# ${disk_name##*/} translates 'sda/sda1' into 'sda1' and 'sda' into 'sda'
blockdev --getsize64 /dev/${disk_name##*/} && return
fi

# Linux always considers sectors to be 512 bytes long. See the note in the
Expand All @@ -580,9 +579,7 @@ get_block_size() {
local disk_name="${1##*/}" # /some/path/sda -> sda

if has_binary blockdev; then
blockdev --getss /dev/$disk_name
StopIfError "Reading the block size of disk ${disk_name} failed"
return
blockdev --getss /dev/$disk_name && return
fi

# Only newer kernels have an interface to get the block size
Expand Down

0 comments on commit b4fd97f

Please sign in to comment.