From 927b6bb1aaf6d1010d2d17261d37af6247309900 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 10 Feb 2010 10:29:49 +0530 Subject: [PATCH] dps: make install aware of distro-based setup gl-install copies - the initial rc file to ~/.gitolite.rc if it doesn't exist - src and hooks to GL_ADMINDIR Make it aware of a package-based setup sequence, where the above two change somewhat; see code diff. This should be the last bit of change needed to prepare gitolite setup so that a distro package maintainer does not have to fiddle too much with code inside. (What remains is docs, and a setup script for server-side use, to replace the latter part of easy install) --- src/gl-install | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gl-install b/src/gl-install index 01a2317..13798ae 100755 --- a/src/gl-install +++ b/src/gl-install @@ -3,7 +3,7 @@ use strict; use warnings; -our ($REPO_BASE, $GL_ADMINDIR, $GL_CONF, $GIT_PATH); +our ($REPO_BASE, $GL_ADMINDIR, $GL_CONF, $GIT_PATH, $GL_PACKAGE_CONF, $GL_PACKAGE_HOOKS); # setup quiet mode if asked; please do not use this when running manually open STDOUT, ">", "/dev/null" if (@ARGV and shift eq '-q'); @@ -31,7 +31,11 @@ require "$bindir/gitolite.pm"; unless ($ENV{GL_RC}) { # doesn't exist. Copy it across, tell user to edit it and come back my $glrc = $ENV{HOME} . "/.gitolite.rc"; - system("cp $bindir/../conf/example.gitolite.rc $glrc"); + if ($GL_PACKAGE_CONF) { + system("cp $GL_PACKAGE_CONF/example.gitolite.rc $glrc"); + } else { + system("cp $bindir/../conf/example.gitolite.rc $glrc"); + } print "created $glrc\n"; print "please edit it, change the paths if you wish to, and RERUN THIS SCRIPT\n"; exit; @@ -49,13 +53,18 @@ wrap_mkdir($repo_base_abs); wrap_mkdir($GL_ADMINDIR); # mkdir $GL_ADMINDIR's subdirs for my $dir qw(conf doc keydir logs src hooks hooks/common hooks/gitolite-admin) { + # some of them will stay empty; too lazy to fix right now ;-) wrap_mkdir("$GL_ADMINDIR/$dir"); } # "src" and "doc" will be overwritten on each install, but not conf -system("cp -R src doc hooks $GL_ADMINDIR"); +if ($GL_PACKAGE_HOOKS) { + system("cp -R $GL_PACKAGE_HOOKS $GL_ADMINDIR"); +} else { + system("cp -R $bindir/../src $bindir/../doc $bindir/../hooks $GL_ADMINDIR"); +} -unless (-f $GL_CONF) { +unless (-f $GL_CONF or $GL_PACKAGE_CONF) { print <