9969 svccfg: honour PKG_INSTALL_ROOT when building hash filename
Review Request #1276 — Created Nov. 8, 2018 and submitted
Information | |
---|---|
citrus | |
illumos-gate | |
master | |
9969 | |
b7d4489... | |
Reviewers | |
general | |
ptribble |
svccfg: honour PKG_INSTALL_ROOT when building hash filename
When seeding an SMF database, the paths to the imported manifests end up stored in two places within the repository database:
- The
manifestfiles
property of the imported service; - A per-service tree within the
smf/manifest
service.
For example:
bloody% cp /lib/svc/seed/global.db /tmp bloody% export SVCCFG_REPOSITORY=/tmp/global.db bloody% export SVCCFG_CHECKHASH=1 bloody% svccfg import /kayak_image/r151029/lib/svc/manifest/network/ntp.xml bloody% svccfg -s ntp listprop manifestfiles manifestfiles framework manifestfiles/kayak_image_r151029_lib_svc_manifest_network_ntp_xml astring /kayak_image/r151029/lib/svc/manifest/network/ntp.xml bloody% svccfg -s manifest listprop | grep ntp kayak_image_r151029_lib_svc_manifest_network_ntp_xml framework kayak_image_r151029_lib_svc_manifest_network_ntp_xml/manifestfile astring /kayak_image/r151029/lib/svc/manifest/network/ntp.xml kayak_image_r151029_lib_svc_manifest_network_ntp_xml/md5sum opaque afcd99c29f0dedcf40278f1bf0253f6286787107e11c23bcac675faffed78f41
It's possible to set the PKG_INSTALL_ROOT
environment variable in order to modify these embedded paths, which fixes the keys and the path stored in the service itself, but not the path in smf/manifest
:
bloody% export PKG_INSTALL_ROOT=/kayak_image/r151029 bloody% svccfg import /kayak_image/r151029/lib/svc/manifest/network/ntp.xml bloody% svccfg -s ntp listprop manifestfiles manifestfiles framework manifestfiles/lib_svc_manifest_network_ntp_xml astring /lib/svc/manifest/network/ntp.xml bloody% svccfg -s manifest listprop | grep ntp lib_svc_manifest_network_ntp_xml framework lib_svc_manifest_network_ntp_xml/manifestfile astring /kayak_image/r151029/lib/svc/manifest/network/ntp.xml lib_svc_manifest_network_ntp_xml/md5sum opaque afcd99c29f0dedcf40278f1bf0253f6286787107e11c23bcac675faffed78f41
This changes the hashing code so that this path is updated along with the others.
-
I'm wondering whether the behaviour is correct in the following 2 cases:
-
PKG_INSTALL_ROOT = "/" - it strips the leading / from the file name.
-
PKG_INSTALL_ROOT ends with a trailing / - likewise
This would apply to the existing code as well.
(Being "/" is entirely legitimate, if superfluous, and we have some cases where this is checked for. The simplest catch is probably to verify for length greater than 1. A path ending in / is likely user error, but might happen if people use shell autocompletion.)
-