(projects.list changes) collect gitweb-specific stuff in one place
also - new "WEB_INTERFACE" variable (defaults to 'gitweb') - setup_web_access (write a plain list of repos out) - add_del_web_access (add/delete a single repo from projects.list)
This commit is contained in:
parent
550982f69e
commit
22bd3c8e72
|
@ -27,6 +27,7 @@ $GL_CONF_COMPILED="$GL_ADMINDIR/conf/gitolite.conf-compiled.pm";
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
$GL_WILDREPOS = 0;
|
$GL_WILDREPOS = 0;
|
||||||
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";
|
$PROJECTS_LIST = $ENV{HOME} . "/projects.list";
|
||||||
|
# $WEB_INTERFACE = "gitweb";
|
||||||
$REPO_UMASK = 0077;
|
$REPO_UMASK = 0077;
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,7 @@ opt $ARE_YOU_SURE && {
|
||||||
rm -rf $repo.git
|
rm -rf $repo.git
|
||||||
echo "$repo is now GONE!"
|
echo "$repo is now GONE!"
|
||||||
|
|
||||||
|
# gitweb specific; code for cgit users left as an exercise for the reader
|
||||||
cd $HOME
|
cd $HOME
|
||||||
PROJECTS_LIST=$($GL_BINDIR/gl-query-rc PROJECTS_LIST)
|
PROJECTS_LIST=$($GL_BINDIR/gl-query-rc PROJECTS_LIST)
|
||||||
export repo
|
export repo
|
||||||
|
|
|
@ -21,6 +21,7 @@ use Exporter 'import';
|
||||||
setup_daemon_access
|
setup_daemon_access
|
||||||
setup_git_configs
|
setup_git_configs
|
||||||
setup_gitweb_access
|
setup_gitweb_access
|
||||||
|
setup_web_access
|
||||||
shell_out
|
shell_out
|
||||||
slurp
|
slurp
|
||||||
special_cmd
|
special_cmd
|
||||||
|
@ -276,7 +277,7 @@ sub new_wild_repo {
|
||||||
wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS;
|
wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS;
|
||||||
setup_git_configs($repo, \%git_configs);
|
setup_git_configs($repo, \%git_configs);
|
||||||
setup_daemon_access($repo);
|
setup_daemon_access($repo);
|
||||||
add_del_line ("$repo.git", $PROJECTS_LIST, setup_gitweb_access($repo, '', ''));
|
add_del_web_access($repo);
|
||||||
wrap_chdir($ENV{HOME});
|
wrap_chdir($ENV{HOME});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +397,7 @@ sub get_set_perms
|
||||||
# gitweb and daemon
|
# gitweb and daemon
|
||||||
setup_daemon_access($repo);
|
setup_daemon_access($repo);
|
||||||
# add or delete line (arg1) from file (arg2) depending on arg3
|
# add or delete line (arg1) from file (arg2) depending on arg3
|
||||||
add_del_line ("$repo.git", $PROJECTS_LIST, setup_gitweb_access($repo, '', ''));
|
add_del_web_access($repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,6 +476,33 @@ sub setup_daemon_access
|
||||||
# set/unset gitweb access
|
# set/unset gitweb access
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub setup_web_access {
|
||||||
|
if ($WEB_INTERFACE eq 'gitweb') {
|
||||||
|
|
||||||
|
my $projlist = shift;
|
||||||
|
my $projlist_fh = wrap_open( ">", "$PROJECTS_LIST.$$");
|
||||||
|
for my $proj (sort keys %{ $projlist }) {
|
||||||
|
print $projlist_fh "$proj\n";
|
||||||
|
}
|
||||||
|
close $projlist_fh;
|
||||||
|
rename "$PROJECTS_LIST.$$", $PROJECTS_LIST;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
warn "sorry, unknown web interface $WEB_INTERFACE\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub add_del_web_access {
|
||||||
|
if ($WEB_INTERFACE eq 'gitweb') {
|
||||||
|
|
||||||
|
my $repo = shift;
|
||||||
|
add_del_line ("$repo.git", $PROJECTS_LIST, setup_gitweb_access($repo, '', ''));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
warn "sorry, unknown web interface $WEB_INTERFACE\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# returns 1 if gitweb access has happened; this is to allow the caller to add
|
# returns 1 if gitweb access has happened; this is to allow the caller to add
|
||||||
# an entry to the projects.list file
|
# an entry to the projects.list file
|
||||||
my $desc_file = "description";
|
my $desc_file = "description";
|
||||||
|
|
|
@ -21,7 +21,7 @@ use Exporter 'import';
|
||||||
$GL_NO_CREATE_REPOS $GL_NO_DAEMON_NO_GITWEB $GL_NO_SETUP_AUTHKEYS
|
$GL_NO_CREATE_REPOS $GL_NO_DAEMON_NO_GITWEB $GL_NO_SETUP_AUTHKEYS
|
||||||
$GL_PACKAGE_CONF $GL_PACKAGE_HOOKS $GL_PERFLOGT $GL_SITE_INFO
|
$GL_PACKAGE_CONF $GL_PACKAGE_HOOKS $GL_PERFLOGT $GL_SITE_INFO
|
||||||
$GL_SLAVE_MODE $GL_WILDREPOS $GL_WILDREPOS_DEFPERMS
|
$GL_SLAVE_MODE $GL_WILDREPOS $GL_WILDREPOS_DEFPERMS
|
||||||
$GL_WILDREPOS_PERM_CATS $HTPASSWD_FILE $PROJECTS_LIST $REPO_BASE
|
$GL_WILDREPOS_PERM_CATS $HTPASSWD_FILE $PROJECTS_LIST $WEB_INTERFACE $REPO_BASE
|
||||||
$REPO_UMASK $RSYNC_BASE $SVNSERVE $UPDATE_CHAINS_TO $AUTH_OPTIONS
|
$REPO_UMASK $RSYNC_BASE $SVNSERVE $UPDATE_CHAINS_TO $AUTH_OPTIONS
|
||||||
$GL_HOSTNAME
|
$GL_HOSTNAME
|
||||||
|
|
||||||
|
@ -57,6 +57,9 @@ $ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$);
|
||||||
# maximum number of output lines from info under GL_BIG_CONFIG
|
# maximum number of output lines from info under GL_BIG_CONFIG
|
||||||
$BIG_INFO_CAP = 20;
|
$BIG_INFO_CAP = 20;
|
||||||
|
|
||||||
|
# default values for stuff that may be missing in the RC file
|
||||||
|
$WEB_INTERFACE = 'gitweb';
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# bring in the rc vars and allow querying them
|
# bring in the rc vars and allow querying them
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -569,12 +569,8 @@ for my $repo (@phy_repos) {
|
||||||
|
|
||||||
# write out the project list, but not if GL_NO_DAEMON_NO_GITWEB is set
|
# write out the project list, but not if GL_NO_DAEMON_NO_GITWEB is set
|
||||||
unless ($GL_NO_DAEMON_NO_GITWEB) {
|
unless ($GL_NO_DAEMON_NO_GITWEB) {
|
||||||
my $projlist_fh = wrap_open( ">", "$PROJECTS_LIST.$$");
|
setup_web_access(\%projlist);
|
||||||
for my $proj (sort keys %projlist) {
|
|
||||||
print $projlist_fh "$proj\n";
|
|
||||||
}
|
|
||||||
close $projlist_fh;
|
|
||||||
rename "$PROJECTS_LIST.$$", $PROJECTS_LIST;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue