pkgsrc/mk/install/deinstall
jlam 66030afca0 Define new variables for package Makefile use:
REQD_FILES, REQD_FILES_PERMS, REQD_FILES_MODE
	REQD_DIRS, REQD_DIRS_PERMS

These are the same as the CONF_* variables, except the files and
directories listed in REQD_* are always copied over, created or removed
(taking into account if there are user modifications from the originals,
etc.) regardless of the value of PKG_CONFIG.

The implementation involved pushing the knowledge of PKG_CONFIG,
PKG_RCD_SCRIPTS, PKG_CREATE_USERGROUP, and PKG_REGISTER_SHELLS into
the individual helper scripts.  The helper scripts are now always
invoked by the +INSTALL and +DEINSTALL scripts.  The +DIRS and +FILES
script have been enhanced to understand a new "f" flag that means
"force" to ignore the value of PKG_CONFIG and PKG_RCD_SCRIPTS.

Lastly, the +FILES script has been taught a new "r" flag just for rc.d
scripts and the +RCD_SCRIPTS script is now unnecessary.
2005-08-19 22:24:09 +00:00

71 lines
1.8 KiB
Bash

# -*- sh -*-
# start of deinstall
#
# $NetBSD: deinstall,v 1.36 2005/08/19 22:24:10 jlam Exp $
case ${STAGE} in
VIEW-DEINSTALL)
case ${_PKG_CONFIG} in
yes)
case ${PKG_SYSCONFDEPOTBASE} in
"")
${TEST} ! -x ./+FILES ||
./+FILES VIEW-REMOVE ${PREFIX} ${PKG_PREFIX}
;;
*)
${SETENV} PLIST_IGNORE_FILES="${CONF_IGNORE_FILES}" \
${LINKFARM} -D -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
${RMDIR} -p ${PKG_SYSCONFVIEWBASE} 2>/dev/null || ${TRUE}
;;
esac
;;
esac
#
# Remove shells from /etc/shells.
#
${TEST} ! -x ./+SHELL ||
./+SHELL REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+SHELL ||
./+SHELL CHECK-REMOVE ${PKG_METADATA_DIR}
;;
DEINSTALL)
# Remove configuration files if they don't differ from the default
# config file.
#
${TEST} ! -x ./+FILES ||
./+FILES REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+RCD_SCRIPTS ||
./+RCD_SCRIPTS REMOVE ${PKG_METADATA_DIR}
;;
POST-DEINSTALL)
if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
"${_PKG_CONFIG}" = "yes" -a -n "${CONF_DEPENDS}" ]; then
if [ -h ${PKG_SYSCONFDIR} ]; then
${RM} -f ${PKG_SYSCONFDIR}
fi
${RMDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}` 2>/dev/null || ${TRUE}
fi
#
# Remove empty directories and unused users/groups.
#
${TEST} ! -x ./+DIRS ||
./+DIRS REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+USERGROUP ||
./+USERGROUP REMOVE ${PKG_METADATA_DIR}
#
# Check for any existing bits after we're finished de-installing.
#
${TEST} ! -x ./+USERGROUP ||
./+USERGROUP CHECK-REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+FILES ||
./+FILES CHECK-REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+RCD_SCRIPTS ||
./+RCD_SCRIPTS CHECK-REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+DIRS ||
./+DIRS CHECK-REMOVE ${PKG_METADATA_DIR}
;;
esac
# end of deinstall