23.3. 更新文件組

文件是FreeBSD作業系統不可或缺的一部份。 最新版本的 FreeBSD 文件可以在 FreeBSD 網站取得(http://www.freebsd.org/doc/), 很方便有一份最新的FreeBSD 網站,使用手冊, 常見問答和文章的本地端副本。

這一節描述如何使用原始碼或是 FreeBSD Ports 管理機制將 本地端FreeBSD文件保持最新。

編輯和發佈文件更正的資訊 請參考 FreeBSD 文件計劃新貢獻者入門書 (http://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/).

23.3.1. 從原始碼更新文件

重新從原始碼編譯FreeBSD 文件需要一些不是屬於 FreeBSD 基礎系統的工具 這些需要的工具包括 svn 可以從 textproc/docproj 套件安裝或是 FreeBSD 文件計劃的開發的port

一旦安裝好,請使用 svn 來取得乾淨的文件原始碼副本。 將 https://svn0.us-west.FreeBSD.org 置換成 節 A.4.4, “Subversion Mirror Sites” 裡地理位置和你最近的鏡像站:

# svn checkout https://svn0.us-west.FreeBSD.org/doc/head /usr/doc

第一次下載文件原始碼需要花點時間,請讓他執行完畢

將來文件原始碼更新的取得可以執行:

# svn update /usr/doc

當最新的文件原始碼快照已經抓取到 /usr/doc,一切都已就緒可以對已安裝的文件進行更新。

要完整更新所有語言,可以執行:

# cd /usr/doc
# make install clean

如果只要更新一個特定的語言,可以在 /usr/doc 中特定語言的子目錄執行 make:

# cd /usr/doc/en_US.ISO8859-1
# make install clean

另一個更新文件的方法是在 /usr/doc 或特定語言的子目錄執行:

# make update

輸出格式可以經由設定 FORMATS 來指:

# cd /usr/doc
# make FORMATS='html html-split' install clean

有幾個選項可以使得只要更新部份文件或是建立特定翻譯的過程更加簡易。 這些選項可以在 /etc/make.conf 中設定成整個系統的選項, 或是經由命令列傳送給 make

這些選項包括:

DOC_LANG

要建立或是安裝的語言和編碼清單,例如英文文件用 en_US.ISO8859-1

FORMATS

單一格式或是要建立的輸出格式清單。目前支援 html, html-split, txt, ps, 和 pdf

DOCDIR

安裝文件的位置。預設裝在 /usr/share/doc

更多關於FreeBSD全系統的make 變數, 請參考make.conf(5)

23.3.2. 從 Ports 更新文件

Based on the work of Marc Fonvieille.

前一節說明了從原始碼更新 FreeBSD 文件的方法。本節敘述使用 Ports Collection 的另一種方法:

  • Install pre-built packages of the documentation, without having to locally build anything or install the documentation toolchain.

  • Build the documentation sources through the ports framework, making the checkout and build steps a bit easier.

This method of updating the FreeBSD documentation is supported by a set of documentation ports and packages which are updated by the Documentation Engineering Team on a monthly basis. These are listed in the FreeBSD Ports Collection, under the docs category (http://www.freshports.org/docs/).

Organization of the documentation ports is as follows:

  • The misc/freebsd-doc-en package or port installs all of the English documentation.

  • The misc/freebsd-doc-all meta-package or port installs all documentation in all available languages.

  • There is a package and port for each translation, such as misc/freebsd-doc-hu for the Hungarian documentation.

When binary packages are used, the FreeBSD documentation will be installed in all available formats for the given language. For example, the following command will install the latest package of the Hungarian documentation:

# pkg install hu-freebsd-doc

注意:

Packages use a format that differs from the corresponding port's name: lang-freebsd-doc, where lang is the short format of the language code, such as hu for Hungarian, or zh_cn for Simplified Chinese.

To specify the format of the documentation, build the port instead of installing the package. For example, to build and install the English documentation:

# cd /usr/ports/misc/freebsd-doc-en
# make install clean

The port provides a configuration menu where the format to build and install can be specified. By default, split HTML, similar to the format used on http://www.FreeBSD.org, and PDF are selected.

Alternately, several make options can be specified when building a documentation port, including:

WITH_HTML

Builds the HTML format with a single HTML file per document. The formatted documentation is saved to a file called article.html, or book.html.

WITH_PDF

The formatted documentation is saved to a file called article.pdf or book.pdf.

DOCBASE

Specifies where to install the documentation. It defaults to /usr/local/share/doc/freebsd.

This example uses variables to install the Hungarian documentation as a PDF in the specified directory:

# cd /usr/ports/misc/freebsd-doc-hu
# make -DWITH_PDF DOCBASE=share/doc/freebsd/hu install clean

Documentation packages or ports can be updated using the instructions in 章 4, 軟體套件管理篇:Packages 及 Ports 機制. For example, the following command updates the installed Hungarian documentation using ports-mgmt/portmaster by using packages only:

# portmaster -PP hu-freebsd-doc

本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/

若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢 <questions@FreeBSD.org>。

關於本文件的問題,請洽詢 <doc@FreeBSD.org>。