summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-15 02:12:40 +0000
committerMike Frysinger <vapier@gentoo.org>2010-02-15 02:12:40 +0000
commiteaf37e9729e70df69f5bede71a5d83024cfb187f (patch)
tree3268ec02b92fe926adca6c3930cece2bf1c57015 /sys-apps/module-init-tools
parenteshopts_{push,pop}: add support for the extended options available only via `... (diff)
downloadgentoo-2-eaf37e9729e70df69f5bede71a5d83024cfb187f.tar.gz
gentoo-2-eaf37e9729e70df69f5bede71a5d83024cfb187f.tar.bz2
gentoo-2-eaf37e9729e70df69f5bede71a5d83024cfb187f.zip
Handle upgrades of .conf files for people #274942 by Peter Volkov.
(Portage version: 2.2_rc62/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/module-init-tools')
-rw-r--r--sys-apps/module-init-tools/ChangeLog6
-rw-r--r--sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild34
2 files changed, 38 insertions, 2 deletions
diff --git a/sys-apps/module-init-tools/ChangeLog b/sys-apps/module-init-tools/ChangeLog
index e1ab9487dd5e..bf110357d9e8 100644
--- a/sys-apps/module-init-tools/ChangeLog
+++ b/sys-apps/module-init-tools/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-apps/module-init-tools
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/ChangeLog,v 1.156 2010/01/08 02:36:41 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/ChangeLog,v 1.157 2010/02/15 02:12:40 vapier Exp $
+
+ 15 Feb 2010; Mike Frysinger <vapier@gentoo.org>
+ module-init-tools-3.11.1.ebuild:
+ Handle upgrades of .conf files for people #274942 by Peter Volkov.
08 Jan 2010; Mike Frysinger <vapier@gentoo.org>
module-init-tools-3.11.1.ebuild:
diff --git a/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild b/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild
index 44da73d1bbdc..7bfc958a4de1 100644
--- a/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild
+++ b/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild,v 1.2 2010/01/08 02:36:41 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/module-init-tools-3.11.1.ebuild,v 1.3 2010/02/15 02:12:40 vapier Exp $
inherit eutils flag-o-matic
@@ -55,4 +55,36 @@ pkg_postinst() {
if grep -qs modules-update "${ROOT}"/etc/init.d/modules ; then
sed -i 's:modules-update:update-modules:' "${ROOT}"/etc/init.d/modules
fi
+
+ # For files that were upgraded but not renamed via their ebuild to
+ # have a proper .conf extension, rename them so etc-update tools can
+ # take care of things. #274942
+ local i f cfg
+ eshopts_push -s nullglob
+ for f in "${ROOT}"etc/modprobe.d/* ; do
+ # The .conf files need no upgrading unless a non-.conf exists,
+ # so skip this until later ...
+ [[ ${f} == *.conf ]] && continue
+ # If a .conf doesn't exist, then a package needs updating, or
+ # the user created it, or it's orphaned. Either way, we don't
+ # really know, so leave it alone.
+ [[ ! -f ${f}.conf ]] && continue
+
+ i=0
+ while :; do
+ cfg=$(printf "%s/._cfg%04d_%s.conf" "${f%/*}" ${i} "${f##*/}")
+ [[ ! -e ${cfg} ]] && break
+ ((i++))
+ done
+ einfo "Updating ${f}; please run 'etc-update'"
+ mv "${f}.conf" "${cfg}"
+ mv "${f}" "${f}.conf"
+ done
+ # Whine about any non-.conf files that are left
+ for f in "${ROOT}"etc/modprobe.d/* ; do
+ [[ ${f} == *.conf ]] && continue
+ ewarn "The '${f}' file needs to be upgraded to end with a '.conf'."
+ ewarn "Either upgrade the package that owns it, or manually rename it."
+ done
+ eshopts_pop
}