I.  To provide a clear-user-data (CUD) and/or restore-factory-settings (RFS)
    script, perform the following steps:

    For the CUD shell script:
    1. Create a shell script that is executable and ends in .sh
       Make reasonably sure your script has a unique name, otherwise the package
       containing it may fail to install. The best way to do this would be for
       the script to contain your package name (like, packagename-cud.sh or
       packagename-rfs.sh).
    2. Distribute it in a package that depends on clean-device-dev, or add a
       dependency on clean-device-dev to your existing package.
    3. When creating the package, retrieve the location where you're supposed to
       install the shell script like this:

    pkg-config --variable=cud_scripts_dir clean-device

    This command outputs the CUD script installation directory to standard
    output.

    The same steps apply to the RFS shell script, but the pkg-config variable's
    name is rfs_scripts_dir. Thus, for step 3, run

    pkg-config --variable=rfs_scripts_dir clean-device

    This command outputs the RFS script installation directory to standard
		output.

II. If you need to restrict execution of your shell script such that it may only
    be executed during the CUD/RFS process, then you must source the following
    file:

    source /usr/share/clean-device/aegis-check.sh

    You can retrieve the path to the aegis-check.sh file
    (/usr/share/clean-device in the above example) using the pkgconfig variable
    "snippets_dir":

    pkg-config --variable=snippets_dir clean-device

    The mechanism implemented by aegis-check.sh is to look for the aegis
    "clean-device::CUDOrRFS" token among the tokens present in the process'
    aegis context. aegis-check.sh will output "Permission denied" to standard
    output and cause your script to exit with a value of 77 if it fails to find
    the clean-device::CUDOrRFS aegis token.
