Bug 55000 - Update ports: www/tdiary
Summary: Update ports: www/tdiary
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-29 03:20 UTC by jfkimura
Modified: 2003-07-29 06:53 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jfkimura 2003-07-29 03:20:12 UTC
	Update ports: www/tdiary to 1.5.4_3
	   - Change of an installation script
	   - add RUBY_SHEBANG_FILES to Makefile

Fix: --- patch begin here ---


Fumihiko Kimura <jfkimura@yahoo.co.jp>--1iQzWFBLkd8e59MglNhu2WfnfpT67UkzrHIzzE3jWlLXzxGP
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

diff -urN /usr/ports/www/tdiary/Makefile /usr/ports/www/tdiary-stable/Makefile
--- /usr/ports/www/tdiary/Makefile	Tue Jul 22 06:31:20 2003
+++ /usr/ports/www/tdiary-stable/Makefile	Mon Jul 28 16:42:50 2003
@@ -7,7 +7,7 @@
 
 PORTNAME=	tdiary
 PORTVERSION=	1.5.4
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www ruby
 MASTER_SITES=	\
 		${MASTER_SITE_SOURCEFORGE} \
@@ -27,6 +27,8 @@
 
 NO_BUILD=	yes
 USE_RUBY=	yes
+RUBY_SHEBANG_FILES=	index.rb update.rb misc/convert2.rb misc/posttdiary.rb misc/plugin/squeeze.rb misc/plugin/weather.rb \
+misc/plugin/windex.rb misc/plugin/a/a_conf.rb misc/plugin/todo/todo.rb misc/plugin/trackback/tb.rb
 
 TDIARYDIR=	${PREFIX}/share/examples/${PORTNAME}
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
@@ -47,8 +49,11 @@
 	@${ECHO_MSG}
 
 do-install:
-	@if [ -d ${TDIARYDIR} ]; then ${RM} -rf ${TDIARYDIR}; fi
-	${MKDIR} ${TDIARYDIR}
+#	@if [ -d ${TDIARYDIR} ]; then ${RM} -rf ${TDIARYDIR}; fi
+	-${MKDIR} ${TDIARYDIR}
+	@${SED} -e 's,@@@@PREFIX@@@@,${PREFIX},g' \
+		-e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \
+		${FILESDIR}/tdiaryinst.rb.in > ${TDIARYDIR}/tdiaryinst.rb
 	@${SED} -e 's,@@@@PREFIX@@@@,${PREFIX},g' \
 		-e 's,@@@@LANG@@@@,${TDIARY_LANG},g' \
 		${FILESDIR}/tdiary-FreeBSD.sh.in > ${TDIARYDIR}/tdiary-FreeBSD.sh
