blob: e9bb5e0a9ba2757e01cf4082b306b6c62889c7b4 [file] [log] [blame]
#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
use Getopt::Long;
require "$Bin/misc/devlib.pl";
unless ($ENV{GOPATH}) {
$ENV{GOPATH} = "$Bin/gopath"
}
system("go", "install", "camlistore.org/cmd/camget") and die "failed to build camget";
sub usage {
die "Usage: dev-camget [--tls] -- camget_args";
}
my $opt_tls;
Getopt::Long::Configure("pass_through");
GetOptions("tls" => \$opt_tls)
or usage();
my $camget = build_bin("./cmd/camget");
# Respected by camli/osutil:
$ENV{"CAMLI_CONFIG_DIR"} = "$Bin/config/dev-client-dir";
# Respected by env expansions in config/dev-client-dir/config
$ENV{"CAMLI_SECRET_RING"} = "$Bin/pkg/jsonsign/testdata/test-secring.gpg";
$ENV{"CAMLI_KEYID"} = "26F5ABDA";
$ENV{"CAMLI_DEV_KEYBLOBS"} = "$Bin/config/dev-client-dir/keyblobs";
$ENV{"CAMLI_AUTH"} = "userpass:camlistore:pass3179";
my $blobserver = "http://localhost:3179/bs";
if ($opt_tls) {
$blobserver =~ s/^http/https/;
}
my @args;
unless (grep { /^--?shared\b/ } @ARGV) {
push @args, "--server=$blobserver";
}
push @args, @ARGV;
exec("$camget",
"--verbose",
@args);
die "Failure running camget: $!";