Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Thu, 26 Apr 2018 17:57:33
Message-Id: 1524765365.e3155774215a3520a415f926ce4495cfb0349241.zmedico@gentoo
1 commit: e3155774215a3520a415f926ce4495cfb0349241
2 Author: Tomáš Chvátal <tomas.chvatal <AT> gmail <DOT> com>
3 AuthorDate: Thu Apr 26 17:53:46 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 26 17:56:05 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e3155774
7
8 etc-update: support fedora and rhel with rpm OS_FAMILY
9
10 bin/etc-update | 21 ++++++++++++++++++---
11 1 file changed, 18 insertions(+), 3 deletions(-)
12
13 diff --git a/bin/etc-update b/bin/etc-update
14 index db62f6972..8b3604a4c 100755
15 --- a/bin/etc-update
16 +++ b/bin/etc-update
17 @@ -35,7 +35,8 @@ get_config() {
18 OS_RELEASE_ID=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | cut -d'=' -f2 | sed -e 's/"//g')
19
20 case $OS_RELEASE_ID in
21 - suse|opensuse|opensuse-leap|opensuse-tumbleweed) OS_FAMILY='suse' NEW_EXT='rpmnew';;
22 + suse|opensuse|opensuse-leap|opensuse-tumbleweed) OS_FAMILY='rpm' ;;
23 + fedora|rhel) OS_FAMILY='rpm' ;;
24 arch|manjaro|antergos) OS_FAMILY='arch' NEW_EXT='pacnew';;
25 *) OS_FAMILY='gentoo' ;;
26 esac
27 @@ -53,7 +54,7 @@ if [[ $OS_FAMILY == 'gentoo' ]]; then
28 get_live_file() {
29 echo "${rpath}/${rfile:10}"
30 }
31 -elif [[ $OS_FAMILY == 'suse' ]] || [[ $OS_FAMILY == 'arch' ]]; then
32 +elif [[ $OS_FAMILY == 'arch' ]]; then
33 get_basename() {
34 printf -- '%s\n' "${1%.${NEW_EXT}}"
35 }
36 @@ -66,6 +67,20 @@ elif [[ $OS_FAMILY == 'suse' ]] || [[ $OS_FAMILY == 'arch' ]]; then
37 get_live_file() {
38 printf -- '%s\n' "${cfg_file%.${NEW_EXT}}"
39 }
40 +# In rpm we have rpmsave, rpmorig, and rpmnew.
41 +elif [[ $OS_FAMILY == 'rpm' ]]; then
42 + get_basename() {
43 + printf -- '%s\n' "${1}" |sed -e 's/\.rpmsave$//' -e 's/\.rpmnew$//' -e 's/\.rpmorig$//'
44 + }
45 + get_basename_find_opt() {
46 + printf -- '%s\n' "${1}.rpm????"
47 + }
48 + get_scan_regexp() {
49 + echo "s:\(^.*/\)\(.*\)\(\.\(rpmnew|rpmsave|rpmorig\)\):\1\2\3$b\1$b\3$b\2:"
50 + }
51 + get_live_file() {
52 + printf -- '%s\n' "${cfg_file}" |sed -e 's/\.rpmsave$//' -e 's/\.rpmnew$//' -e 's/\.rpmorig$//'
53 + }
54 fi
55
56 cmd_var_is_valid() {
57 @@ -754,7 +769,7 @@ while [[ -n $1 ]] ; do
58 done
59 ${SET_X} && set -x
60
61 -if [[ $OS_FAMILY == 'suse' ]]; then
62 +if [[ $OS_FAMILY == 'rpm' ]]; then
63 PORTAGE_CONFIGROOT='/'
64 PORTAGE_TMPDIR='/tmp'
65 CONFIG_PROTECT='/etc /usr/share'