summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stakenvicius <axs@gentoo.org>2016-07-25 12:15:27 -0400
committerIan Stakenvicius <axs@gentoo.org>2016-07-25 12:21:27 -0400
commit739172f697490fcb8eff44e3d94ff94b867cfaa2 (patch)
tree09ecc047b610c4ad4bea9c3db9e29208a06ea3a7 /sys-fs/eudev
parentsys-fs/dmraid: ensure REPLACING_VERSIONS is handled when it is a list (diff)
downloadgentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.tar.gz
gentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.tar.bz2
gentoo-739172f697490fcb8eff44e3d94ff94b867cfaa2.zip
sys-fs/eudev: ensure REPLACING_VERSIONS is processed as a list
REPLACING_VERSIONS is used in eudev ebuilds during pkg_postinst to determine when udevadm control --reload should be called: - when it is a new installation of udev - when it is a re-emerge of the same version (or a revision-only upgrade) REPLACING_VERSIONS *should* only ever have zero or one values, but it is theoretically possible for it to have more than that if, for instance, a previous upgrade failed to complete during qmerge. If this is the case, and only one of the multiple versions match the version of the ebuild, then we also abort as we don't know which one is the "good" one. Also removed duplicate code that reloads the hwdb (looks like it was a copy-paste from sys-fs/udev) Bug: http://bugs.gentoo.org/589530 Package-Manager: portage-2.2.28
Diffstat (limited to 'sys-fs/eudev')
-rw-r--r--sys-fs/eudev/eudev-1.10-r2.ebuild51
-rw-r--r--sys-fs/eudev/eudev-1.9-r2.ebuild51
-rw-r--r--sys-fs/eudev/eudev-3.1.2.ebuild51
-rw-r--r--sys-fs/eudev/eudev-3.1.5.ebuild51
-rw-r--r--sys-fs/eudev/eudev-3.2.ebuild51
-rw-r--r--sys-fs/eudev/eudev-4.9999.ebuild51
-rw-r--r--sys-fs/eudev/eudev-9999.ebuild51
7 files changed, 182 insertions, 175 deletions
diff --git a/sys-fs/eudev/eudev-1.10-r2.ebuild b/sys-fs/eudev/eudev-1.10-r2.ebuild
index 83d33b82ec99..122087f5a115 100644
--- a/sys-fs/eudev/eudev-1.10-r2.ebuild
+++ b/sys-fs/eudev/eudev-1.10-r2.ebuild
@@ -248,22 +248,41 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
if use rule-generator && use openrc && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -279,22 +298,4 @@ pkg_postinst() {
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-1.9-r2.ebuild b/sys-fs/eudev/eudev-1.9-r2.ebuild
index 23f027b2b29d..1f7705244f2a 100644
--- a/sys-fs/eudev/eudev-1.9-r2.ebuild
+++ b/sys-fs/eudev/eudev-1.9-r2.ebuild
@@ -250,22 +250,41 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
if use rule-generator && use openrc && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -281,22 +300,4 @@ pkg_postinst() {
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-3.1.2.ebuild b/sys-fs/eudev/eudev-3.1.2.ebuild
index e061076b418e..f17bcba6d015 100644
--- a/sys-fs/eudev/eudev-3.1.2.ebuild
+++ b/sys-fs/eudev/eudev-3.1.2.ebuild
@@ -230,44 +230,45 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
elog
elog "For more information on eudev on Gentoo, writing udev rules, and"
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-3.1.5.ebuild b/sys-fs/eudev/eudev-3.1.5.ebuild
index 0cb702536bf0..a36ee54d2e62 100644
--- a/sys-fs/eudev/eudev-3.1.5.ebuild
+++ b/sys-fs/eudev/eudev-3.1.5.ebuild
@@ -190,22 +190,41 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
if use rule-generator && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-3.2.ebuild b/sys-fs/eudev/eudev-3.2.ebuild
index 52c351cd0f20..e70d95411c64 100644
--- a/sys-fs/eudev/eudev-3.2.ebuild
+++ b/sys-fs/eudev/eudev-3.2.ebuild
@@ -190,22 +190,41 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
if use rule-generator && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-4.9999.ebuild b/sys-fs/eudev/eudev-4.9999.ebuild
index 57d3d7624eb2..2d2964029fba 100644
--- a/sys-fs/eudev/eudev-4.9999.ebuild
+++ b/sys-fs/eudev/eudev-4.9999.ebuild
@@ -184,44 +184,45 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
elog
elog "For more information on eudev on Gentoo, writing udev rules, and"
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}
diff --git a/sys-fs/eudev/eudev-9999.ebuild b/sys-fs/eudev/eudev-9999.ebuild
index 52c351cd0f20..e70d95411c64 100644
--- a/sys-fs/eudev/eudev-9999.ebuild
+++ b/sys-fs/eudev/eudev-9999.ebuild
@@ -190,22 +190,41 @@ pkg_postinst() {
ewarn "else losetup may be confused when looking for unused devices."
fi
+ # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
+ # https://bugs.gentoo.org/246847
+ # https://bugs.gentoo.org/514174
+ enewgroup input
+
+ # REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
+ # process it as a list. We only care about the zero case (new install) or the case where
+ # the same version is being re-emerged. If there is a second version, allow it to abort.
+ local rv rvres=doitnew
+ for rv in ${REPLACING_VERSIONS} ; do
+ if [[ ${rvres} == doit* ]]; then
+ if [[ ${rv%-r*} == ${PV} ]]; then
+ rvres=doit
+ else
+ rvres=${rv}
+ fi
+ fi
+ done
+
if use hwdb && has_version 'sys-apps/hwids[udev]'; then
udevadm hwdb --update --root="${ROOT%/}"
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
# reload database after it has be rebuilt, but only if we are not upgrading
# also pass if we are -9999 since who knows what hwdb related changes there might be
- if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \
- [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
+ if [[ ${rvres} == doit* ]] && [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then
udevadm control --reload
fi
fi
-
- ewarn
- ewarn "You need to restart eudev as soon as possible to make the"
- ewarn "upgrade go into effect:"
- ewarn "\t/etc/init.d/udev --nodeps restart"
+ if [[ ${rvres} != doitnew ]]; then
+ ewarn
+ ewarn "You need to restart eudev as soon as possible to make the"
+ ewarn "upgrade go into effect:"
+ ewarn "\t/etc/init.d/udev --nodeps restart"
+ fi
if use rule-generator && \
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
@@ -221,22 +240,4 @@ pkg_postinst() {
elog "fixing known issues visit:"
elog " https://www.gentoo.org/doc/en/udev-guide.xml"
elog
-
- # https://cgit.freedesktop.org/systemd/systemd/commit/rules/50-udev-default.rules?id=3dff3e00e044e2d53c76fa842b9a4759d4a50e69
- # https://bugs.gentoo.org/246847
- # https://bugs.gentoo.org/514174
- enewgroup input
-
- # Update hwdb database in case the format is changed by udev version.
- if has_version 'sys-apps/hwids[udev]'; then
- udevadm hwdb --update --root="${ROOT%/}"
- # Only reload when we are not upgrading to avoid potential race w/ incompatible hwdb.bin and the running udevd
- if [[ -z ${REPLACING_VERSIONS} ]]; then
- # https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
- if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
- return 0
- fi
- udevadm control --reload
- fi
- fi
}