PKG_DELETE(1)           NetBSD General Commands Manual           PKG_DELETE(1)

NNAAMMEE
     ppkkgg__ddeelleettee -- a utility for deleting previously installed software pack-
     age distributions

SSYYNNOOPPSSIISS
     ppkkgg__ddeelleettee [--AADDFFffkkNNnnOORRrrVVvv] [--KK _p_k_g___d_b_d_i_r] [--PP _d_e_s_t_d_i_r] [--pp _p_r_e_f_i_x]
                _p_k_g_-_n_a_m_e _._._.

DDEESSCCRRIIPPTTIIOONN
     The ppkkgg__ddeelleettee command is used to delete packages that have been previ-
     ously installed with the pkg_add(1) command.  The given packages are
     sorted, so that the dependencies of a package are deleted after the pack-
     age.  Before any action is executed, ppkkgg__ddeelleettee checks for packages that
     are marked as pprreesseerrvveedd or have depending packages left.  If the --kk flag
     is given, preserved packages are removed from the list of packages to
     remove.  Unless the --ff flag is given, ppkkgg__ddeelleettee stops on the first
     error.

WWAARRNNIINNGG
     _S_i_n_c_e _t_h_e ppkkgg__ddeelleettee _c_o_m_m_a_n_d _m_a_y _e_x_e_c_u_t_e _s_c_r_i_p_t_s _o_r _p_r_o_g_r_a_m_s _p_r_o_v_i_d_e_d _b_y
     _a _p_a_c_k_a_g_e _f_i_l_e_, _y_o_u_r _s_y_s_t_e_m _m_a_y _b_e _s_u_s_c_e_p_t_i_b_l_e _t_o _`_`_T_r_o_j_a_n _h_o_r_s_e_s_'_' _o_r
     _o_t_h_e_r _s_u_b_t_l_e _a_t_t_a_c_k_s _f_r_o_m _m_i_s_c_r_e_a_n_t_s _w_h_o _c_r_e_a_t_e _d_a_n_g_e_r_o_u_s _p_a_c_k_a_g_e _f_i_l_e_s_.

     _Y_o_u _a_r_e _a_d_v_i_s_e_d _t_o _v_e_r_i_f_y _t_h_e _c_o_m_p_e_t_e_n_c_e _a_n_d _i_d_e_n_t_i_t_y _o_f _t_h_o_s_e _w_h_o _p_r_o_-
     _v_i_d_e _i_n_s_t_a_l_l_a_b_l_e _p_a_c_k_a_g_e _f_i_l_e_s_.  _F_o_r _e_x_t_r_a _p_r_o_t_e_c_t_i_o_n_, _e_x_a_m_i_n_e _a_l_l _t_h_e
     _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s _i_n _t_h_e _p_a_c_k_a_g_e _r_e_c_o_r_d _d_i_r_e_c_t_o_r_y
     _<_P_K_G___D_B_D_I_R_>_/_<_p_k_g_-_n_a_m_e_>_/_)_.  _P_a_y _p_a_r_t_i_c_u_l_a_r _a_t_t_e_n_t_i_o_n _t_o _a_n_y _+_I_N_S_T_A_L_L _o_r
     _+_D_E_I_N_S_T_A_L_L _f_i_l_e_s_, _a_n_d _i_n_s_p_e_c_t _t_h_e _+_C_O_N_T_E_N_T_S _f_i_l_e _f_o_r @@ccwwdd_, @@mmooddee _(_c_h_e_c_k
     _f_o_r _s_e_t_u_i_d_)_, @@ddiirrrrmm_, @@eexxeecc_, _a_n_d @@uunneexxeecc _d_i_r_e_c_t_i_v_e_s_, _a_n_d_/_o_r _u_s_e _t_h_e
     pkg_info(_1) _c_o_m_m_a_n_d _t_o _e_x_a_m_i_n_e _t_h_e _i_n_s_t_a_l_l_e_d _p_a_c_k_a_g_e _c_o_n_t_r_o_l _f_i_l_e_s_.

