Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

svc-create-first-boot (1)

名称

svc-create-first-boot - 创建首次引导服务软件包

用法概要

svc-create-first-boot [-s|--source <script_path>] [-d|--destination <p5ppath|repoURI>]
        [-o|--options <name=value>]... [-h |--help]

描述

svc-create-first-boot 命令用于创建首次引导服务软件包。首次引导服务软件包可以发布到现有系统信息库或包装在 p5p 归档文件中。之后在 AI 安装期间,可以将系统信息库或 p5p 归档文件中的该软件包安装到 AI 客户机中。您可以在该命令中定制以下内容:

  • 首次引导服务的名称

  • 首次引导服务依赖的服务,称为服务依赖项

  • 启动方法超时(秒),应超过用户提供的脚本的执行时间

  • 首次引导服务软件包的名称

  • P5P 归档文件中的发布者名称

未提供选项时,该命令以交互方式运行。在交互模式下运行时,将会向您提出各种问题。您可以在提出问题时按 Return 键,确保命令只使用缺省值。提出问题时,会在方括号中提供缺省值。

在交互模式下,您需要提供要包含在所创建软件包中的首次引导脚本的位置的路径。必须提供此输入。提示提供目标时,您需要提供现有系统信息库的路径(本地或远程,可通过 HTTP 访问)。或者,您可以提供要存储 p5p 归档文件的位置的路径。

要以非交互方式运行该命令,必须至少指定 –s–d 选项。后面的部分中详细描述了命令行模式下允许的选项和参数。

选项

支持以下选项:

–h

显示命令用法

–s <script_path>

要在首次引导时运行的脚本的路径

–d <p5ppath|repoURI>

现有系统信息库或将存储 p5p 归档文件的路径的 URI。系统信息库或 p5p 归档文件支持 file:file:// 前缀。系统信息库 URI 只支持 http:// 前缀

–o name=value

用于定制首次引导服务软件包的不同方面的名称值对

扩展描述

支持的名称及其对应值如下:

service-name

将在客户机中运行首次引导配置脚本的首次引导服务的名称支持形式为 svc:/site/<service_name>:[<instance_name>] 的任何字符串。缺省服务名称为 'first-boot-svc'

service-start-timeout

要配置此选项,请参阅 smf_method(7) 手册页的超时部分。缺省值为 60 秒。

service-dependency

首次引导服务依赖的服务。

package-fmri

要安装在 AI 客户机上的首次引导服务软件包的 fmri。支持的值为任何有效的软件包 fmri。缺省的软件包 FMRI 为 'first-boot-svc'

package-publisher

首次引导服务软件包的发布者名称。支持的值为任何有效的软件包发布者名称前缀。缺省的发布者名称为 'firstboot'

rerun-on-clone

rerun-on-clone 的缺省值为 true,控制每次部署包含此软件包的克隆归档文件/区域时是否运行首次引导脚本。请注意,在克隆系统/区域上重新运行该脚本时,它应该能够检测出此系统/区域成为克隆的系统/区域时已配置的内容,且行为也与此相适应。有关克隆归档文件的信息,请参见 archiveadm(8),有关区域克隆的信息,请参见 zoneadm(8)

如果用户未定制依赖项,则将向首次引导 SMF 服务添加缺省依赖项 svc:/milestone/multiuser

示例

示例 1 在交互模式下创建首次引导服务软件包:
# svc-create-first-boot
Enter the path to the script to be run at first boot:

Enter the path to an existing repository or the path to\ 
the desired location of the generated p5p archive:

Enter the FMRI of the first boot service \
[svc:/site/first-boot-svc]:

Customize dependencies [yes/No]:

- No (retains the default milestone/multi-user)

- yes (switches the default to milestone/config)

Does your first boot service configure the network \
or require access to the network?
[yes/No]:

- yes (adds the milestone/network dependency)

Does your first boot service need to look up non-local \
host or user names? [yes/No]:

- yes (adds the milestone/name-services dependency)
       
Does your first boot service need to access any file \
systems outside of the root file system? [yes/No]:

- yes (adds the milestone/multi-user dependency)

Enter any additional dependency [None]:

Should your first boot script be rerun on cloned instance of installed client? [yes/No]:

Enter the method script timeout in seconds [60]:

Enter the package name [first-boot-svc]:

Enter the publisher name [firstboot]:
        
Enter the URI to an existing repository or the path to the generated p5p archive []:
示例 2 在命令行模式下创建首次引导服务软件包

以下命令创建首次引导服务软件包的 p5p 归档文件(使用缺省名称和缺省服务依赖项)。

svc-create-first-boot -s /home/myscript -d myp5p.p5p
示例 3 创建首次引导服务软件包并发布到现有系统信息库

首次引导服务软件包可以发布到本地或非本地系统信息库(通过 HTTP)

Local repository:
            svc-create-first-boot -s /home/myscript -d file:///export/repoSolaris11
            svc-create-first-boot -s /home/myscript -d /export/repoSolaris11
Non-local repository:
            svc-create-first-boot -s ./myscript -d \
            http://<host_name>:<port_no>
示例 4 使用命令行创建首次引导服务软件包(提供定制项)
svc-create-first-boot -s ./myscript -d ./myp5p.p5p \
-o service-name=svc:/site/svctrial \
-o service-dependency=milestone/network \
-o service-dependency=milestone/name-service \
-o package-fmri=svcpack -o package-publisher=svcpub
示例 5 创建将不在安装的客户机的克隆实例上运行的首次引导服务
svc-create-first-boot -s /home/myscript -d myp5p.p5p \
-o rerun-on-clone=false

退出状态

将返回以下退出值:

0

该命令被成功处理

1

执行命令时出错

2

无效 CLI 选项

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
install/installadm

另请参见

pkgrecv(1)pkgrepo(1)pkgsend(1)svcprop(1)svcbundle(8)