From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A8A011382C5 for ; Thu, 26 Apr 2018 17:57:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E3993E08DB; Thu, 26 Apr 2018 17:57:32 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C0D28E08DB for ; Thu, 26 Apr 2018 17:57:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AF5CB335C63 for ; Thu, 26 Apr 2018 17:57:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 09CD5281 for ; Thu, 26 Apr 2018 17:57:30 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1524765365.e3155774215a3520a415f926ce4495cfb0349241.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/etc-update X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e3155774215a3520a415f926ce4495cfb0349241 X-VCS-Branch: master Date: Thu, 26 Apr 2018 17:57:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e5dc3cb3-241d-4d41-bbdf-18ea8694ad3e X-Archives-Hash: a8e39cdf3f014ed213e04bc596da90de commit: e3155774215a3520a415f926ce4495cfb0349241 Author: Tomáš Chvátal gmail com> AuthorDate: Thu Apr 26 17:53:46 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Apr 26 17:56:05 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e3155774 etc-update: support fedora and rhel with rpm OS_FAMILY bin/etc-update | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/etc-update b/bin/etc-update index db62f6972..8b3604a4c 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -35,7 +35,8 @@ get_config() { OS_RELEASE_ID=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | cut -d'=' -f2 | sed -e 's/"//g') case $OS_RELEASE_ID in - suse|opensuse|opensuse-leap|opensuse-tumbleweed) OS_FAMILY='suse' NEW_EXT='rpmnew';; + suse|opensuse|opensuse-leap|opensuse-tumbleweed) OS_FAMILY='rpm' ;; + fedora|rhel) OS_FAMILY='rpm' ;; arch|manjaro|antergos) OS_FAMILY='arch' NEW_EXT='pacnew';; *) OS_FAMILY='gentoo' ;; esac @@ -53,7 +54,7 @@ if [[ $OS_FAMILY == 'gentoo' ]]; then get_live_file() { echo "${rpath}/${rfile:10}" } -elif [[ $OS_FAMILY == 'suse' ]] || [[ $OS_FAMILY == 'arch' ]]; then +elif [[ $OS_FAMILY == 'arch' ]]; then get_basename() { printf -- '%s\n' "${1%.${NEW_EXT}}" } @@ -66,6 +67,20 @@ elif [[ $OS_FAMILY == 'suse' ]] || [[ $OS_FAMILY == 'arch' ]]; then get_live_file() { printf -- '%s\n' "${cfg_file%.${NEW_EXT}}" } +# In rpm we have rpmsave, rpmorig, and rpmnew. +elif [[ $OS_FAMILY == 'rpm' ]]; then + get_basename() { + printf -- '%s\n' "${1}" |sed -e 's/\.rpmsave$//' -e 's/\.rpmnew$//' -e 's/\.rpmorig$//' + } + get_basename_find_opt() { + printf -- '%s\n' "${1}.rpm????" + } + get_scan_regexp() { + echo "s:\(^.*/\)\(.*\)\(\.\(rpmnew|rpmsave|rpmorig\)\):\1\2\3$b\1$b\3$b\2:" + } + get_live_file() { + printf -- '%s\n' "${cfg_file}" |sed -e 's/\.rpmsave$//' -e 's/\.rpmnew$//' -e 's/\.rpmorig$//' + } fi cmd_var_is_valid() { @@ -754,7 +769,7 @@ while [[ -n $1 ]] ; do done ${SET_X} && set -x -if [[ $OS_FAMILY == 'suse' ]]; then +if [[ $OS_FAMILY == 'rpm' ]]; then PORTAGE_CONFIGROOT='/' PORTAGE_TMPDIR='/tmp' CONFIG_PROTECT='/etc /usr/share'