OOPPTTIIOONNSS
     The following command line options are supported:

     _p_k_g_-_n_a_m_e _._._.
             The named packages are deinstalled, wildcards can be used, see
             pkg_info(1).  If no version is given, the one currently installed
             will be removed.  If the --FF flag is given, one or more (absolute)
             filenames may be specified and the Package Database will be con-
             sulted for the package to which the given file belongs.  These
             packages are then deinstalled.

     --AA      Recursively remove all automatically installed packages that were
             needed by the given packages and are no longer required.  See
             also the --RR flag.

     --DD      If a deinstallation script exists for a given package, do not
             execute it.

     --FF      Any pkg-name given will be interpreted as pathname which is sub-
             sequently transformed in a (real) package name via the Package
             Database.  That way, packages can be deleted by giving a filename
             instead of the package-name.

     --ff      Force removal of the package, even if a dependency is recorded or
             the deinstall script fails.

     --ffff     Force removal of the package, even if the package is marked as a
             pprreesseerrvveedd package.  Note that this is a dangerous operation.  See
             also the --kk option.

     --KK _p_k_g___d_b_d_i_r
             Override the value of the PKG_DBDIR configuration option with the
             value _p_k_g___d_b_d_i_r.

     --kk      Silently skip all packages that are marked as pprreesseerrvveedd.

     --NN      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.

     --nn      Don't actually deinstall a package, just report the steps that
             would be taken if it were.

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

     --pp _d_e_s_t_d_i_r
             Prefix all file and directory names with _d_e_s_t_d_i_r.  For packages
             without install scripts this has the same behavior as using
             chroot.

     --pp _p_r_e_f_i_x
             Set _p_r_e_f_i_x as the directory in which to delete files from any
             installed packages which do not explicitly set theirs.  For most
             packages, the prefix will be set automatically to the installed
             location by pkg_add(1).

     --RR      Recursively remove all packages that were needed by the given
             packages and that have no other dependencies left.  This option
             overrides the --AA flag.

     --rr      Recursively remove all packages that require one of the packages
             given.

     --VV      Print version number and exit.

     --vv      Turn on verbose output.

TTEECCHHNNIICCAALL DDEETTAAIILLSS
     ppkkgg__ddeelleettee does pretty much what it says.  It examines installed package
     records in _<_P_K_G___D_B_D_I_R_>_/_<_p_k_g_-_n_a_m_e_>, deletes the package contents, and
     finally removes the package records.

     If a package is required by other installed packages, ppkkgg__ddeelleettee will
     list those dependent packages and refuse to delete the package (unless
     the --ff option is given).

     If a package has been marked as a pprreesseerrvveedd package, it will not be able
     to be deleted (unless more than one occurrence of the --ff option is
     given).

     If a filename is given instead of a package name, the package of which
     the given file belongs to can be deleted if the --FF Flag is given.  The
     filename needs to be absolute, see the output produced by the pkg_info
     --aaFF command.

     If a ddeeiinnssttaallll script exists for the package, it is executed before and
     after any files are removed.  It is this script's responsibility to clean
     up any additional messy details around the package's installation, since
     all ppkkgg__ddeelleettee knows how to do is delete the files created in the origi-
     nal distribution.  The ddeeiinnssttaallll script is called as:
           ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _V_I_E_W_-_D_E_I_N_S_T_A_L_L
     before removing the package from a view, and as:
           ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _D_E_I_N_S_T_A_L_L
     before deleting all files and as:
           ddeeiinnssttaallll <_p_k_g_-_n_a_m_e> _P_O_S_T_-_D_E_I_N_S_T_A_L_L
     after deleting them.  Passing the keywords _V_I_E_W_-_D_E_I_N_S_T_A_L_L, _D_E_I_N_S_T_A_L_L and
     _P_O_S_T_-_D_E_I_N_S_T_A_L_L lets you potentially write only one program/script that
     handles all aspects of installation and deletion.

     All scripts are called with the environment variable PKG_PREFIX set to
     the installation prefix (see the --pp option above).  This allows a package
     author to write a script that reliably performs some action on the direc-
     tory where the package is installed, even if the user might have changed
     it by specifying the --pp option when running ppkkgg__ddeelleettee or pkg_add(1).
     The scripts are also called with the PKG_METADATA_DIR environment vari-
     able set to the location of the _+_* meta-data files, and with the
     PKG_REFCOUNT_DBDIR environment variable set to the location of the pack-
     age reference counts database directory.  If the --PP flag was given to
     ppkkgg__ddeelleettee, PKG_DESTDIR will be set to _d_e_s_t_d_i_r.

EENNVVIIRROONNMMEENNTT
     See pkg_install.conf(5) for options, that can also be specified using the
     environment.

SSEEEE AALLSSOO
     pkg_add(1), pkg_admin(1), pkg_create(1), pkg_info(1), pkg_install.conf(5)
     pkgsrc(7)

AAUUTTHHOORRSS
     Jordan Hubbard
             most of the work
     John Kohl
             refined it for NetBSD
     Hubert Feyrer
             NetBSD wildcard dependency processing, pkgdb, recursive "down"
             delete, etc.
     Joerg Sonnenberger
             Rewrote most of the code to compute correct order of deinstalla-
             tion and to improve error handling.

NetBSD 5.0                     January 20, 2010                     NetBSD 5.0
