Discussion:
Removing via an apt package
Nevyn
2010-11-16 23:51:38 UTC
Permalink
Hi Everyone,

Does anyone know what I would do to remove an application by
distributing a package? I have a meta package (just has a long string
of requires). I need to be able to use that meta package to also
remove something (2nd day of a pilot programme and 1 application is
causing issues).

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Bryan Baldwin
2010-11-17 04:12:43 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Nevyn
Hi Everyone,
Does anyone know what I would do to remove an application by
distributing a package? I have a meta package (just has a long string
of requires). I need to be able to use that meta package to also
remove something (2nd day of a pilot programme and 1 application is
causing issues).
I don't know about apt, but pacman makepkg scripts have a "provides"
field. I think in conjunction with the "conflicts" field you can design
a package that will remove its counterpart before installing itself.
Maybe APT has similar functionality.

Bryan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJM41Y7AAoJEHblvm1J+WqM5NcH/A3ZApNBJ7xsksupvd4db1FE
44jhdhfPQlNMqfpRcnx9dUtNVnfXtVNKanmwthXqDfSfSch/Z8deFHWYgrIvtCMv
Ts+NKbN/R7Lm8iIJuKy7lTUdL41ERXdG4BO1TTBVZ7+XdDtNxqJ/qilwRy1s4GqP
PbyaQrXNDRJ/oKzur6ArH9ob6jQkJBimCl75Du5irYXcFVVtld4yPVKrT0S3XTv0
/g8eWa0fCQ3lJ7FAoIa/Gr6GVhVhwNk/aVX/0H0lJwHow4Rf5tSMNRG56/H26N5H
47dpYmDqJ2aeog/YnrG8HMivEaS9QHYDUtEVIpz2fSKFSeoQAQTULUAtivVTgN4=
=FuGl
-----END PGP SIGNATURE-----

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Daniel Pittman
2010-11-17 04:49:12 UTC
Permalink
Post by Bryan Baldwin
Post by Nevyn
Hi Everyone,
Does anyone know what I would do to remove an application by
distributing a package? I have a meta package (just has a long string
of requires). I need to be able to use that meta package to also
remove something (2nd day of a pilot programme and 1 application is
causing issues).
I don't know about apt, but pacman makepkg scripts have a "provides"
field. I think in conjunction with the "conflicts" field you can design
a package that will remove its counterpart before installing itself.
Maybe APT has similar functionality.
Yeah, it does. Conflicts and, recently, Breaks both give hints to the
resolver about how to do this. What *doesn't* work is to run apt from
postinst, so don't try that. ;)

Generally, though, I would strongly advise that you try and solve the problem
so that your metapackage doesn't need to do that.

Daniel

Conflicts is probably what you want.
--
✣ Daniel Pittman ✉ ***@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Nevyn
2010-11-17 08:59:42 UTC
Permalink
Yeah, it does.  Conflicts and, recently, Breaks both give hints to the
resolver about how to do this.  What *doesn't* work is to run apt from
postinst, so don't try that. ;)
Generally, though, I would strongly advise that you try and solve the problem
so that your metapackage doesn't need to do that.
       Daniel
Conflicts is probably what you want.
Yeah I discovered the problem with running apt-get from postinst. The
idea was that the build had a few repositories that it needed to
activate so I tried to do a "apt-get update" from postinst. Not good.
Don't do it. Ever.

Conflicts is probably good. I need to prove that we have enough
control to do this if need be. As it is, I don't actually have admin
rights on the machines (60 odd for the pilot, 2000 next year). So our
only mechanism for controlling what applications are on there is using
updates.

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Daniel Pittman
2010-11-17 09:26:55 UTC
Permalink
Post by Nevyn
Yeah, it does.  Conflicts and, recently, Breaks both give hints to the
resolver about how to do this.  What *doesn't* work is to run apt from
postinst, so don't try that. ;)
Generally, though, I would strongly advise that you try and solve the
problem so that your metapackage doesn't need to do that.
       Daniel
