Subject: Re: reinstalling pkgtools/pkg_install?
To: None <tech-pkg@netbsd.org>
From: Klaus Heinz <k.heinz.nov.fuenf@onlinehome.de>
List: tech-pkg
Date: 11/27/2005 18:41:08
Georg Schwarz wrote:
> pkgsrc tells me to upgrade pkgtools/pkg_install. However, when I try to
> do so I end up like this:
> 
> ===> Deinstalling for pkg_install
> ===> Becoming root@lorenz to deinstall pkg_install.
> /sbin/su Password:
> Running
> /usr/people/schwarz/pkgsrc/pkgtools/pkg_install/work/pkg_install-2005112
> 2/delete/pkg_delete pkg_install-20050210
> Package `pkg_install-20050210' is marked as not for deletion

I have been in the same situation recently and that's what I found out:

  $ pkg_delete -f pkg_install
  Package `pkg_install-20050718' is marked as not for deletion

  $ pkg_delete -f -N pkg_install
  Package `pkg_install-20050718' is marked as not for deletion
  Deleting anyway
  $ pkg_info -e pkg_install
  $ ls /usr/sbin/pkg*
  /usr/sbin/pkg_add         /usr/sbin/pkg_create      /usr/sbin/pkg_info
  /usr/sbin/pkg_admin       /usr/sbin/pkg_delete      /usr/sbin/pkg_view

  $ cd /usr/pkgsrc/pkgtools/pkg_install
  $ make reinstall
  ...
  $ pkg_delete -f -f pkg_install
  Package `pkg_install-20050718' is marked as not for deletion
  Deleting anyway
  $ pkg_info -e pkg_install
  bash: /usr/sbin/pkg_info: No such file or directory
  $ ls /usr/sbin/pkg*
  ls: /usr/sbin/pkg*: No such file or directory

  $ make reinstall
  ...
  /usr/sbin/pkg_admin: not found
  ...
  $ cp /var/db/pkg/pkgdb.byfile.db  /tmp/
  $ pkg_delete -v -O pkg_install
  $ pkg_info -e pkg_install
  pkg_install-20050718
  $ cmp  /var/db/pkg/pkgdb.byfile.db  /tmp/pkgdb.byfile.db
  $

Conclusions:
- Like the manpage describes, option "-f" must be given twice
  to delete a package if it is marked "not for deletion" and pkg_delete
  will the package completely.

- Options "-f -N" seem to be the safest way to delete pkg_install.
  Registration of the package gets removed but the files are kept.

- Option "-O" seems to be doing nothing. I cannot see a fundamental
  difference between

     -N  Remove the package's registration and its entries from the pack-
         age database, but leave the files installed.  Don't run any dein-
         stall scripts or @unexec lines either.

  and

     -O  Only delete the package's entries from the package database, do
         not touch the package or its files itself.

  in pkg_delete(1). Why do we have "-O"?


ciao
     Klaus