# $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: %{_tmppath}/%{name}-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://%{sourcehost}/linux/centos/mirror/RPM-GPG-KEY-CentOS-4 %prep %setup -c -T # prepare the standard yumconf for normal use perl -pe 's/SOURCEHOST/%{sourcehost}/g;' < %SOURCE0 > yumconf-int.galaxy.ch.repo %build %install rm -rf ${RPM_BUILD_ROOT} 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 ${repofile} ${repofile}.%{name}-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.%{name}-disabled" ]; then mv -f ${repofile}.%{name}-disabled ${repofile} || exit 1 fi done %clean rm -rf ${RPM_BUILD_ROOT} %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 - 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 - 1-1 - Initial "build"