commit:     d5ed2a39f1ba4c9c67e0ec79ec18986d37a198c1
Author:     kewl fft <kewl <AT> alto <DOT> eu <DOT> org>
AuthorDate: Wed Oct  3 18:37:44 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct  6 01:24:19 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d5ed2a39

etc-update: combined use of /etc/os-release ID and ID_LIKE

Closes: https://github.com/gentoo/portage/pull/372
Signed-off-by: Kewl Fft xrjy <AT> nygb.rh.bet (rot13)
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/etc-update | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/etc-update b/bin/etc-update
index f0aaca1e6..3951ec674 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -32,13 +32,13 @@ get_config() {
                "${PORTAGE_CONFIGROOT}"etc/etc-update.conf)
 }
 
-OS_RELEASE_ID=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | cut -d'=' -f2 
| sed -e 's/"//g')
+OS_RELEASE_POSSIBLE_IDS=$(source /etc/os-release >/dev/null 2>&1; echo 
":${ID}:${ID_LIKE}:")
 
-case $OS_RELEASE_ID in
-       suse|opensuse|opensuse-leap|opensuse-tumbleweed) OS_FAMILY='rpm' ;;
-       fedora|rhel) OS_FAMILY='rpm' ;;
-       arch|archarm|arch32|manjaro|antergos) OS_FAMILY='arch' 
NEW_EXT='pacnew';;
-       *) OS_FAMILY='gentoo' ;;
+case ${OS_RELEASE_POSSIBLE_IDS} in
+       *:suse:*|*:opensuse:*|*:opensuse-tumbleweed:*) OS_FAMILY='rpm';;
+       *:fedora:*|*:rhel:*) OS_FAMILY='rpm';;
+       *:arch:*|*:manjaro:*|*:antergos:*) OS_FAMILY='arch' NEW_EXT='pacnew';;
+       *) OS_FAMILY='gentoo';;
 esac
 
 if [[ $OS_FAMILY == 'gentoo' ]]; then

Reply via email to