用下载内容设置配置项¶
语法¶
imgset [--timeout <timeout>] [--keep] <setting> <uri|image>
示例¶
获取最新的 iPXE 版本号¶
imgset latest https://boot.ipxe.org/version.txt
show latest
获取 AWS IMDSv2 身份验证令牌¶
params --method PUT
param --header X-Aws-Ec2-Metadata-Token-Ttl-Seconds 600
imgset authtoken http://169.254.169.254/latest/api/token##params
描述¶
从指定的 URI 下载镜像,并把配置设置的值设为下载的镜像内容。
可以使用 --timeout 选项指定下载进度超时时间(毫秒)。
除非指定了 --keep 选项,否则下载的镜像在设置好配置项的值后会被丢弃。
命令状态¶
| 成功 | 配置设置下载并应用成功 |
|---|---|
| 失败 | 配置设置未能成功下载并应用 |
另请参阅¶
imgfetchsetshow- 全部 iPXE 设置列表
- 全部 iPXE 命令列表
备注¶
如果你要从 HTTP API 获取值,可能需要使用 param 命令指定自定义请求头(例如用于身份验证)。
配置设置的值会被设为下载镜像内容的原始字节值。如果你在设置名称中指定了设置类型,那么后续解释原始字节值时会使用该类型。例如:
iPXE> imgset latest https://boot.ipxe.org/version.txt
https://boot.ipxe.org/version.txt...ok
iPXE> show latest
latest:string = 2.0.0+ (g91758)
iPXE> imgset latest:hex https://boot.ipxe.org/version.txt
https://boot.ipxe.org/version.txt... ok
iPXE> show latest
latest:hex = 32:2e:30:2e:30:2b:20:28:67:39:31:37:35:38:29:0a
因此,如果你有一个以字符串形式返回数值的 HTTP 端点,你需要用两条命令才能在 iPXE 中得到数值型的设置。例如:
iPXE> imgset count http://192.168.0.1/api/count
iPXE> set count:int32 ${count}
iPXE> show count
count:int32 = 42
iPXE> inc count
iPXE> show count
count:int32 = 43