##// END OF EJS Templates
change owner rights to work with mod_perl authentication. add a test option that just connect to WS and say what should be done...
Nicolas Chuche -
r898:d6e8121ef1bd
parent child
Show More
@@ -37,6 +37,8
37 37 # -u file:///var/svn/ # if the repository is local
38 38 # if this option isn't set, reposman won't register the repository
39 39 #
40 # -t, --test
41 # only show what should be done
40 42 #
41 43 # -h, --help:
42 44 # show help and exit
@@ -64,6 +66,7 opts = GetoptLong.new(
64 66 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
65 67 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
66 68 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
69 ['--test', '-t', GetoptLong::NO_ARGUMENT],
67 70 ['--verbose', '-v', GetoptLong::NO_ARGUMENT],
68 71 ['--version', '-V', GetoptLong::NO_ARGUMENT],
69 72 ['--help' , '-h', GetoptLong::NO_ARGUMENT],
@@ -76,6 +79,7 $redmine_host = ''
76 79 $repos_base = ''
77 80 $svn_owner = 'root'
78 81 $svn_url = false
82 $test = false
79 83
80 84 def log(text,level=0, exit=false)
81 85 return if $quiet or level > $verbose
@@ -91,6 +95,7 begin
91 95 when '--owner'; $svn_owner = arg.dup
92 96 when '--url'; $svn_url = arg.dup
93 97 when '--verbose'; $verbose += 1
98 when '--test'; $test = true
94 99 when '--version'; puts Version; exit
95 100 when '--help'; RDoc::usage
96 101 when '--quiet'; $quiet = true
@@ -100,6 +105,10 rescue
100 105 exit 1
101 106 end
102 107
108 if $test
109 log("running in test mode")
110 end
111
103 112 $svn_url += "/" if $svn_url and not $svn_url.match(/\/$/)
104 113
105 114 if ($redmine_host.empty? or $repos_base.empty?)
@@ -136,7 +145,7 def set_owner_and_rights(project, repos_path, &block)
136 145 yield if block_given?
137 146 else
138 147 uid, gid = Etc.getpwnam($svn_owner).uid, Etc.getgrnam(project.identifier).gid
139 right = project.is_public ? 0575 : 0570
148 right = project.is_public ? 0775 : 0770
140 149 yield if block_given?
141 150 Find.find(repos_path) do |f|
142 151 File.chmod right, f
@@ -176,6 +185,11 projects.each do |project|
176 185 owner = owner_name(repos_path)
177 186 next if project.is_public == other_read and owner == $svn_owner
178 187
188 if $test
189 log("\tchange mode on #{repos_path}")
190 next
191 end
192
179 193 begin
180 194 set_owner_and_rights(project, repos_path)
181 195 rescue Errno::EPERM => e
@@ -186,7 +200,13 projects.each do |project|
186 200 log("\tmode change on #{repos_path}");
187 201
188 202 else
189 project.is_public ? File.umask(0202) : File.umask(0207)
203 project.is_public ? File.umask(0002) : File.umask(0007)
204
205 if $test
206 log("\tcreate repository #{repos_path}")
207 log("\trepository #{repos_path} registered in Redmine with url #{$svn_url}#{project.identifier}") if $svn_url;
208 next
209 end
190 210
191 211 begin
192 212 set_owner_and_rights(project, repos_path) do
General Comments 0
You need to be logged in to leave comments. Login now