List Info

Thread: CentOS-4.4 yumconf




CentOS-4.4 yumconf
user name
2006-09-12 14:13:08
Some days ago, there was the discussion about the new
centos-release
package with merged in yum (and other) configuration files
instead of
separate yumconf as until 4.3.

I today tried using %trigger sections in the own package.
After some
testing I can say it looks good and seem to work fine (at
least here).

The trigger basically just moves the repo files known to be
installed by
centos-yumconf (and only those, so it has still to be
adapted if CentOS
e.g. adds more .repo files) to a different filename not used
by yum.

On removal of the own yumconf package, that backed up files
are moved
back to it's original name.

The whole thing even seem to work over
updates/removals/installs of both.

Maybe that's also useful for others having that problem,
but of course
needs some adaption.

Kind regards

Roland
# Yum Repository File for Updating/Installing from internal
Install Server
# 
# For CentOS 3.x and 4.x
#
# $Id:  $
#
# 2006-09-12, Roland Alder
#
# Import GPG key before:
# rpm --import http://SOURCEHOST/linux/centos/mirror/4/RPM-GPG-KEY-
CentOS-4
#
# This file is by intention not marked as config file in
RPM, as we might wan't to overwrite it

# VENDOR (CentOS) base/os
[vendor-os]
name=CentOS-$releasever - Base/OS
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/os/$basearch/
gpgcheck=1
enabled=1

# VENDOR (CentOS) released updates 
[vendor-update]
name=CentOS-$releasever - Updates
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/updates/$basearch/
gpgcheck=1
enabled=1

# VENDOR (CentOS) packages used/produced in the build but
not released
[vendor-addons]
name=CentOS-$releasever - Addons
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/addons/$basearch/
gpgcheck=1
enabled=0

# VENDOR (CentOS) additional packages that may be useful
[vendor-extras]
name=CentOS-$releasever - Extras
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/extras/$basearch/
gpgcheck=1
enabled=0

# VENDOR (CentOS) additional packages that extend
functionality of existing packages
[vendor-centosplus]
name=CentOS-$releasever - Plus
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/centosplus/$basearch
/
gpgcheck=1
enabled=0

# VENDOR (CentOS) contrib - packages by Centos Users
[vendor-contrib]
name=CentOS-$releasever - Contrib
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0

# VENDOR (CentOS) packages in testing
[vendor-testing]
name=CentOS-$releasever - Testing
baseurl=http://SOURCEH
OST/linux/centos/mirror/$releasever/testing/$basearch/
gpgcheck=1
enabled=0
# $Id: $
#
# 2006-09-12, Roland Alder

%define sourcehost install.int.galaxy.ch
# ExclusiveOS: centos3 centos4

Summary: Package that provides yum configuration file for
use with internal Install Server
Name: yumconf-int.galaxy.ch
Version: 1
Release: 2
Copyright: freeware
Group: System/Configuration
Provides: yumconf
BuildRequires: perl
BuildRoot: %/%-root
Conflicts: centos-yumconf
Source0: centos-galaxy-int.template
BuildArch: noarch

%description
This package provides a yum repository configuration file
for use inside
my network.

Import GPG Key before using:
  rpm --import http://%/linux/centos/mirror
/RPM-GPG-KEY-CentOS-4

%prep
%setup -c -T
# prepare the standard yumconf for normal use
perl -pe 's/SOURCEHOST/%/g;' < %SOURCE0
> yumconf-int.galaxy.ch.repo

%build

%install

rm -rf $
install -d $RPM_BUILD_ROOT/etc/yum.repos.d
install -m 644 yumconf-int.galaxy.ch.repo
$RPM_BUILD_ROOT/etc/yum.repos.d/

%triggerin -- centos-release
# When centos-release (or our/this package) get's installed
# Make a backup copy of the original repository file(s) and
replace them with a placeholder

for repofile in /etc/yum.repos.d/CentOS-{Base,Media}.repo \
                /etc/apt/sources.list.d/centos.list \
		/etc/sysconfig/rhn/sources
do
  if [ -f "$repofile" ]; then
    # Copy the repo file to something that is not used by
yum and Co.
    mv -f $ $.%-disabled || exit 1
  fi
done

%triggerun -- centos-release
# When centos-release get uninstalled (also during upgrade
of it)
# Restore our backup file, but only if we've got completly
removed

[ "$1" -ne 0 ] && exit 0
for repofile in /etc/yum.repos.d/CentOS-{Base,Media}.repo \
                /etc/apt/sources.list.d/centos.list \
		/etc/sysconfig/rhn/sources
do
  if [ -f "$repofile.%-disabled" ]; then
    mv -f $.%-disabled $ || exit 1
  fi
done

%clean
rm -rf $

%files
%defattr(-,root,root)
#%config not marked as config by intention (want to be able
to replace using rpm)
/etc/yum.repos.d/yumconf-int.galaxy.ch.repo

%changelog
* Wed Sep 12 2006 Roland Alder <roligalaxy.ch> - 1-2
- Added RPM triggers to get rid or restore repository files
installed by
  centos-release released with CentOS 4.4

* Thu Apr 05 2005 Roland Alder <roligalaxy.ch> - 1-1
- Initial "build"
_______________________________________________
CentOS-devel mailing list
CentOS-develcentos.org
http://lists.centos.org/mailman/listinfo/centos-devel
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )