1#! /usr/bin/env php
2<?php
3
4/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
5
6// Check if we're running directly from git repo or if we're running
7// from a PEAR or Composer packaged version.
8$ds    = DIRECTORY_SEPARATOR;
9$root  = __DIR__ . $ds . '..' ;
10$paths = array(
11    '@php-dir@', // PEAR or Composer
12    $root, // Git (or Composer with wrong @php-dir@)
13    $root . $ds . '..' . $ds . 'Console_CommandLine', // Composer
14    $root . $ds . '..' . $ds . 'console_commandline', // Composer
15    // and composer-installed PEAR_Exception for Console_CommandLine (#21074)
16    $root . $ds . '..' . $ds . '..' . $ds . 'pear' . $ds . 'pear_exception',
17);
18
19foreach ($paths as $idx => $path) {
20    if (!is_dir($path)) {
21        unset($paths[$idx]);
22    }
23}
24
25// We depend on Console_CommandLine, so we append also the default include path
26set_include_path(implode(PATH_SEPARATOR, $paths) . PATH_SEPARATOR . get_include_path());
27
28require_once 'Crypt/GPG/PinEntry.php';
29
30$pinentry = new Crypt_GPG_PinEntry();
31$pinentry->__invoke();
32
33?>
34