JavaScript is required to for searching.
跳过导航链接
退出打印视图
安装 Oracle Solaris 11.1 系统     Oracle Solaris 11.1 Information Library (简体中文)
为本文档评分
search filter icon
search icon

文档信息

前言

第 1 部分Oracle Solaris 11.1 安装选项

1.  安装选项概述

第 2 部分使用安装介质安装

2.  准备安装

3.  使用 Live Media

4.  使用文本安装程序

5.  从介质引导的自动化安装

6.  取消配置或重新配置 Oracle Solaris 实例

第 3 部分使用安装服务器安装

7.  自动化安装多个客户机

8.  设置安装服务器

9.  定制安装

10.  置备客户机系统

11.  配置客户机系统

12.  安装和配置区域

13.  在首次引导期间运行定制脚本

实现在首次引导时运行一次的控件

如何确保仅在首次引导时运行一次

创建在首次引导时运行的脚本

创建 SMF 清单文件

使用清单创建工具

定制生成的清单

为脚本和服务创建 IPS 软件包

如何创建和发布 IPS 软件包

在 AI 客户机上安装首次引导软件包

如何安装 IPS 软件包

测试首次引导服务

如何更新脚本或服务

14.  安装客户机系统

15.  自动化安装故障排除

第 4 部分执行相关任务

A.  使用 Oracle 配置管理器

B.  使用设备驱动实用程序

索引

请告诉我们如何提高我们的文档:
过于简略
不易阅读或难以理解
重要信息缺失
错误的内容
需要翻译的版本
其他
Your rating has been updated
感谢您的反馈!

您的反馈将非常有助于我们提供更好的文档。 您是否愿意参与我们的内容改进并提供进一步的意见?

创建 SMF 清单文件

创建一个 SMF 清单文件,该文件用于定义执行脚本的服务。

使用清单创建工具

可以使用 svcbundle 命令生成有效的服务清单。在以下示例中,请注意,缺省情况下,svcbundle 命令所生成的清单会指定瞬态服务和 multi-user 依赖性。

示例 13-3 生成的 SMF 服务清单

在以下命令中,将创建在首次引导时运行的脚本中显示的脚本的名称指定为 start-method 的值。因为在为脚本和服务创建 IPS 软件包中创建的软件包会将 first-boot-script.sh 脚本安装到 /opt/site/first-boot-script.sh 中,所以脚本的名称会被指定为 /opt/site/first-boot-script.sh

在以下命令中,以冒号分隔列表形式的指定 completed 属性的属性组名称、属性名称、属性类型和初始属性值。

$ svcbundle -s service-name=site/first-boot-script-svc \
-s start-method=/opt/site/first-boot-script.sh \
-s instance-property=config:completed:boolean:false \
> first-boot-script-svc-manifest.xml

在生成的服务清单(如下所示)中,首次引导脚本 /opt/site/first-boot-script.shstart 方法的 exec 属性值。completed 属性在定义此服务的缺省实例 (first-boot-script-svc:default) 的 instance 元素中指定。

<?xml version="1.0" ?>
<!DOCTYPE service_bundle
  SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
    Manifest created by svcbundle (2012-Jul-13 16:39:30-0700)
