The request script cannot modify any files. This script only interacts with administrators who are installing the package and creates a list of environment variable assignments based upon that interaction. The request script runs as the non privileged user install if that user exists. Otherwise, the script is executed as root.
The pkgadd command calls the request script with one argument that names the script's response file. The response file stores the administrator's responses.
The request script is not executed during package removal. However, the environment variables assigned by the script are saved and are available during package removal.