Gentoo Development Guide

pkg_prerm

Function pkg_prerm
Purpose Called before a package is unmerged
Sandbox Disabled
Privilege root
Called for ebuild, binary

Default pkg_prerm

pkg_prerm()
{
    return
}

Sample pkg_prerm

pkg_prerm() {
    # clean up temp files
    [[ -d "${ROOT}/var/tmp/foo" ]] && rm -rf "${ROOT}/var/tmp/foo"
}

Common pkg_prerm Tasks

pkg_prerm is used to clean up any files that would otherwise prevent a clean unmerge.