File: //usr/local/libexec/qinst/delete
#!/bin/sh
# Delete files on the package list
set -e
OPT_QUIET=
while getopts "q" opt; do
case "${opt}" in
q)
OPT_QUIET="yes"
;;
*)
;;
esac
done
shift $(expr ${OPTIND} - 1)
PKGID="$1"
_error() {
local msg="$1"
test -z "${OPT_QUIET}" && echo "${msg}"
exit 1
}
test -n "${PKG_DBDIR}" -a -n "${PKGID}" || _error "Usage: $0 PKGID"
set -u
PKGDIR="${PKG_DBDIR}/${PKGID}"
BASEDIR=$(printenv HOME)
test -d "${PKGDIR}" || _error "Usage: $0 PKGID"
cd ${BASEDIR} || _error "Error: ${BASEDIR}: Permission denied"
if [ -f "${PKGDIR}/+DEINSTALL" ]; then
sh ${PKGDIR}/+DEINSTALL "${PKGID}" "POST-DEINSTALL"
fi
rm -f ${PKGDIR}/+*
rmdir ${PKGDIR} || :
: end of script