Some troubles with grub with buster point release 10.8
Carsten Aulbert
carsten.aulbert at aei.mpg.de
Thu Feb 11 10:17:59 CET 2021
On 11.02.21 09:53, Thomas Lange wrote:
>>>>>> On Thu, 11 Feb 2021 08:23:07 +0100, Carsten Aulbert <carsten.aulbert at aei.mpg.de> said:
>
>
> > I assume udevadm would return any of the valid device links and by-path
> > is always set, thus:
>
> > get_stable_devname() {
> > _DEV="$1"
> This does not work, because the order of links returned by udevadm
> changes with every call.
That's what I wanted to do but I "optimized" the function too much and
it does not work anymore...
Thus, second try (not sure if I use the array correctly, but it seems to
work on my test boxes, bonus point attempt to use BASIC style line
numbers as index numbers to leave room for further possibilities ;-)):
get_stable_devname() {
_DEV="$1"
declare -a _RES
# prefer SCSI over ATA over WWN over path
for i in $(udevadm info -r --query=symlink "$_DEV")
do
if [[ "$i" =~ /by-id/scsi ]]
then
_RES[10]="$i"
elif [[ "$i" =~ /by-id/ata ]]
then
_RES[20]="$i"
elif [[ "$i" =~ /by-id/wwn ]]
then
_RES[30]="$i"
elif [[ "$i" =~ /by-path/ ]]
then
_RES[99]="$i"
fi
done
echo "${_RES[@]::1}"
}
get_stable_devname /dev/sda
C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5178 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20210211/68f8553c/attachment.p7s>
More information about the linux-fai
mailing list