diff options
Diffstat (limited to 'www/tdiary/files')
-rw-r--r-- | www/tdiary/files/tdiaryinst.rb.in | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/www/tdiary/files/tdiaryinst.rb.in b/www/tdiary/files/tdiaryinst.rb.in index e2b38be89095..b24b7b2b8ed7 100644 --- a/www/tdiary/files/tdiaryinst.rb.in +++ b/www/tdiary/files/tdiaryinst.rb.in @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby +#!%%LOCALBASE%%/bin/ruby # # tdiaryinstall.rb - tDiary user directory copy script # Date created: 13 July 2003 @@ -141,39 +141,47 @@ class TdiaryInstall if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images") FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/images", @fileutilOptions) end + if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tmp") + FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tmp", @fileutilOptions) + end end def linkBaseFile + FileUtils.ln_s("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/Gemfile", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/app.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/benchmark", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/bin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/index.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) FileUtils.ln_s("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/lib", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/package.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) - FileUtils.ln_s("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", @fileutilOptions) - tempfile = Tempfile.new("index.rb") - tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/index'\n" - tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) - tempfile = Tempfile.new("update.rb") - tempfile.write "#!/usr/local/bin/ruby\nrequire '#{@tdiarymaster}/update'\n" - tempfile.close - FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/update.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.ln_s("#{@tdiarymaster}/views", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) end def copyBaseFile opts = @fileutilOptions.dup opts.store(:preserve, true) FileUtils.cp_r("#{@tdiarydocdir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/doc", opts) + FileUtils.cp("#{@tdiarymaster}/Gemfile", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.cp("#{@tdiarymaster}/app.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.cp_r("#{@tdiarymaster}/benchmark", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) + FileUtils.cp_r("#{@tdiarymaster}/bin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) + FileUtils.cp("#{@tdiarymaster}/index.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.cp("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) FileUtils.cp_r("#{@tdiarymaster}/js", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) + FileUtils.cp_r("#{@tdiarymaster}/lib", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) FileUtils.cp_r("#{@tdiarymaster}/misc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) - FileUtils.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) - FileUtils.cp_r("#{@tdiarymaster}/skel", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) - FileUtils.cp_r("#{@tdiarymaster}/tdiary", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) + FileUtils.cp("#{@tdiarymaster}/package.json", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) FileUtils.cp_r("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) - FileUtils.cp("#{@tdiarymaster}/index.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) - FileUtils.cp("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) - FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) - FileUtils.cp("#{@tdiarymaster}/tdiary.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.rb", @fileutilOptions) + FileUtils.cp("#{@tdiarymaster}/update.fcgi", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.cp("#{@tdiarymaster}/update.rb", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.cp_r("#{@tdiarymaster}/views", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", opts) end def installConfig @@ -206,14 +214,24 @@ class TdiaryInstall end def setPermissions - FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) if ! defined?($OPT_SUEXEC) - FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) if ! defined?($OPT_SUEXEC) - - FileUtils.chmod(0701, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) if defined?($OPT_SUEXEC) - FileUtils.chmod(0701, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) if defined?($OPT_SUEXEC) - FileUtils.chmod(0604, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) if defined?($OPT_SUEXEC) - FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) if defined?($OPT_SUEXEC) - FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) if defined?($OPT_SUEXEC) + if (defined?($OPT_SUEXEC)) + FileUtils.chmod(0701, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) + FileUtils.chmod(0701, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.chmod(0604, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) + FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.fcgi", @fileutilOptions) + FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) + FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.fcgi", @fileutilOptions) + FileUtils.chmod(0700, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) + else + FileUtils.chmod(0777, "#{@passwd.dir}/#{@diarydir}", @fileutilOptions) + FileUtils.chmod(0777, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", @fileutilOptions) + FileUtils.chmod(0644, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", @fileutilOptions) + FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.fcgi", @fileutilOptions) + FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/index.rb", @fileutilOptions) + FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.fcgi", @fileutilOptions) + FileUtils.chmod(0755, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/update.rb", @fileutilOptions) + end + FileUtils.chmod(0644, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", @fileutilOptions) if @euid == 0 then Find.find("#{@passwd.dir}/#{@diarydir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}") do |f| |