Lines 1-4
Link Here
|
1 |
#!/usr/bin/env ruby |
1 |
#!%%LOCALBASE%%/bin/ruby |
2 |
# |
2 |
# |
3 |
# tdiaryinstall.rb - tDiary user directory copy script |
3 |
# tdiaryinstall.rb - tDiary user directory copy script |
4 |
# Date created: 13 July 2003 |
4 |
# Date created: 13 July 2003 |
Lines 141-162
Link Here
|
141 |
if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images") |
141 |
if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images") |
142 |
FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images", @fileutilOptions) |
142 |
FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images", @fileutilOptions) |
143 |
end |
143 |
end |
|
|
144 |
if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tmp") |
145 |
FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tmp", @fileutilOptions) |
146 |
end |
144 |
end |
147 |
end |
145 |
|
148 |
|
146 |
def linkBaseFile |
149 |
def linkBaseFile |
|
|
150 |
FileUtils.ln_s("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", @fileutilOptions) |
151 |
FileUtils.ln_s("#{@tdiarymaster}/Gemfile", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
152 |
FileUtils.ln_s("#{@tdiarymaster}/app.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
153 |
FileUtils.ln_s("#{@tdiarymaster}/benchmark", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
154 |
FileUtils.ln_s("#{@tdiarymaster}/bin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
155 |
FileUtils.ln_s("#{@tdiarymaster}/index.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
156 |
FileUtils.ln_s("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
147 |
FileUtils.ln_s("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
157 |
FileUtils.ln_s("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
|
|
158 |
FileUtils.ln_s("#{@tdiarymaster}/lib", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
159 |
FileUtils.ln_s("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
160 |
FileUtils.ln_s("#{@tdiarymaster}/package.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
148 |
FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
161 |
FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
149 |
FileUtils.ln_s("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", @fileutilOptions) |
162 |
FileUtils.ln_s("#{@tdiarymaster}/update.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
150 |
tempfile = Tempfile.new("index.rb") |
163 |
FileUtils.ln_s("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
151 |
tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/index'\n" |
164 |
FileUtils.ln_s("#{@tdiarymaster}/views", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
152 |
tempfile.close |
|
|
153 |
FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
154 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
155 |
tempfile = Tempfile.new("update.rb") |
156 |
tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/update'\n" |
157 |
tempfile.close |
158 |
FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
159 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
160 |
end |
165 |
end |
161 |
|
166 |
|
162 |
def copyBaseFile |
167 |
def copyBaseFile |
Lines 163-179
Link Here
|
163 |
opts = @fileutilOptions.dup |
168 |
opts = @fileutilOptions.dup |
164 |
opts.store(:preserve, true) |
169 |
opts.store(:preserve, true) |
165 |
FileUtils.cp_r("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", opts) |
170 |
FileUtils.cp_r("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", opts) |
|
|
171 |
FileUtils.cp("#{@tdiarymaster}/Gemfile", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
172 |
FileUtils.cp("#{@tdiarymaster}/app.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
173 |
FileUtils.cp_r("#{@tdiarymaster}/benchmark", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
174 |
FileUtils.cp_r("#{@tdiarymaster}/bin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
175 |
FileUtils.cp("#{@tdiarymaster}/index.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
176 |
FileUtils.cp("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
166 |
FileUtils.cp_r("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
177 |
FileUtils.cp_r("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
|
|
178 |
FileUtils.cp_r("#{@tdiarymaster}/lib", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
167 |
FileUtils.cp_r("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
179 |
FileUtils.cp_r("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
168 |
FileUtils.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
180 |
FileUtils.cp("#{@tdiarymaster}/package.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
169 |
FileUtils.cp_r("#{@tdiarymaster}/skel", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
|
|
170 |
FileUtils.cp_r("#{@tdiarymaster}/tdiary", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
171 |
FileUtils.cp_r("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
181 |
FileUtils.cp_r("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
172 |
FileUtils.cp("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
182 |
FileUtils.cp("#{@tdiarymaster}/update.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
173 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
183 |
FileUtils.cp("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
174 |
FileUtils.cp("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
184 |
FileUtils.cp_r("#{@tdiarymaster}/views", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) |
175 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
|
|
176 |
FileUtils.cp("#{@tdiarymaster}/tdiary.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.rb", @fileutilOptions) |
177 |
end |
185 |
end |
178 |
|
186 |
|
179 |
def installConfig |
187 |
def installConfig |
Lines 206-220
Link Here
|
206 |
end |
214 |
end |
207 |
|
215 |
|
208 |
def setPermissions |
216 |
def setPermissions |
209 |
FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) if ! defined?($OPT_SUEXEC) |
217 |
if (defined?($OPT_SUEXEC)) |
210 |
FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) if ! defined?($OPT_SUEXEC) |
218 |
FileUtils.chmod(0701, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) |
|
|
219 |
FileUtils.chmod(0701, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
220 |
FileUtils.chmod(0604, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) |
221 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.fcgi", @fileutilOptions) |
222 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
223 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.fcgi", @fileutilOptions) |
224 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
225 |
else |
226 |
FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) |
227 |
FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) |
228 |
FileUtils.chmod(0644, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) |
229 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.fcgi", @fileutilOptions) |
230 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) |
231 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.fcgi", @fileutilOptions) |
232 |
FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) |
233 |
end |
234 |
FileUtils.chmod(0644, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", @fileutilOptions) |
211 |
|
235 |
|
212 |
FileUtils.chmod(0701, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) if defined?($OPT_SUEXEC) |
|
|
213 |
FileUtils.chmod(0701, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) if defined?($OPT_SUEXEC) |
214 |
FileUtils.chmod(0604, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) if defined?($OPT_SUEXEC) |
215 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) if defined?($OPT_SUEXEC) |
216 |
FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) if defined?($OPT_SUEXEC) |
217 |
|
218 |
if @euid == 0 then |
236 |
if @euid == 0 then |
219 |
Find.find("#{@passwd.dir}/#{@diarydir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}") do |f| |
237 |
Find.find("#{@passwd.dir}/#{@diarydir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}") do |f| |
220 |
File.chown(@passwd.uid, @passwd.gid, f) |
238 |
File.chown(@passwd.uid, @passwd.gid, f) |