install streamlining:

- install.sh is now install.pl (had to happen sooner or later!)
  - now handles updates more gracefully, doesn't overwrite important stuff :)
  - makes the install sequence much easier to understand
    (just run it and follow the prompts!)

  - made ~/.gitolite.rc much clearer to edit
This commit is contained in:
Sitaram Chamarty 2009-08-30 12:11:55 +05:30
parent b1c329dbb6
commit 08305aa482
3 changed files with 81 additions and 30 deletions

View file

@ -1,20 +1,38 @@
# this is meant to be pulled into a perl program using "do" # default paths for gitolite
# please read comments before editing
# this file is meant to be pulled into a perl program using "do" or "require".
# You do NOT need to know perl to edit the paths; it should be fairly
# self-explanatory
# --------------------------------------
# this is where the repos go. If you provide a relative path (not starting
# with "/"), it's relative to your $HOME. You may want to put in something
# like "/bigdisk" or whatever if your $HOME is too small for the repos, for
# example
# base directory for all the repos (absolute, or relative to $HOME)
$REPO_BASE="repositories"; $REPO_BASE="repositories";
# --------------------------------------
# I see no reason anyone may want to change the gitolite admin directory, but
# feel free to do so
# gitolite admin directory, files, etc # gitolite admin directory, files, etc
$GL_ADMINDIR=$ENV{HOME} . "/.gitolite"; $GL_ADMINDIR=$ENV{HOME} . "/.gitolite";
# -------------------------------------- # --------------------------------------
# the ones below can be left as they are, unless for some reason you want them # I see even less reason to change these, since they're all relative to the
# elsewhere # gitolite admin directory above, but hey it's *your* system...
$GL_CONF="$GL_ADMINDIR/conf/gitolite.conf"; $GL_CONF="$GL_ADMINDIR/conf/gitolite.conf";
$GL_KEYDIR="$GL_ADMINDIR/keydir"; $GL_KEYDIR="$GL_ADMINDIR/keydir";
$GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm"; $GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm";
# -------------------------------------- # --------------------------------------
# this should be the last line in this file, per perl rules # per perl rules, this should be the last line in such a file:
1; 1;

58
src/install.pl Executable file
View file

@ -0,0 +1,58 @@
#!/usr/bin/perl
use strict;
use warnings;
our $REPO_BASE;
our $GL_ADMINDIR;
our $GL_CONF;
# wrapper around mkdir; it's not an error if the directory exists, but it is
# an error if it doesn't exist and we can't create it
sub wrap_mkdir
{
my $dir = shift;
-d $dir or mkdir($dir) or die "mkdir $dir failed: $!\n";
}
# the only path that is *fixed* (can't be changed without changing all 3
# programs) is ~/.gitolite.rc
my $glrc = $ENV{HOME} . "/.gitolite.rc";
unless (-f $glrc) {
# doesn't exist. Copy it across, tell user to edit it and come back
system("cp conf/example.gitolite.rc $glrc");
print STDERR "created $glrc\n";
print STDERR "please edit it, set the paths as you like, and rerun this script\n";
exit;
}
# ok now $glrc exists; read it to get the other paths
unless (my $ret = do $glrc)
{
die "parse $glrc failed: $@" if $@;
die "couldn't do $glrc: $!" unless defined $ret;
die "couldn't run $glrc" unless $ret;
}
# mkdir $REPO_BASE, $GL_ADMINDIR if they don't already exist
wrap_mkdir( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$ENV{HOME}/$REPO_BASE" );
wrap_mkdir($GL_ADMINDIR);
# mkdir $GL_ADMINDIR's subdirs
for my $dir qw(conf doc keydir src) {
wrap_mkdir("$GL_ADMINDIR/$dir");
}
# "src" and "doc" will be overwritten on each install, but not conf
system("cp -R src doc $GL_ADMINDIR");
unless (-f $GL_CONF) {
system("cp conf/example.conf $GL_CONF");
print STDERR <<EOF;
created $GL_CONF
please edit it, then run these two commands:
cd $GL_ADMINDIR
src/gl-compile-conf
(the "admin" document should help here...)
EOF
}

View file

@ -1,25 +0,0 @@
#!/bin/bash
# install gitolite
# quick safety check: do not run if ~/.gitolite.rc is present
[[ -f ~/.gitolite.rc ]] && {
echo sorry\; \'~/.gitolite.rc\' already exists
exit 1
}
# this one is fixed to the location shown
cp conf/example.gitolite.rc ~/.gitolite.rc
# the destinations below are defaults; if you change the paths in the "rc"
# file above, these destinations also must change accordingly
# mkdir $REPO_BASE, $GL_ADMINDIR, it's subdirs, and $GL_KEYDIR
mkdir ~/repositories
mkdir ~/.gitolite
mkdir ~/.gitolite/{src,conf,doc,keydir}
# copy conf, src, doc
cp -R src doc conf ~/.gitolite
cp conf/example.conf ~/.gitolite/conf/gitolite.conf