Skip to content

Commit 0b12b95

Browse files
committed
apply driver update only to the product it is intended for
1 parent 92b663e commit 0b12b95

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

live/live-root/usr/lib/dracut/modules.d/99agama-dud/agama-dud-apply.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,26 @@ apply_updates() {
7878
rm "$NEWROOT"/etc/resolv.conf
7979
}
8080

81+
# Read ID + VERSION_ID from /etc/os-release and set dist = "$ID$VERSION_ID".
82+
#
83+
# For rolling relases as in Tumbleweed or Slowroll, ignore VERSION_ID as it
84+
# changes too often.
85+
get_dist() {
86+
dist=
87+
if [ -f "/etc/os-release" ] ; then
88+
. "/etc/os-release"
89+
if [ -n "$ID" -a -n "$VERSION_ID" ] ; then
90+
# Tumbleweed and Slowroll use a date (e.g. "20261231") as version_id.
91+
# In this case, do not include it.
92+
if [[ "$VERSION_ID" =~ ^[0-9]{8}$ ]] ; then
93+
dist="$ID"
94+
else
95+
dist="$ID$VERSION_ID"
96+
fi
97+
fi
98+
fi
99+
}
100+
81101
# Applies an update from an RPM package
82102
#
83103
# It extracts the RPM content and adjust the alternative links.
@@ -110,17 +130,19 @@ apply_dud_update() {
110130

111131
echo "Apply update from a Driver Update Disk archive"
112132

113-
# FIXME: do not ignore the dist (e.g., "tw" in "x86_64-tw").
114-
115133
# notes:
116134
# (1) there can be several updates in a single archive; each with a
117135
# prefix directory consisting of a number
118136
# (2) there can be ARCH-DIST subdirs with multiple dists - pick one and
119137
# ignore the others
138+
139+
get_dist
140+
# fallback: no dist info -> match any
141+
[ -z "$dist" ] && dist='*'
120142
arch=$(uname -m)
121143
for base_dir in "${dir}"/linux/suse "${dir}"/[0-9]*/linux/suse; do
122144
[ -d "$base_dir" ] || continue
123-
for dud_root in "${base_dir}/${arch}"-*; do
145+
for dud_root in "${base_dir}/${arch}"-$dist; do
124146
[ -d "$dud_root" ] || continue
125147
install_update "${dud_root}/inst-sys"
126148
copy_packages "$dud_root" "$DUD_RPM_REPOSITORY"

0 commit comments

Comments
 (0)