mirror of
https://git.proxmox.com/git/grub2
synced 2025-10-25 17:51:06 +00:00
Handle the case where udevadm exists but is non-functional, as warned about by Lintian 2.5.75.
This commit is contained in:
parent
5031c00bb2
commit
4c7029c3d5
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -11,6 +11,8 @@ grub2 (2.02+dfsg1-1) UNRELEASED; urgency=medium
|
|||||||
versions of libgcrypt (closes: #745409).
|
versions of libgcrypt (closes: #745409).
|
||||||
* Cherry-pick upstream patch to avoid -Werror=unused-value build failure
|
* Cherry-pick upstream patch to avoid -Werror=unused-value build failure
|
||||||
(closes: #890431).
|
(closes: #890431).
|
||||||
|
* Handle the case where udevadm exists but is non-functional, as warned
|
||||||
|
about by Lintian 2.5.75.
|
||||||
|
|
||||||
-- Colin Watson <cjwatson@debian.org> Sun, 11 Feb 2018 23:23:09 +0000
|
-- Colin Watson <cjwatson@debian.org> Sun, 11 Feb 2018 23:23:09 +0000
|
||||||
|
|
||||||
|
|||||||
43
debian/postinst.in
vendored
43
debian/postinst.in
vendored
@ -184,33 +184,36 @@ camcontrol_size()
|
|||||||
echo "$size"
|
echo "$size"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maybe_udevadm()
|
||||||
|
{
|
||||||
|
if which udevadm >/dev/null 2>&1; then
|
||||||
|
udevadm "$@" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Returns value in $RET, like a debconf command.
|
# Returns value in $RET, like a debconf command.
|
||||||
describe_disk()
|
describe_disk()
|
||||||
{
|
{
|
||||||
local disk id base size
|
local disk id sysfs_path disk_basename size model
|
||||||
disk="$1"
|
disk="$1"
|
||||||
id="$2"
|
id="$2"
|
||||||
|
|
||||||
model=
|
model=
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
if which udevadm >/dev/null 2>&1; then
|
sysfs_path="$(maybe_udevadm info -n "$disk" -q path)"
|
||||||
size="$(sysfs_size "/sys$(udevadm info -n "$disk" -q path)")"
|
if [ -z "$sysfs_path" ]; then
|
||||||
else
|
sysfs_path="/block/$(printf %s "${disk#/dev/}" | sed 's,/,!,g')"
|
||||||
base="${disk#/dev/}"
|
|
||||||
base="$(printf %s "$base" | sed 's,/,!,g')"
|
|
||||||
size="$(sysfs_size "/sys/block/$base")"
|
|
||||||
fi
|
fi
|
||||||
|
size="$(sysfs_size "/sys$sysfs_path")"
|
||||||
|
|
||||||
if which udevadm >/dev/null 2>&1; then
|
model="$(maybe_udevadm info -n "$disk" -q property | sed -n 's/^ID_MODEL=//p')"
|
||||||
model="$(udevadm info -n "$disk" -q property | sed -n 's/^ID_MODEL=//p')"
|
if [ -z "$model" ]; then
|
||||||
|
model="$(maybe_udevadm info -n "$disk" -q property | sed -n 's/^DM_NAME=//p')"
|
||||||
if [ -z "$model" ]; then
|
if [ -z "$model" ]; then
|
||||||
model="$(udevadm info -n "$disk" -q property | sed -n 's/^DM_NAME=//p')"
|
model="$(maybe_udevadm info -n "$disk" -q property | sed -n 's/^MD_NAME=//p')"
|
||||||
if [ -z "$model" ]; then
|
if [ -z "$model" ] && which dmsetup >/dev/null 2>&1; then
|
||||||
model="$(udevadm info -n "$disk" -q property | sed -n 's/^MD_NAME=//p')"
|
model="$(dmsetup info -c --noheadings -o name "$disk" 2>/dev/null || true)"
|
||||||
if [ -z "$model" ] && which dmsetup >/dev/null 2>&1; then
|
|
||||||
model="$(dmsetup info -c --noheadings -o name "$disk" 2>/dev/null || true)"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -233,21 +236,21 @@ describe_disk()
|
|||||||
# Returns value in $RET, like a debconf command.
|
# Returns value in $RET, like a debconf command.
|
||||||
describe_partition()
|
describe_partition()
|
||||||
{
|
{
|
||||||
local disk part id path diskbase partbase size
|
local disk part id path sysfs_path diskbase partbase size
|
||||||
disk="$1"
|
disk="$1"
|
||||||
part="$2"
|
part="$2"
|
||||||
id="$3"
|
id="$3"
|
||||||
path="$4"
|
path="$4"
|
||||||
|
|
||||||
if which udevadm >/dev/null 2>&1; then
|
sysfs_path="$(maybe_udevadm info -n "$part" -q path)"
|
||||||
size="$(sysfs_size "/sys$(udevadm info -n "$part" -q path)")"
|
if [ -z "$sysfs_path" ]; then
|
||||||
else
|
|
||||||
diskbase="${disk#/dev/}"
|
diskbase="${disk#/dev/}"
|
||||||
diskbase="$(printf %s "$diskbase" | sed 's,/,!,g')"
|
diskbase="$(printf %s "$diskbase" | sed 's,/,!,g')"
|
||||||
partbase="${part#/dev/}"
|
partbase="${part#/dev/}"
|
||||||
partbase="$(printf %s "$partbase" | sed 's,/,!,g')"
|
partbase="$(printf %s "$partbase" | sed 's,/,!,g')"
|
||||||
size="$(sysfs_size "/sys/block/$diskbase/$partbase")"
|
sysfs_path="/block/$diskbase/$partbase"
|
||||||
fi
|
fi
|
||||||
|
size="$(sysfs_size "/sys$sysfs_path")"
|
||||||
|
|
||||||
db_subst grub-pc/partition_description DEVICE "$part"
|
db_subst grub-pc/partition_description DEVICE "$part"
|
||||||
db_subst grub-pc/partition_description SIZE "$size"
|
db_subst grub-pc/partition_description SIZE "$size"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user