HEX
Server: Apache
System: FreeBSD www860.sakura.ne.jp 13.0-RELEASE-p14 FreeBSD 13.0-RELEASE-p14 #2: Mon Dec 9 13:54:55 JST 2024 root@www5301.sakura.ne.jp:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
User: yoyo0427 (1306)
PHP: 8.3.8
Disabled: NONE
Upload Files
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