-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvn.sh
executable file
·152 lines (130 loc) · 3.34 KB
/
svn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#/bin/sh
svninstall () {
sudo apt-get install subversion
}
svnsvnservmake () {
svnservcfg
sudo groupadd subversion
sudo mkdir /var/local/svn
sudo adduser --system --home /var/local/svn --no-create-home --uid 1002 --ingroup subversion --disabled-password --disabled-login subversion
sudo chown -R root:root /etc/init.d/svnserve
sudo chmod +x /etc/init.d/svnserve
sudo update-rc.d svnserve defaults
sudo chown -R subversion:subversion /var/local/svn
sudo chmod -R ug+rw /var/local/svn
}
svnstart () {
sudo /etc/init.d/svnserve start
sudo svnadmin create --fs-type fsfs /var/local/svn
}
svnimport () {
if [ $2 ]; then
mkdir -p /tmp/$1/trunk
mkdir -p /tmp/$1/branch
mkdir -p /tmp/$1/tag
cp -R $2/* /tmp/$1/trunk
svn import /tmp/$1 svn://localhost/svn/$1 -m "initialer Import"
fi
}
svnservcfg () {
sudo echo "#!/bin/sh -e
#
# svnserve - brings up the svn server so anonymous users
# can access svn
#
# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS
SVNSERVE=/usr/bin/svnserve
SVN_USER=subversion
SVN_GROUP=subversion
SVN_REPO_PATH=/var/local/svn
SVN_FLAGS=\" -d --listen-port=3690 -r\"
# Check that the package is still installed
[ -x \$SVNSERVE ] || exit 0;
case \"\$1\" in
start)
log_begin_msg \"Starting svnserve...\"
umask 002
if start-stop-daemon --start \\
--chuid \$SVN_USER:\$SVN_GROUP \\
--exec \$SVNSERVE \\
--\$SVN_FLAGS \$SVN_REPO_PATH; then
log_end_msg 0
else
log_end_msg \$?
fi
;;
stop)
log_begin_msg \"Stopping svnserve...\"
if start-stop-daemon --stop --exec \$SVNSERVE; then
log_end_msg 0
else
log_end_msg \$?
fi
;;
restart|force-reload)
\"\$0\" stop && \"\$0\" start
;;
*)
echo \"Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}\"
exit 1
;;
esac
exit 0
" > /tmp/svnserve
sudo mv /tmp/svnserve /etc/init.d/svnserve
}
svncpcfg () {
sudo echo "### This file controls the configuration of the svnserve daemon, if you
[general]
### unauthenticated \"write\", \"read\", and \"none\"
anon-access = none
auth-access = write
### password-db
password-db = passwd
### authz-db
#authz-db = authz
### repository name
realm = $1 Repository
" > /tmp/svnserve.conf
sudo mv /tmp/svnserve.conf /var/local/svn/conf/svnserve.conf
sudo chown -R subversion:subversion /var/local/svn/conf/svnserve.conf
sudo echo "### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
user=passuser
user2=pass2user
" > /tmp/passwd
sudo mv /tmp/passwd /var/local/svn/conf/passwd
sudo chown -R subversion:subversion /var/local/svn/conf/passwd
sudo nano /var/local/svn/conf/passwd
sudo echo "### This file is an example authorization file for svnserve.
[groups]
admin = user
entwickler = user,user2
[/]
admin = rw
* =
[marchiv:/]
@entwickler = rw
* =
" > /tmp/authz
sudo mv /tmp/authz /var/local/svn/conf/authz
sudo chown -R subversion:subversion /var/local/svn/conf/authz
}
if [ $1 ]; then
if [ $2 ]; then
svninstall
svnsvnservmake
svnstart
svncpcfg
svnimport $1 $2
else
echo "Quellpfad angeben"
fi
else
echo "Projektname angeben"
fi