2012-03-31 16:15:59 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
# Clearly you don't need a program to make one measly symlink, but the git
|
|
|
|
# describe command involved in generating the VERSION string is a bit fiddly.
|
|
|
|
|
|
|
|
use Getopt::Long;
|
|
|
|
use FindBin;
|
|
|
|
|
|
|
|
# meant to be run from the root of the gitolite tree, one level above 'src'
|
|
|
|
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin . "/src"; }
|
2012-04-06 16:59:05 +02:00
|
|
|
BEGIN { $ENV{GL_LIBDIR} = "$ENV{GL_BINDIR}/lib"; }
|
|
|
|
use lib $ENV{GL_LIBDIR};
|
2012-03-31 16:15:59 +02:00
|
|
|
use Gitolite::Common;
|
|
|
|
|
|
|
|
=for usage
|
|
|
|
Usage (from gitolite clone directory):
|
|
|
|
|
|
|
|
./install
|
|
|
|
to run gitolite using an absolute or relative path, for example
|
|
|
|
'src/gitolite' or '/full/path/to/this/dir/src/gitolite'
|
2012-04-22 15:33:07 +02:00
|
|
|
|
2012-03-31 16:15:59 +02:00
|
|
|
./install -ln [<dir>]
|
|
|
|
to symlink just the gitolite executable to some <dir> that is in
|
2012-04-22 15:33:07 +02:00
|
|
|
$PATH. <dir> defaults to $HOME/bin if <dir> not specified. <dir> is
|
|
|
|
assumed to exist; gitolite will not create it.
|
|
|
|
|
|
|
|
Please provide a full path, not a relative path.
|
|
|
|
|
2012-03-31 16:15:59 +02:00
|
|
|
./install -to <dir>
|
|
|
|
to copy the entire 'src' directory to <dir>. If <dir> is not in
|
|
|
|
$PATH, use the full path to run gitolite commands.
|
|
|
|
|
2012-04-22 15:33:07 +02:00
|
|
|
Please provide a full path, not a relative path.
|
|
|
|
|
|
|
|
Simplest use, if $HOME/bin exists and is in $PATH, is:
|
2012-03-31 16:15:59 +02:00
|
|
|
|
|
|
|
git clone -b g3 git://github.com/sitaramc/gitolite
|
|
|
|
gitolite/install -ln
|
|
|
|
|
|
|
|
# now run setup
|
|
|
|
gitolite setup -pk /path/to/YourName.pub
|
|
|
|
=cut
|
|
|
|
|
|
|
|
my ( $to, $ln, $help, $quiet );
|
|
|
|
|
|
|
|
GetOptions(
|
|
|
|
'to=s' => \$to,
|
|
|
|
'ln:s' => \$ln,
|
|
|
|
'help|h' => \$help,
|
|
|
|
'quiet|q' => \$quiet,
|
|
|
|
);
|
|
|
|
usage() if $to and $ln or $help;
|
|
|
|
$ln = "$ENV{HOME}/bin" if defined($ln) and not $ln;
|
2012-04-22 15:33:07 +02:00
|
|
|
for my $d ($ln, $to) {
|
|
|
|
if ($d and not -d $d) {
|
|
|
|
print STDERR "FATAL: '$d' does not exist.\n";
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
}
|
2012-03-31 16:15:59 +02:00
|
|
|
|
|
|
|
chdir($ENV{GL_BINDIR});
|
|
|
|
my $version = `git describe --tags --long --dirty=-dt`;
|
|
|
|
|
|
|
|
if ($to) {
|
|
|
|
_mkdir($to);
|
|
|
|
system("cp -a * $to");
|
|
|
|
_print( "$to/VERSION", $version );
|
|
|
|
} elsif ($ln) {
|
|
|
|
ln_sf( $ENV{GL_BINDIR}, "gitolite", $ln );
|
|
|
|
_print( "VERSION", $version );
|
|
|
|
} else {
|
|
|
|
say "use the following full path for gitolite:";
|
|
|
|
say "\t$ENV{GL_BINDIR}/gitolite";
|
|
|
|
_print( "VERSION", $version );
|
|
|
|
}
|