Skip to content

Commit 3240b09

Browse files
committed
Optionally create user and repo at startup
1 parent 17c8098 commit 3240b09

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

scripts/httpd-foreground.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ set -e
55
rm -f /usr/local/apache2/logs/httpd.pid
66

77
# Ensure that we have a server name defined
8-
if [ "$HTTPD_SERVER_NAME" = "" ]
9-
then
8+
if [ "$HTTPD_SERVER_NAME" = "" ]; then
109
HTTPD_SERVER_NAME=${HOSTNAME}; export HTTPD_SERVER_NAME
1110
fi
1211

13-
if [ "$HTTPD_SERVER_ADMIN" = "" ]
14-
then
12+
if [ "$HTTPD_SERVER_ADMIN" = "" ]; then
1513
HTTPD_SERVER_ADMIN=admin@${HTTPD_SERVER_NAME}; export HTTPD_SERVER_ADMIN
1614
fi
1715

16+
if [ ! -f /svn/config/svn-users ] && [ "$SVN_USER" != "" ] && [ "$SVN_PASSWORD" != "" ]; then
17+
htpasswd -cbB /svn/config/svn-users $SVN_USER $SVN_PASSWORD
18+
fi
19+
20+
if [ "$SVN_REPO_NAME" != "" ] && [ ! -d /svn/repos/$SVN_REPO_NAME ]; then
21+
svnadmin create /svn/repos/$SVN_REPO_NAME
22+
chown -R httpd:httpd /svn/repos/$SVN_REPO_NAME
23+
fi
24+
1825
if [ "$HTTPD_SSL" = "" ]
1926
then
2027
exec httpd -DFOREGROUND

svn-conf/svn-access

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Example file, please see Path-Based Authorization in the Subversion documentation.
2+
# Please see Path-Based Authorization in the Subversion documentation.
33
#
44
# Groups can be defined with users and used with @. Aliases can be defined and referred to with &.
55
# Directories or by all means files are referred to as:
@@ -13,12 +13,15 @@
1313
#
1414
# The pre-defined tokens $authenticated and $anonymous can also be used.
1515
#
16-
[groups]
17-
admins = admin
18-
example_users = example_user
19-
16+
# Example:
17+
#
18+
# [groups]
19+
# admins = admin
20+
# example_users = example_user
21+
#
22+
# [ExampleRepo:/]
23+
# @example_users = rw
24+
#
25+
# Default rule below grants full read/write access to all authenticated users.
2026
[/]
21-
@admins = rw
22-
23-
[ExampleRepo:/]
24-
@example_users = rw
27+
$authenticated = rw

svn-conf/svn-users

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)