PKG_DELETE(1) NetBSD General Commands Manual PKG_DELETE(1) NNAAMMEE ppkkgg__ddeelleettee - a utility for deleting previously installed software package distributions SSYYNNOOPPSSIISS ppkkgg__ddeelleettee [--DDddFFffnnOORRrrVVvv] [--KK _p_k_g___d_b_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. 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 _(_/_v_a_r_/_d_b_/_p_k_g_/_<_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_, _+_D_E_I_N_S_T_A_L_L_, _+_R_E_Q_U_I_R_E _o_r _+_M_T_R_E_E___D_I_R_S _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. --DD If a deinstallation script exists for a given package, do not execute it. --dd Remove empty directories created by file cleanup. By default, only files/directories explicitly listed in a package's contents (either as normal files/directories or with the @@ddiirrrrmm directive) will be removed at deinstallation time. This option tells ppkkgg__ddeelleettee to also remove any directories that were emptied as a result of removing the package. --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 or require script fails. --KK _p_k_g___d_b_d_i_r Set _p_k_g___d_b_d_i_r as the package database directory. If this option isn't specified, then the package database directory is taken from the value of the environment variable PKG_DBDIR if it's set, otherwise it defaults to _/_v_a_r_/_d_b_/_p_k_g. --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 _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 Like the --rr option, this does a recursive delete. The --RR option deletes the given package and any packages required by it, unless some other package still needs them. This can be used to delete a package and all the packages it needs. --rr ppkkgg__ddeelleettee first builds a list of all packages that require (directly and indirectly) the one being deleted. It then deletes these packages using ppkkgg__ddeelleettee with the given options before deleting the user specified package. --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 _/_v_a_r_/_d_b_/_p_k_g_/_<_p_k_g_-_n_a_m_e_>, deletes the package contents, and finally removes the package records (if an alternate package database directory is specified, then it overrides the _/_v_a_r_/_d_b_/_p_k_g path shown above). 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 the package contains a _r_e_q_u_i_r_e file (see pkg_create(1)), then this is executed first as rreeqquuiirree _<_p_k_g_-_n_a_m_e_> _D_E_I_N_S_T_A_L_L (where _p_k_g_-_n_a_m_e is the name of the package in question and _D_E_I_N_S_T_A_L_L is a keyword denoting that this is a deinstallation) to see whether or not deinstallation should continue. A non-zero exit status means no, unless the --ff option is specified. 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). SSEEEE AALLSSOO pkg_add(1), pkg_admin(1), pkg_create(1), pkg_info(1), mktemp(3), packages(7), mtree(8) AAUUTTHHOORRSS Jordan Hubbard most of the work John Kohl refined it for NetBSD Hubert Feyrer NetBSD wildcard dependency processing, pkgdb, recursive "down" delete, etc. NetBSD 1.6 September 2, 2003 NetBSD 1.6