perkeep/dev-camput

49 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/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/camput") and die "failed to build camput";
sub usage {
die "Usage: dev-camput [--tls] -- camput_args";
}
my $opt_tls;
Getopt::Long::Configure("pass_through");
GetOptions("tls" => \$opt_tls)
or usage();
my $camput = build_bin("./cmd/camput");
# 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/";
if ($opt_tls) {
$blobserver =~ s/^http/https/;
}
if ($ENV{"CAMLI_WANT_CAMPUT_PASSWORD"}) { # Set by dev-pass-camput
$ENV{"CAMLI_SECRET_RING"} = "$Bin/pkg/jsonsign/testdata/password-foo-secring.gpg";
$ENV{"CAMLI_KEYID"} = "C7C3E176";
$ENV{"CAMLI_DEV_KEYBLOBS"} = "$Bin/config/dev-client-dir/keyblobs";
print "**\n** Note: password is \"foo\"\n**\n";
}
exec("$camput",
"--verbose",
"--server=$blobserver",
@ARGV);
die "Failure running camput: $!";