&1 | ' .
'grep -c "\[GNUPG:\] VALIDSIG ' . $key_regex . ' "'
)) == '0')
die('Commit ' . $commit_identifier . ' is not signed by ' . $_GET['valid_keys']);
} else
die('Checking signatures is not implemented for ' . $_GET['t'] . ' repositories');
}
if (isset($_GET['p'])) {
if (base64_decode($_GET['p'],true)===false)
die('Invalid base64');
$prefix = ' --prefix="$(' .
'echo "' . $_GET['p'] . '" | ' .
'base64 -d' .
')"';
} else {
$prefix = '';
}
if ($_GET['t']=='git')
$handle = popen(
'git -C "' . $wok_dir . 'repositories/' . $_GET['t'] . '/' . $_GET['r'] . '"' .
' archive' .
$prefix .
' "' . $commit_identifier . '" | ' .
'gzip -nc',
'r'
);
elseif ($_GET['t']=='hg')
$handle = popen(
'hg archive' .
' -t tgz' .
$prefix .
' -R "' . $work_dir . 'repositories/' . $_GET['t'] . '/' . $_GET['r'] . '"' .
' -r "' . $commit_identifier . '"' .
' /dev/stdout',
'r'
);
else
$handle = false;
if ($handle === false)
die('Unable to create archive');
header('Content-type: application/x-gzip');
header('Content-Disposition: attachment; filename="archive.tar.gz"');
fpassthru($handle);
pclose($handle);
die();
}
die('errrm, this is not yet implemented');
}
print 'Hi, this is an archive server!
' . "\n";
print 'I provide archives of these upstreams:
' . "\n";
print
implode(
"
\n",
array_map(
"base64_decode",
explode(
"\n",
shell_exec(
'find "' . $work_dir . 'repositories" -mindepth 2 -maxdepth 2 -printf "%f\n" | sort'
)
)
)
);
die();