mirror of https://github.com/perkeep/perkeep.git
update dev-* scripts to use misc/devlib.pl and install binaries in gopath/bin/OS_ARCH
Change-Id: Iec928f786e7763a104d10f7e2a34a1bc6d948919
This commit is contained in:
parent
aecc8fbfa7
commit
0fa34e75b0
|
@ -3,6 +3,7 @@
|
|||
use strict;
|
||||
use FindBin qw($Bin);
|
||||
use Getopt::Long;
|
||||
require "$Bin/misc/devlib.pl";
|
||||
|
||||
unless ($ENV{GOPATH}) {
|
||||
$ENV{GOPATH} = "$Bin/gopath"
|
||||
|
@ -19,6 +20,8 @@ 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";
|
||||
|
||||
|
@ -32,7 +35,7 @@ if ($opt_tls) {
|
|||
$blobserver =~ s/^http/https/;
|
||||
}
|
||||
|
||||
exec("$ENV{GOPATH}/bin/camget",
|
||||
exec("$camget",
|
||||
"--verbose",
|
||||
"--blobserver=$blobserver",
|
||||
@ARGV);
|
||||
|
|
40
dev-cammount
40
dev-cammount
|
@ -1,20 +1,30 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/perl
|
||||
|
||||
set -x
|
||||
set -e
|
||||
use strict;
|
||||
use FindBin qw($Bin);
|
||||
use Getopt::Long;
|
||||
require "$Bin/misc/devlib.pl";
|
||||
|
||||
DIR=/tmp/cammount-dir
|
||||
mkdir -p $DIR
|
||||
my $blobref = shift;
|
||||
unless ($blobref && $blobref =~ /^\w+-[0-9a-f]{10,}$/) {
|
||||
die "Usage: dev-cammount [blobref]\n";
|
||||
}
|
||||
my $cammount = build_bin("./cmd/cammount");
|
||||
|
||||
go install ./cmd/cammount/
|
||||
my $dir = "/tmp/cammount-dir";
|
||||
mkdir $dir, 0700 unless -d $dir;
|
||||
|
||||
(fusermount -u $DIR) || umount $DIR || umount -f $DIR || true
|
||||
|
||||
cammount --blobserver=localhost:3179/bs $@ $DIR &
|
||||
sleep 1
|
||||
cd $DIR
|
||||
bash
|
||||
cd /
|
||||
|
||||
fusermount -u $DIR || umount $DIR || umount -f $DIR || true
|
||||
try_unmount();
|
||||
print "Mounting on $dir ...\n";
|
||||
system("$cammount", "--blobserver=localhost:3179/bs", $blobref, $dir)
|
||||
and warn "cammount failure: $!\n";
|
||||
warn "Failed to unmount\n" unless try_unmount();
|
||||
|
||||
sub try_unmount {
|
||||
if ($^O eq "linux" && system("fusermount", "-u", $dir) == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 1 if system("umount", $dir) == 0;
|
||||
return 1 if system("umount", "-f", $dir) == 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use strict;
|
||||
use FindBin qw($Bin);
|
||||
use Getopt::Long;
|
||||
require "$Bin/misc/devlib.pl";
|
||||
|
||||
unless ($ENV{GOPATH}) {
|
||||
$ENV{GOPATH} = "$Bin/gopath"
|
||||
|
@ -19,6 +20,8 @@ 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";
|
||||
|
||||
|
@ -32,7 +35,7 @@ if ($opt_tls) {
|
|||
$blobserver =~ s/^http/https/;
|
||||
}
|
||||
|
||||
exec("$ENV{GOPATH}/bin/camput",
|
||||
exec("$camput",
|
||||
"--verbose",
|
||||
"--blobserver=$blobserver",
|
||||
@ARGV);
|
||||
|
|
13
dev-camsync
13
dev-camsync
|
@ -1,4 +1,11 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use FindBin qw($Bin);
|
||||
use Getopt::Long;
|
||||
require "$Bin/misc/devlib.pl";
|
||||
|
||||
my $camsync = build_bin("./cmd/camsync");
|
||||
exec($camsync, "--verbose", "--src=http://localhost:3179/bs", "--srcpassword=pass3179", @ARGV);
|
||||
die "Failed to exec camsync.";
|
||||
|
||||
./build.pl camsync && \
|
||||
clients/go/camsync/camsync --verbose --src=http://localhost:3179/bs --srcpassword=pass3179 $@
|
||||
|
|
3
dev-db
3
dev-db
|
@ -1,4 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
mysql -uroot -proot devcamli$USER
|
||||
|
||||
exec mysql -uroot -proot devcamli$USER
|
||||
|
|
|
@ -15,8 +15,8 @@ sub build_bin {
|
|||
sub find_bin {
|
||||
my $target = shift;
|
||||
$target =~ s!.+/!!;
|
||||
my $gp = find_arch_gopath();
|
||||
return "$gp/bin/$target";
|
||||
my $bin = find_gobin();
|
||||
return "$bin/$target";
|
||||
}
|
||||
|
||||
sub find_gobin {
|
||||
|
|
Loading…
Reference in New Issue