-->
<service_bundle type="manifest" name="site/first-boot-script-svc">
    <service version="1" type="service" name="site/first-boot-script-svc">
        <!--
            The following dependency keeps us from starting until the
            multi-user milestone is reached.
        -->
        <dependency restart_on="none" type="service"
            name="multi_user_dependency" grouping="require_all">
            <service_fmri value="svc:/milestone/multi-user"/>
        </dependency>
        <exec_method timeout_seconds="60" type="method" name="start"
            exec="/opt/site/first-boot-script.sh"/>
        <!--
            The exec attribute below can be changed to a command that SMF
            should execute to stop the service.  See smf_method(5) for more
            details.
        -->
        <exec_method timeout_seconds="60" type="method" name="stop"
            exec=":true"/>
        <!--
            The exec attribute below can be changed to a command that SMF
            should execute when the service is refreshed.  Services are
            typically refreshed when their properties are changed in the
            SMF repository.  See smf_method(5) for more details.  It is
            common to retain the value of :true which means that SMF will
            take no action when the service is refreshed.  Alternatively,
            you may wish to provide a method to reread the SMF repository
            and act on any configuration changes.
        -->
        <exec_method timeout_seconds="60" type="method" name="refresh"
            exec=":true"/>
        <property_group type="framework" name="startd">
            <propval type="astring" name="duration" value="transient"/>
        </property_group>
        <instance enabled="true" name="default">
            <property_group type="application" name="config">
                <propval type="boolean" name="completed" value="false"/>
            </property_group>
        </instance>
        <template>
            <common_name>
                <loctext xml:lang="C">
                    <!--
                        Replace this comment with a short name for the
                        service.
                    -->
                </loctext>
            </common_name>
            <description>
                <loctext xml:lang="C">
                    <!--
                        Replace this comment with a brief description of
                        the service
                    -->
                </loctext>
            </description>
        </template>
    </service>
</service_bundle>

定制生成的清单

使用 svcbundle 命令生成的服务清单可能无需进行任何修改即可满足您的需要。以下示例显示了对服务清单的修改。

如果修改了服务清单,请使用 svccfg validate 命令确保清单仍然有效。

示例 13-4 定制的 SMF 服务清单

在生成的服务清单的以下副本中,已增大了 start 方法的缺省 exec_method 超时值(60 秒)。请确保 start 方法有足够的时间运行首次引导脚本。

<?xml version="1.0" ?>
<!DOCTYPE service_bundle
  SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
    Manifest created by svcbundle (2012-Jul-13 16:39:30-0700)
-->
<service_bundle type="manifest" name="site/first-boot-script-svc">
    <service version="1" type="service" name="site/first-boot-script-svc">
        <!--
            The following dependency keeps us from starting until the
            multi-user milestone is reached.
        -->
        <dependency restart_on="none" type="service"
            name="multi_user_dependency" grouping="require_all">
            <service_fmri value="svc:/milestone/multi-user"/>
        </dependency>
        <!--
            Make sure the start method has adequate time to run the script.
        -->
        <exec_method timeout_seconds="360" type="method" name="start"
            exec="/opt/site/first-boot-script.sh"/>
        <!--
            The exec attribute below can be changed to a command that SMF
            should execute to stop the service.  See smf_method(5) for more
            details.
        -->
        <exec_method timeout_seconds="60" type="method" name="stop"
            exec=":true"/>
        <!--
            The exec attribute below can be changed to a command that SMF
            should execute when the service is refreshed.  Services are
            typically refreshed when their properties are changed in the
            SMF repository.  See smf_method(5) for more details.  It is
            common to retain the value of :true which means that SMF will
            take no action when the service is refreshed.  Alternatively,
            you may wish to provide a method to reread the SMF repository
            and act on any configuration changes.
        -->
        <exec_method timeout_seconds="60" type="method" name="refresh"
            exec=":true"/>
        <property_group type="framework" name="startd">
            <propval type="astring" name="duration" value="transient"/>
        </property_group>
        <instance enabled="true" name="default">
            <property_group type="application" name="config">
                <propval type="boolean" name="completed" value="false"/>
            </property_group>
        </instance>
        <template>
            <common_name>
                <loctext xml:lang="C">
                    <!--
                        Replace this comment with a short name for the
                        service.
                    -->
                </loctext>
            </common_name>
            <description>
                <loctext xml:lang="C">
                    <!--
                        Replace this comment with a brief description of
                        the service
                    -->
                </loctext>
            </description>
        </template>
    </service>
</service_bundle>
$ svccfg validate first-boot-script-svc-manifest.xml