On Fri, Apr 29, 2011 at 12:28:03PM +0100, Ciaran McCreesh wrote:
> On Fri, 29 Apr 2011 07:21:23 -0400
> Rich Freeman <ri...@gentoo.org> wrote:
> > Perhaps a future/in-progress EAPI could define a mechanism where an
> > ebuild can indicate that a particular update or set of circumstances
> > is a system-critical change, and that the package manager should
> > consequently alert the user and ensure that they have confirmed the
> > action.
> 
> pkg_pretend can do that...

indeed. it works quite well too. please have a look at the attached
patch. it forces the user to acknowledge and verify that he has read the
printed message by prepending a variable to the emerge command.

I know it is a bit nasty, but it accomplishes our goal by making sure
the users read the message.

-- 
Alex Alexander | wired
+ Gentoo Linux Developer
++ www.linuxized.com
Index: openrc-0.8.2-r1.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild,v
retrieving revision 1.1
diff -u -B -r1.1 openrc-0.8.2-r1.ebuild
--- openrc-0.8.2-r1.ebuild      28 Apr 2011 19:50:51 -0000      1.1
+++ openrc-0.8.2-r1.ebuild      29 Apr 2011 17:10:34 -0000
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild,v 
1.1 2011/04/28 19:50:51 williamh Exp $
 
-EAPI="1"
+EAPI="4"
 
 inherit eutils flag-o-matic multilib toolchain-funcs
 
@@ -34,6 +34,22 @@
 DEPEND="${RDEPEND}
        virtual/os-headers"
 
+pkg_pretend() {
+       if [[ -z ${REPLACING_VERSIONS} ]] && [[ ${WARNING_OPENRC} != 1 ]]; then
+               eerror
+               eerror "You're upgrading your system to openrc. After emerge is"
+               eerror "complete, you MUST follow the guide located here:"
+               ewarn "  http://www.gentoo.org/doc/en/openrc-migration.xml";
+               eerror "FAILING TO DO SO WILL PROBABLY RESULT IN AN 
*NON-BOOTABLE* SYSTEM."
+               eerror
+               eerror "To verify you read and understood this message, please 
prepend"
+               ewarn "  WARNING_OPENRC=1"
+               eerror "to your emerge command."
+               eerror
+               die "We need user verification to proceed."
+       fi
+}
+
 make_args() {
        unset LIBDIR #266688
 

Attachment: pgp5IDz0nHbW8.pgp
Description: PGP signature

Reply via email to