~ubuntu-branches/ubuntu/utopic/gitolite3/utopic

« back to all changes in this revision

Viewing changes to install

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2013-05-18 17:59:21 UTC
  • Revision ID: package-import@ubuntu.com-20130518175921-ac4xe6vd0jtxvjot
Tags: upstream-3.5.1+4
ImportĀ upstreamĀ versionĀ 3.5.1+4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
# Clearly you don't need a program to make one measly symlink, but the git
 
6
# describe command involved in generating the VERSION string is a bit fiddly.
 
7
 
 
8
use Getopt::Long;
 
9
use FindBin;
 
10
 
 
11
# meant to be run from the root of the gitolite tree, one level above 'src'
 
12
BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin . "/src"; }
 
13
BEGIN { $ENV{GL_LIBDIR} = "$ENV{GL_BINDIR}/lib"; }
 
14
use lib $ENV{GL_LIBDIR};
 
15
use Gitolite::Common;
 
16
 
 
17
=for usage
 
18
Usage (from gitolite clone directory):
 
19
 
 
20
    ./install
 
21
        to run gitolite using an absolute or relative path, for example
 
22
        'src/gitolite' or '/full/path/to/this/dir/src/gitolite'
 
23
 
 
24
    ./install -ln [<dir>]
 
25
        to symlink just the gitolite executable to some <dir> that is in
 
26
        $PATH.  <dir> defaults to $HOME/bin if <dir> not specified.  <dir> is
 
27
        assumed to exist; gitolite will not create it.
 
28
 
 
29
        Please provide a full path, not a relative path.
 
30
 
 
31
    ./install -to <dir>
 
32
        to copy the entire 'src' directory to <dir>.  If <dir> is not in
 
33
        $PATH, use the full path to run gitolite commands.
 
34
 
 
35
        Please provide a full path, not a relative path.
 
36
 
 
37
Simplest use, if $HOME/bin exists and is in $PATH, is:
 
38
 
 
39
    git clone git://github.com/sitaramc/gitolite
 
40
    gitolite/install -ln
 
41
 
 
42
    # now run setup
 
43
    gitolite setup -pk /path/to/YourName.pub
 
44
=cut
 
45
 
 
46
my ( $to, $ln, $help, $quiet );
 
47
 
 
48
GetOptions(
 
49
    'to=s' => \$to,
 
50
    'ln:s' => \$ln,
 
51
    'help|h'    => \$help,
 
52
    'quiet|q'    => \$quiet,
 
53
);
 
54
usage() if $to and $ln or $help;
 
55
$ln = "$ENV{HOME}/bin" if defined($ln) and not $ln;
 
56
for my $d ($ln, $to) {
 
57
    if ($d and not -d $d) {
 
58
        print STDERR "FATAL: '$d' does not exist.\n";
 
59
        usage();
 
60
    }
 
61
}
 
62
 
 
63
chdir($ENV{GL_BINDIR});
 
64
my $version = `git describe --tags --long --dirty=-dt`;
 
65
 
 
66
if ($to) {
 
67
    _mkdir($to);
 
68
    system("cp -a * $to");
 
69
    _print( "$to/VERSION", $version );
 
70
} elsif ($ln) {
 
71
    ln_sf( $ENV{GL_BINDIR}, "gitolite", $ln );
 
72
    _print( "VERSION", $version );
 
73
} else {
 
74
    say "use the following full path for gitolite:";
 
75
    say "\t$ENV{GL_BINDIR}/gitolite";
 
76
    _print( "VERSION", $version );
 
77
}