merge all the '-h' related changes

run through the main test suite, (which really only uses 2 of these
programs), smoke tested the others, but not rigorously tested otherwise
This commit is contained in:
Sitaram Chamarty 2012-02-29 06:59:39 +05:30
commit a6ab6cd18d
7 changed files with 43 additions and 9 deletions

View file

@ -1,6 +1,15 @@
#!/bin/sh
die() { echo "$@" >&2; exit 1; }
if [ "$1" = "-h" ]
then
echo Usage:
echo " gl-admin-push [any options applicable to 'git push' command]"
echo
echo "Please see the 'gl-admin-push: ...' section in doc/tips-notes.mkd (Online at"
echo " http://sitaramc.github.com/gitolite/adminpush.html)"
exit 1
fi
# ----------

View file

@ -9,6 +9,10 @@
use strict;
use warnings;
if (not @ARGV and -t or $ARGV[0] eq '-h') {
print "Usage:\n gl-conf-convert < gitosis.conf > gitolite.conf\n(please the documentation for more)\n";
exit 1;
}
my @comments = ();
my $groupname;

View file

@ -11,7 +11,7 @@ cat <<EOFU
This is a quick hack. It is not "production quality". Resist the temptation
to turn this into an update.secondary hook and put it on the server. I WILL
NOT BE RESPONSIBLE FOR ANY PROBLEMS IF YOU DO THAT. (Even more so if you use
'git checkout $3' *without* setting GIT_INDEX_FILE to something temporary, and
'git checkout' *without* setting GIT_INDEX_FILE to something temporary, and
eventually realise that *deleted* files don't stay deleted...! And if you
didn't understand that, all the more reason not to do it).
@ -35,6 +35,8 @@ EOFU
exit 1;
}
[ "$1" = "-h" ] && usage
[ -n "$1" ] || die "need an admin username"
admin="$1"; shift
@ -69,7 +71,7 @@ $GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm";
$GL_WILDREPOS = 1;
$PROJECTS_LIST = $ENV{PWD} . "/projects.list";
$REPO_UMASK = 0077;
$GL_BIG_CONFIG = 0;
$GL_BIG_CONFIG = 1;
$GL_NO_DAEMON_NO_GITWEB = 1;
$GIT_PATH="";
$GL_GITCONFIG_KEYS = ".*";
@ -86,7 +88,7 @@ EOF
# now compile it
echo compiling...
$GL_BINDIR/gl-compile-conf
$GL_BINDIR/gl-compile-conf || die "compile failed; aborting rest of run"
echo
echo "checking if $admin has push rights..."

View file

@ -39,6 +39,11 @@ die "fatal: GL_HOSTNAME not set in rc; mirroring disabled\n" unless $GL_HOSTNAME
# ----------------------------------------------------------------------------
die "please read the gitolite mirroring documentation; this program is too
critical for you to just run it based on a 'usage' message.\n" if not @ARGV or $ARGV[0] eq '-h';
# ----------------------------------------------------------------------------
# deal with local invocations first
# on the "master", run from a shell, for one specific repo, with an optional
@ -77,8 +82,6 @@ if ( ($ARGV[0] || '') eq 'request-push' and not $ENV{SSH_ORIGINAL_COMMAND} ) {
exit 0;
}
unless (@ARGV) { print STDERR "fatal: missing command\n"; exit 1; }
# ----------
# now the remote invocations; log it, then get the sender name

View file

@ -53,7 +53,7 @@ exit 0;
sub check_args {
return unless @ARGV;
return if @ARGV == 3;
die "I need all 3 directories (bin-dir, conf-dir, hooks-dir) or none\n";
usage();
}
sub argv_or_defaults {
@ -127,3 +127,18 @@ sub path_advice {
$path_advice;
#>>>
}
sub usage {
print "
Usage:
gl-system-install [bin-dir conf-dir hooks-dir]
Requires all 3 arguments or none. All arguments supplied must be absolute
paths. The following defaults are used if arguments are not supplied:
as normal user: \$HOME/bin, \$HOME/share/gitolite/conf, \$HOME/share/gitolite/hooks
as root: /usr/local/bin, /var/gitolite/conf, /var/gitolite/hooks
";
exit 1;
}

View file

@ -13,7 +13,7 @@ use gitolite_rc;
use gitolite;
sub usage { print <DATA>; exit 1; }
usage() unless (@ARGV);
usage() if (not @ARGV) or $ARGV[0] eq '-h';
my $cmd = shift;
my $pub = shift;

View file

@ -8,7 +8,8 @@ use warnings;
use Getopt::Long;
my $admin = 0;
my $quiet = 0;
GetOptions('admin|a=s' => \$admin, 'quiet|q' => \$quiet);
my $help = 0;
GetOptions('admin|a=s' => \$admin, 'quiet|q' => \$quiet, 'help|h' => $help);
use Data::Dumper;
$Data::Dumper::Deepcopy = 1;
@ -31,7 +32,7 @@ sub msg {
print "sshkeys-lint: " . ( $warning ? "WARNING: " : "" ) . $_ for @_;
}
@ARGV or not -t or usage();
usage() if not @ARGV and -t or $help;
our @pubkeyfiles = @ARGV; @ARGV = ();
# ------------------------------------------------------------------------