Conflicts is probably what you want.
Yeah I discovered the problem with running apt-get from postinst. The
idea was that the build had a few repositories that it needed to
activate so I tried to do a "apt-get update" from postinst. Not good.
Don't do it. Ever.
FWIW, while I feel unclean suggesting it, there is a potential work-around for
the whole thing using lockfileprogs (predepend on it) and your postinst:

batch(1) can run a script that uses the lockfileprogs or something similar to
watch for the apt process to finish, then runs the uninstallation separately.

It is ugly as heck, and I wouldn't recommend it compared to (say) using Puppet
to implement the whole thing[1], but it might do what you need.
Post by Nevyn
Conflicts is probably good. I need to prove that we have enough control to
do this if need be. As it is, I don't actually have admin rights on the
machines (60 odd for the pilot, 2000 next year). So our only mechanism for
controlling what applications are on there is using updates.
.....uh, yeah. I would *definitely* look to using either a wrapper script,
probably triggered from cron, that allowed you to drop post-install actions,
or the batch thing.

Um, or puppet, or something like that. They are pretty darn good. :)


Anyway, Conflicts / Replaces is how Debian do this obsolescence process, but
it is only a *hint* to the resolver, and at least end users could override it
such that your metapackage gets kicked off instead.

Daniel

Footnotes:
[1] You can use the puppet client direct on a manifest without needing the
whole infrastructure in place, incidentally, so it can be a "better batch
language" for your implementation if you want.
--
✣ Daniel Pittman ✉ ***@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
David Roberts
2010-11-17 21:26:55 UTC
Permalink
Hmmm, I'm not sure about apt, but with rpm's you can have
pre/post/preun/postun sections to perform actions before/after
installing and removing a package. This can be used to remove packages
and perform sysadmin in general (updating user accounts, conf files,
anything you can bash in general). Perhaps there is something similar
with dpkg (sorry, Red Hat trained, although Debian lover..)

-----Original Message-----
From: nzlug-***@linux.net.nz [mailto:nzlug-***@linux.net.nz] On
Behalf Of Nevyn
Sent: Wednesday, 17 November 2010 12:52 p.m.
To: NZLUG Mailing List
Subject: [nzlug] Removing via an apt package

Hi Everyone,

Does anyone know what I would do to remove an application by
distributing a package? I have a meta package (just has a long string
of requires). I need to be able to use that meta package to also
remove something (2nd day of a pilot programme and 1 application is
causing issues).

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
#####################################################################################
Important: This electronic message and attachments (if any) are confidential
and may be legally privileged. If you are not the intended recipient do not
copy, disclose or use the contents in any way. Please let us know by return
e-mail immediately and then destroy this message.
#####################################################################################

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Nevyn
2010-11-17 21:54:35 UTC
Permalink
Post by David Roberts
Hmmm, I'm not sure about apt, but with rpm's you can have
pre/post/preun/postun sections to perform actions before/after
installing and removing a package. This can be used to remove packages
and perform sysadmin in general (updating user accounts, conf files,
anything you can bash in general). Perhaps there is something similar
with dpkg (sorry, Red Hat trained, although Debian lover..)
Turns out I'm a bit of an idiot. I already have a wrapper script for
doing the update. All I have to do is make that script check a list of
installed applications against a blacklist and uninstall any that are
on that blacklist. Doesn't stop them from installing it. It just makes
it disappear.

Regards,
Nevyn
http://nevsramblings.blogspot.com/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Craig Box
2010-11-17 22:05:51 UTC
Permalink
Post by Nevyn
Does anyone know what I would do to remove an application by
distributing a package? I have a meta package (just has a long string
of requires). I need to be able to use that meta package to also
remove something (2nd day of a pilot programme and 1 application is
causing issues).
Have the meta-package Conflict with the package you wish to remove:
http://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts

Craig
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug

Continue reading on narkive:
Loading...