diff -urN /usr/ports/www/tdiary/README.html /usr/ports/www/tdiary-stable/README.html
--- /usr/ports/www/tdiary/README.html	Thu Jan  1 09:00:00 1970
+++ /usr/ports/www/tdiary-stable/README.html	Mon Jul 28 01:10:30 2003
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
+
+<html>
+  <head>
+    <title>The FreeBSD Ports Collection (www/tdiary)</title>
+  </head>
+
+  <body>
+    <h1>The FreeBSD Ports Collection (www/tdiary)</h1>
+    <hr>
+
+    <p>You are now in the directory for the port "www/tdiary".</p>
+
+    <p>The package name of this port is "tdiary-1.5.4_3".</p>
+
+    <p>This is the one-line description for this port:</p>
+    <hr>
+
+    <p>
+A Web-based diary system (like weblog) written in Ruby
+    </p>
+    <hr>
+
+    <p>Please read the "<a href="pkg-descr">description file</a>" for a
+    longer description and/or visit the <a href="http://www.tdiary.org/">web site</a> for futher informations.</p>
+
+    <p>If needed, you may contact the <a href=
+    "mailto:jfkimura@yahoo.co.jp">maintainer</a> of this port or the port <a href=
+    "mailto:ports@FreeBSD.org">mailing-list</a>.</p>
+
+    <p>This port requires package(s) "" to build.</p>
+
+    <p>This port requires package(s) "" to run.</p>
+
+    <p>Go to the <a href="../../README.html">top of the ports tree</a> for
+    a summary on how to use the ports collection.</p>
+    <hr>
+
+    <p><a href="../README.html">Go up one level</a> | <a href=
+    "../../README.html">Go to top of ports tree</a></p>
+  </body>
+</html>
+
diff -urN /usr/ports/www/tdiary/files/tdiaryinst.rb.in /usr/ports/www/tdiary-stable/files/tdiaryinst.rb.in
--- /usr/ports/www/tdiary/files/tdiaryinst.rb.in	Thu Jan  1 09:00:00 1970
+++ /usr/ports/www/tdiary-stable/files/tdiaryinst.rb.in	Tue Jul 29 10:32:08 2003
@@ -0,0 +1,253 @@
+#!/usr/local/bin/ruby
+#
+# tdiaryinstall.rb - tDiary user directory copy script
+# Date created:			13 July 2003
+# Whom:				KAMIYA Satosi  <mimoriso@anet.ne.jp>
+#
+# $FreeBSD$
+#
+
+require 'getoptlong'
+require 'etc.so'
+require 'fileutils'
+require 'find'
+require 'tempfile'
+
+# make install»þ¤ËÃÖ´¹¤µ¤ì¤ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô --tdiarymaster, --lang ¥ª¥×¥·¥ç¥ó¤Ç¾å½ñ¤­²Äǽ
+$OPT_TDIARYMASTER = "@@@@PREFIX@@@@/share/examples/tdiary"
+$OPT_LANG         = '@@@@LANG@@@@'
+
+def usage
+  STDERR.print "Usage: #{File.basename($0)} [options]\n"
+  STDERR.print "Options:\n"
+  STDERR.print "    --help                    Display this information\n"
+  STDERR.print "    --user=<username>         Specify user's login name\n"
+  STDERR.print "    --diarydir=<diarydir>     Specify tDiary data directory default: diary\n"
+  STDERR.print "    --httpdir=<httpdir>       Specify apache UserDirectory  default: public_html\n"
+  STDERR.print "    --name=<author_name>      Specify author name\n"
+  STDERR.print "    --mail=<author_mail>      Specify author mail address\n"
+  STDERR.print "    --tdiarymaster=<dir>      Specify tDiary master directory default: @@@@PREFIX@@@@/share/examples/tdiary\n"
+  STDERR.print "    --lang=<language>         Specify your language ('en' or 'ja') default: @@@@LANG@@@@\n"
+  STDERR.print "    --suexec                  Use suExec for CGI execution\n"
+  STDERR.print "    --symlink                 Use symbolic link for tDiary master files\n"
+  STDERR.print "    --quiet                   Do not display any information\n"
+  STDERR.print "    --noop                    Do not install any file. Use this option with --verbose\n"
+  STDERR.print "    --verbose                 Verbose; display verbose debugging messages.\n"
+  exit 1
+end
+
+# °ú¿ô¤Î²òÀÏ
+parser = GetoptLong.new
+parser.set_options(
+  ['--user',    '-u', GetoptLong::REQUIRED_ARGUMENT],
+  ['--diarydir','-d', GetoptLong::REQUIRED_ARGUMENT],
+  ['--httpdir' ,'-h', GetoptLong::REQUIRED_ARGUMENT],
+  ['--name',    '-n', GetoptLong::REQUIRED_ARGUMENT],
+  ['--mail',    '-m', GetoptLong::REQUIRED_ARGUMENT],
+  ['--tdiarymaster' , GetoptLong::REQUIRED_ARGUMENT],
+  ['--lang'         , GetoptLong::REQUIRED_ARGUMENT],
+  ['--suexec'       , GetoptLong::NO_ARGUMENT],
+  ['--symlink', '-l', GetoptLong::NO_ARGUMENT],
+  ['--quiet',   '-q', GetoptLong::NO_ARGUMENT],
+  ['--noop'         , GetoptLong::NO_ARGUMENT],
+  ['--verbose'      , GetoptLong::NO_ARGUMENT],
+  ['--help'         , GetoptLong::NO_ARGUMENT])
+begin
+  parser.each_option do |name, arg|
+    eval "$OPT_#{name.sub(/^--/, '').gsub(/-/, '_').upcase} = '#{arg}'"
+  end
+rescue
+  raise "getoptlong"
+end
+usage() if defined?($OPT_HELP)
+
+class TdiaryInstall
+  attr_accessor :tdiarymaster
+  attr_accessor :tdconfig
+  attr_accessor :lang
+  attr_reader   :euid # tdiaryinstall¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥æ¡¼¥¶ID
+  attr_accessor :username
+  attr_accessor :diarydir
+  attr_accessor :httpdir
+  attr_reader   :passwd
+  attr_accessor :fileutilOptions
+  attr_accessor :author_name
+  attr_accessor :author_mail
+  attr_accessor :author_host
+  def initialize # ½é´üÃͤÎÀßÄê
+    @passwd   = Etc.getpwuid() # ½é´üÃÍ¤Ï¥í¥°¥¤¥ó¥æ¡¼¥¶
+    @euid     = @passwd.uid
+    @username = (@passwd.name) # username=(value) ¥á¥½¥Ã¥É¤ÇºÆÄêµÁ¤·¤Æ¤¤¤ë
+    @diarydir = 'diary'
+    @httpdir  = 'public_html'
+    @fileutilOptions = []
+    @author_name = @passwd.gecos # F.Kimura
+    @author_host = "#{`hostname`.chomp}" # F.Kimura
+    @author_mail = "#{@username}@#{`hostname`.chomp}"
+  end
+
+  def username=(value) # username ¤òÂåÆþ¤¹¤ëºÝ¤Ë passwd¥á¥ó¥ÐÊÑ¿ô¤â¹¹¿·¤¹¤ë
+    @username = value
+    @passwd = Etc.getpwnam(@username) # getpwnam(3) ¤Ë¤è¤ê passwd ¹½Â¤ÂΤò¼èÆÀ¤¹¤ë
+    # ¥æ¡¼¥¶Ì¾¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç¡¢Etc.getpwnam() ¤ÏÎã³°¤òȯÀ¸¤¹¤ë¡£
+    @author_name = @passwd.gecos
+    @author_mail = "#{@username}@#{`hostname`.chomp}"
+  end
+
+  def lang=(value)
+    case value
+    when 'tdiary.conf-en' , 'en'
+      @lang = 'en'
+      @tdconfig = 'tdiary.conf-en'
+    when 'tdiary.conf-ja' , 'ja'
+      @lang = 'ja'
+      @tdconfig = 'tdiary.conf-ja'
+    else
+      raise "Unknown Language : #{value}"
+    end
+  end
+
+  def installAll
+    raise "You can not use tDiary for superuser." if @passwd.uid == 0
+
+    echo "************************************************************\n"
+    echo "Starting tDiary for FreeBSD  user directory installation ...\n"
+    prepareDirs()
+
+    echo "Copy tDiary ...\n"
+    if $OPT_SYMLINK then
+      linkBaseFile()
+    else
+      copyBaseFile()
+    end
+
+    installConfig()
+    setPermissions() if ! defined?($OPT_NOOP)
+
+    echo "***\n"
+    echo "You have to execute the following commands:\n"
+    echo "    % /usr/local/sbin/htpasswd -c #{@passwd.dir}/.htpasswd #{@username}\n\n"
+    echo "Please read #{@tdiarymaster}/README\n"
+    echo "    for additional information.\n"
+    echo "************************************************************\n"
+  end
+
+  def prepareDirs
+    # ¥¤¥ó¥¹¥È¡¼¥ëÀè¥Ç¥£¥ì¥¯¥È¥ê¤ÎÍÑ°Õ
+    if ! FileTest.exist?("#{@passwd.dir}/#{@diarydir}")
+      FileUtils.mkdir_p("#{@passwd.dir}/#{@diarydir}", *@fileutilOptions)
+    end
+    if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}")
+      FileUtils.mkdir_p("#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
+    end
+  end
+
+  def linkBaseFile # tDiary¤ÎÇÛÉÛ¥Õ¥¡¥¤¥ë¤Ï¥³¥Ô¡¼¤·¤Ê¤¤
+    FileUtils.cp_r("#{@tdiarymaster}/plugin", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+    FileUtils.ln_s("#{@tdiarymaster}/theme", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@fileutilOptions)
+    FileUtils.ln_s("#{@tdiarymaster}/doc", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", *@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)
+  end
+
+  def copyBaseFile # tDiary¤ÎÇÛÉÛ¥Õ¥¡¥¤¥ë¤ò¤¹¤Ù¤Æ¥³¥Ô¡¼
+    FileUtils.cp_r("#{@tdiarymaster}/", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}", :preserve, *@fileutilOptions)
+  end
+
+  def installConfig
+    # ÀßÄê¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë
+    tempfile = Tempfile.new("tdiary.conf-ja") # ÆüËܸì´Ä¶­¥µ¥ó¥×¥ë
+    tempfile.write tdiaryConfReplace("#{@tdiarymaster}/tdiary.conf.sample")
+    tempfile.close
+    FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-ja", *@fileutilOptions)
+
+    tempfile = Tempfile.new("tdiary.conf-en") # sample configuration for English Environment
+    tempfile.write tdiaryConfReplace("#{@tdiarymaster}/misc/i18n/tdiary.conf.sample-en")
+    tempfile.close
+    FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf-en", *@fileutilOptions)
+
+    if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf") # tdiary.conf ¤¬¤Ê¤±¤ì¤ÐÀßÃÖ
+      FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/#{@tdconfig}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary.conf", *@fileutilOptions)
+    end
+    # TODO: @lang¤ÎÃͤˤè¤Ã¤Æ plugin/00lang.en.rb ¥³¥Ô¡¼/ºï½ü¤ÎÀ©¸æ¤â¤·¤¿¤¤
+
+    tempfile = Tempfile.new("dot.htaccess")
+    tempfile.write dothtaccessReplace("#{@tdiarymaster}/dot.htaccess")
+    tempfile.close
+    FileUtils.cp(tempfile.path, "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", *@fileutilOptions)
+    if ! FileTest.exist?("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess")
+      FileUtils.cp("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/dot.htaccess", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}/.htaccess", *@fileutilOptions)
+    end
+  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.rm("#{@passwd.dir}/#{@httpdir}/#{@diarydir}/tdiary-FreeBSD.sh", :force, *@fileutilOptions)
+
+    if @euid == 0 then # superuser ¸¢¸Â¤Ç¤³¤Î¥¤¥ó¥¹¥È¡¼¥é¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¾ì¹ç
+      # ¤¹¤Ù¤Æ¤Î¥Ç¥£¥ì¥¯¥È¥ê¡¦¥Õ¥¡¥¤¥ë¤Ë chown ¤Ç½êÍ­¼ÔÊѹ¹
+      Find.find("#{@passwd.dir}/#{@diarydir}", "#{@passwd.dir}/#{@httpdir}/#{@diarydir}") do |f|
+        File.chown(@passwd.uid, @passwd.gid, f)
+      end
+      if File::Stat.new("#{@passwd.dir}/#{@httpdir}").uid == 0 # ~/public_html ¤Î¥ª¡¼¥Ê¡¼¤¬superuser
+        File.chown(@passwd.uid, @passwd.gid, "#{@passwd.dir}/#{@httpdir}")
+      end
+    end
+  end
+
+  def echo(s) # --quiet ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¥á¥Ã¥»¡¼¥¸¤ò½ÐÎϤ¹¤ë
+    STDOUT.print s if ! defined?($OPT_QUIET)
+  end
+
+  def tdiaryConfReplace(filename) # ¥µ¥ó¥×¥ë tdiary.conf ¤ò½ñ¤­´¹¤¨¤ë¥á¥½¥Ã¥É
+    s = ''
+    File.open(filename) { |fp|
+      fp.each { |line|
+        line = "@data_path = '#{@passwd.dir}/#{@diarydir}'\n" if line =~ /^\@data_path\s/
+        line = "@author_name = '#{@author_name}'\n" if line =~ /^\@author_name\s/
+        line = "@author_mail = '#{@author_mail}'\n" if line =~ /^\@author_mail\s/
+        line = "@html_title = '#{@author_name} diary'\n" if line =~ /^\@html_title\s/
+        line = "@index_page = 'http://#{@author_host}/~#{@username}\/'" if line =~ /^\@index_page\s/ # F.Kimura
+        s += line
+      }
+    }
+    s
+  end
+
+  def dothtaccessReplace(filename) # ¥µ¥ó¥×¥ë dot.htaccess ¤ò½ñ¤­´¹¤¨¤ë¥á¥½¥Ã¥É
+    s = ''
+    File.open(filename) { |fp|
+      fp.each { |line|
+        line = "\tAuthUserFile  #{@passwd.dir}/.htpasswd\n" if line =~ /^\s*AuthUserFile\s/
+        line = "\tRequire user  #{@username}\n" if line =~ /^\s*Require user\s/
+        line = "Options +FollowSymLinks\n" if line =~ /^\#Options \+FollowSymLinks/ && $OPT_SYMLINK
+        s += line
+      }
+    }
+    s
+  end
+end
+
+tdiaryinst = TdiaryInstall.new
+tdiaryinst.tdiarymaster = $OPT_TDIARYMASTER
+tdiaryinst.lang = $OPT_LANG
+tdiaryinst.username = $OPT_USER if defined?($OPT_USER) # $OPT_NAME¤ÎÀßÄê¤è¤êÁ°¤Ç¤Ê¤¤¤È¤¤¤±¤Ê¤¤
+tdiaryinst.diarydir = $OPT_DIARYDIR if defined?($OPT_DIARYDIR)
+tdiaryinst.httpdir = $OPT_HTTPDIR if defined?($OPT_HTTPDIR)
+tdiaryinst.author_name = $OPT_NAME if defined?($OPT_NAME)
+tdiaryinst.author_mail = $OPT_MAIL if defined?($OPT_MAIL)
+tdiaryinst.fileutilOptions.push(:noop) if defined?($OPT_NOOP)
+tdiaryinst.fileutilOptions.push(:verbose) if defined?($OPT_VERBOSE)
+
+tdiaryinst.installAll
+
+exit 0
diff -urN /usr/ports/www/tdiary/pkg-message /usr/ports/www/tdiary-stable/pkg-message
--- /usr/ports/www/tdiary/pkg-message	Tue Jul 22 06:31:20 2003
+++ /usr/ports/www/tdiary-stable/pkg-message	Mon Jul 28 00:53:03 2003
@@ -1,17 +1,17 @@
 
 =============================================================================
 There is a script to install tDiary in a user directory.
-You can run the script manually as
+This script should be run manually.
 
-  # @@@@PREFIX@@@@/share/examples/tdiary/tdiary-FreeBSD.sh USERid
-    or
-  % @@@@PREFIX@@@@/share/examples/tdiary/tdiary-FreeBSD.sh install
-
-There is a document in English under the following directory.
+  # ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb --user=hoge
+   or
+  % ruby @@@@PREFIX@@@@/share/examples/tdiary/tdiaryinst.rb
 
+There is a document by English in the following directories.
+  See ...
   @@@@PREFIX@@@@/share/examples/tdiary/misc/i18n/
-
-And, you can find information on the tdiary system at :
+   and
+  Explanation by English of a tDiary system can refer to the following page :
 
   http://tdiary-users.sourceforge.jp/cgi-bin/wiki.cgi?FrontPage_en
 =============================================================================
diff -urN /usr/ports/www/tdiary/pkg-plist /usr/ports/www/tdiary-stable/pkg-plist
--- /usr/ports/www/tdiary/pkg-plist	Thu Jul 10 15:24:23 2003
+++ /usr/ports/www/tdiary-stable/pkg-plist	Mon Jul 28 00:51:21 2003
@@ -1 +1,2 @@
+share/examples/tdiary/tdiaryinst.rb
 share/examples/tdiary/tdiary-FreeBSD.sh
--- patch end here ---
Comment 1 Daichi GOTO freebsd_committer freebsd_triage 2003-07-29 06:53:39 UTC
State Changed
From-To: open->closed

Committed. Thanks!