Translation

(itstool) path: listitem/para

<literal>cust_install_files</literal> — Installs files from the <filename>nanobsd/Files</filename> directory, which contains some useful scripts for system administration.
102/1710
Context English Chinese (Simplified) (zh_CN) State
<literal>NANO_NAME</literal> — Name of build (used to construct the workdir names). <literal>NANO_NAME</literal> ── 本次构建的名称 (用于创建工作目录的名字)。
<literal>NANO_SRC</literal> — Path to the source tree used to build the image. <literal>NANO_SRC</literal> ── 用以联编和构建映像的源码树的位置。
<literal>NANO_KERNEL</literal> — Name of kernel configuration file used to build kernel. <literal>NANO_KERNEL</literal> ── 用以联编内核的配置文件的名字。
<literal>CONF_BUILD</literal> — Options passed to the <_:buildtarget-1/> stage of the build. <literal>CONF_BUILD</literal> ── 用于传递给 <_:buildtarget-1/> 构建阶段的选项。
<literal>CONF_INSTALL</literal> — Options passed to the <_:buildtarget-1/> stage of the build. <literal>CONF_INSTALL</literal> ── 用于传递给 <_:buildtarget-1/> 构建阶段的选项。
<literal>CONF_WORLD</literal> — Options passed to both the <_:buildtarget-1/> and the <_:buildtarget-2/> stage of the build. <literal>CONF_WORLD</literal> ── 用以传递给 <_:buildtarget-1/> 和 <_:buildtarget-2/> 这两个构建阶段的选项。
<literal>FlashDevice</literal> — Defines what type of media to use. Check <filename>FlashDevice.sub</filename> for more details. <literal>FlashDevice</literal> ── 定义所用的介质类型。 要了解进一步的细节, 请参考 <filename>FlashDevice.sub</filename> 文件。
Custom Functions 功能定制
It is possible to fine-tune <application>NanoBSD</application> using shell functions in the configuration file. The following example illustrates the basic model of custom functions: 通过在配置文件中使用 shell 函数可以进一步微调 <application>NanoBSD</application>。 下面的例子展示了定制函数的基本模式:
cust_foo () (
echo "bar=baz" &gt; \
${NANO_WORLDDIR}/etc/foo
)
customize_cmd cust_foo
cust_foo () (
echo "bar=baz" &gt; \
${NANO_WORLDDIR}/etc/foo
)
customize_cmd cust_foo
A more useful example of a customization function is the following, which changes the default size of the <filename>/etc</filename> directory from 5MB to 30MB: 下面是一个更贴近实际的例子, 它将默认的 <filename>/etc</filename> 目录尺寸, 从 5MB 调整为 30MB:
cust_etc_size () (
cd ${NANO_WORLDDIR}/conf
echo 30000 &gt; default/etc/md_size
)
customize_cmd cust_etc_size
cust_etc_size () (
cd ${NANO_WORLDDIR}/conf
echo 30000 &gt; default/etc/md_size
)
customize_cmd cust_etc_size
There are a few default pre-defined customization functions ready for use: 除此之外, 还有几个默认的预定义定制函数:
<literal>cust_comconsole</literal> — Disables <citerefentry><refentrytitle>getty</refentrytitle><manvolnum>8</manvolnum></citerefentry> on the VGA devices (the <filename>/dev/ttyv*</filename> device nodes) and enables the use of the COM1 serial port as the system console. <literal>cust_comconsole</literal> ── 在 VGA 设备上禁止 <citerefentry><refentrytitle>getty</refentrytitle><manvolnum>8</manvolnum></citerefentry> (<filename>/dev/ttyv*</filename> 设备节点) 并启用串口 COM1 作为系统控制台。
<literal>cust_allow_ssh_root</literal> — Allow <systemitem class="username">root</systemitem> to login via <citerefentry><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry>. <literal>cust_allow_ssh_root</literal> ── 允许 <systemitem class="username">root</systemitem> 通过 <citerefentry><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry> 登录。
<literal>cust_install_files</literal> — Installs files from the <filename>nanobsd/Files</filename> directory, which contains some useful scripts for system administration. <literal>cust_install_files</literal> ── 从 <filename>nanobsd/Files</filename> 目录中安装文件, 这包含一些实用的系统管理脚本。
Adding Packages 安装预编译软件包
Packages can be added to a <application>NanoBSD</application> image using a custom function. The following function will install all the packages located in <filename>/usr/src/tools/tools/nanobsd/packages</filename>: 通过增加自定义的函数, 可以在 <application>NanoBSD</application> 增加预编译的软件包。 下面的函数会添加位于 <filename>/usr/src/tools/tools/nanobsd/packages</filename> 的全部预编译软件包:
install_packages () (
mkdir -p ${NANO_WORLDDIR}/packages
cp /usr/src/tools/tools/nanobsd/packages/* ${NANO_WORLDDIR}/packages
cp $(which pkg-static) ${NANO_WORLDDIR}/
chroot ${NANO_WORLDDIR} sh -c 'cd packages; /pkg-static add *;cd ..;'
rm -rf ${NANO_WORLDDIR}/packages ${NANO_WORLDDIR}/pkg-static
)
customize_cmd install_packages
install_packages () (
mkdir -p ${NANO_WORLDDIR}/packages
cp /usr/src/tools/tools/nanobsd/packages/* ${NANO_WORLDDIR}/packages
cp $(which pkg-static) ${NANO_WORLDDIR}/
chroot ${NANO_WORLDDIR} sh -c 'cd packages; /pkg-static add *;cd ..;'
rm -rf ${NANO_WORLDDIR}/packages ${NANO_WORLDDIR}/pkg-static
)
customize_cmd install_packages
Configuration File Example 配置文件举例
A complete example of a configuration file for building a custom <application>NanoBSD</application> image can be: 下面是一个用于构建定制的 <application>NanoBSD</application> 映像的完整例子:
NANO_NAME=custom
NANO_SRC=/usr/src
NANO_KERNEL=MYKERNEL
NANO_IMAGES=2

CONF_BUILD='
WITHOUT_KLDLOAD=YES
WITHOUT_NETGRAPH=YES
WITHOUT_PAM=YES
'

CONF_INSTALL='
WITHOUT_ACPI=YES
WITHOUT_BLUETOOTH=YES
WITHOUT_FORTRAN=YES
WITHOUT_HTML=YES
WITHOUT_LPR=YES
WITHOUT_MAN=YES
WITHOUT_SENDMAIL=YES
WITHOUT_SHAREDOCS=YES
WITHOUT_EXAMPLES=YES
WITHOUT_INSTALLLIB=YES
WITHOUT_CALENDAR=YES
WITHOUT_MISC=YES
WITHOUT_SHARE=YES
'

CONF_WORLD='
WITHOUT_BIND=YES
WITHOUT_MODULES=YES
WITHOUT_KERBEROS=YES
WITHOUT_GAMES=YES
WITHOUT_RESCUE=YES
WITHOUT_LOCALES=YES
WITHOUT_SYSCONS=YES
WITHOUT_INFO=YES
'

FlashDevice SanDisk 1G

cust_nobeastie() (
touch ${NANO_WORLDDIR}/boot/loader.conf
echo "beastie_disable=\"YES\"" &gt;&gt; ${NANO_WORLDDIR}/boot/loader.conf
)

customize_cmd cust_comconsole
customize_cmd cust_install_files
customize_cmd cust_allow_ssh_root
customize_cmd cust_nobeastie
NANO_NAME=custom
NANO_SRC=/usr/src
NANO_KERNEL=MYKERNEL
NANO_IMAGES=2

CONF_BUILD='
WITHOUT_KLDLOAD=YES
WITHOUT_NETGRAPH=YES
WITHOUT_PAM=YES
'

CONF_INSTALL='
WITHOUT_ACPI=YES
WITHOUT_BLUETOOTH=YES
WITHOUT_FORTRAN=YES
WITHOUT_HTML=YES
WITHOUT_LPR=YES
WITHOUT_MAN=YES
WITHOUT_SENDMAIL=YES
WITHOUT_SHAREDOCS=YES
WITHOUT_EXAMPLES=YES
WITHOUT_INSTALLLIB=YES
WITHOUT_CALENDAR=YES
WITHOUT_MISC=YES
WITHOUT_SHARE=YES
'

CONF_WORLD='
WITHOUT_BIND=YES
WITHOUT_MODULES=YES
WITHOUT_KERBEROS=YES
WITHOUT_GAMES=YES
WITHOUT_RESCUE=YES
WITHOUT_LOCALES=YES
WITHOUT_SYSCONS=YES
WITHOUT_INFO=YES
'

FlashDevice SanDisk 1G

cust_nobeastie() (
touch ${NANO_WORLDDIR}/boot/loader.conf
echo "beastie_disable=\"YES\"" &gt;&gt; ${NANO_WORLDDIR}/boot/loader.conf
)

customize_cmd cust_comconsole
customize_cmd cust_install_files
customize_cmd cust_allow_ssh_root
customize_cmd cust_nobeastie
Updating NanoBSD 更新 NanoBSD
The update process of <application>NanoBSD</application> is relatively simple: 更新 <application>NanoBSD</application> 相对而言较为简单:
Build a new <application>NanoBSD</application> image, as usual. 和之前一样构建新的 <application>NanoBSD</application> 映像文件。
Upload the new image into an unused partition of a running <application>NanoBSD</application> appliance. 将新的映像放入正运行的 <application>NanoBSD</application> 设备中的一个未用的分区。
The most important difference of this step from the initial <application>NanoBSD</application> installation is that now instead of using <filename>_.disk.full</filename> (which contains an image of the entire disk), the <filename>_.disk.image</filename> image is installed (which contains an image of a single system partition). 与之前最初安装 <application>NanoBSD</application> 的步骤相比, 这一步骤最重要的区别在于这次不应使用 <filename>_.disk.full</filename> 文件 (它包含整个盘的映像), 而应安装 <filename>_.disk.image</filename> 映像 (这个文件中, 只包含一个系统分区)。
Reboot, and start the system from the newly installed partition. 重新启动, 并从新安装的分区中启动系统。
If all goes well, the upgrade is finished. 如果一切顺利的话, 升级工作就完成了。
If anything goes wrong, reboot back into the previous partition (which contains the old, working image), to restore system functionality as fast as possible. Fix any problems of the new build, and repeat the process. 如果发生了任何问题, 则可以从先前的分区启动 (其中包含了旧的、 可用的映像), 来尽可能快地恢复系统功能。 接下来可以修正新联编的版本中存在的问题, 并重复前述步骤。
To install new image onto the running <application>NanoBSD</application> system, it is possible to use either the <filename>updatep1</filename> or <filename>updatep2</filename> script located in the <filename>/root</filename> directory, depending from which partition is running the current system. 要在正在运行的 <application>NanoBSD</application> 系统中安装新的映像, 可以使用位于 <filename>/root</filename> 目录的 <filename>updatep1</filename> 或 <filename>updatep2</filename> 脚本, 具体使用哪一个脚本, 取决于正在运行的系统位于那个分区。

Loading…

No matching activity found.

Browse all component changes

Glossary

English Chinese (Simplified) (zh_CN)
No related strings found in the glossary.

Source information

Source string comment

(itstool) path: listitem/para

Source string location
article.translate.xml:331
String age
a year ago
Source string age
a year ago
Translation file
articles/zh_CN/nanobsd.po, string 64