@@ -864,14 +864,40 @@ smf_setSavedDeviceName() {
864
864
smf_setSavedUniq " nut-driver:$1 " " nut-driver-enumerator-generated-devicename" " DEVICE" astring " $2 "
865
865
}
866
866
smf_setDocLink () {
867
- # FIXME: experiment and implement
868
- # Save device (config section) name $2 into service instance $1
867
+ # Save documentation links for driver of device (config section) named $2
868
+ # into service instance $1
869
869
[ -n " $1 " ] || return # No-op for global section
870
- __TARGET_FMRI=" $1 "
870
+ __TARGET_FMRI=" nut-driver: $1 "
871
871
__DRV=" ` upsconf_getDriver " $2 " ` "
872
- # Documentation=man:${__DRV}(8)
873
- # Documentation=${NUT_WEBSITE_BASE}/docs/man/${__DRV}.html
874
- unset __DRV
872
+
873
+ # ## Sample:
874
+ # tm_common_name template
875
+ # tm_common_name/C ustring "physical network interface autoconfiguration"
876
+ # tm_doc_Network_Auto-Magic_OpenSolaris_Project_Page template
877
+ # tm_doc_Network_Auto-Magic_OpenSolaris_Project_Page/name astring "Network Auto-Magic OpenSolaris Project Page"
878
+ # tm_doc_Network_Auto-Magic_OpenSolaris_Project_Page/uri astring http://hub.opensolaris.org/bin/view/Project+nwam/
879
+ # tm_man_nwamd8 template
880
+ # tm_man_nwamd8/manpath astring /usr/share/man
881
+ # tm_man_nwamd8/section astring 8
882
+ # tm_man_nwamd8/title astring nwamd
883
+
884
+ __PG=" tm_doc_${__DRV} _Page"
885
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " delprop " ${__PG} " 2> /dev/null || true
886
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " addpg " ${__PG} " template && \
887
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " setprop " ${__PG} /name" = " astring" " ${__DRV} online" && \
888
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " setprop " ${__PG} /uri" = " astring" " ${NUT_WEBSITE_BASE} /docs/man/${__DRV} .html"
889
+ [ $? = 0 ] && echo " OK" || { echo " FAILED to stash the service property group ${__PG} for online docs" >&2 ; return 1 ; }
890
+
891
+ # FIXME: Pass resolved $mandir if known
892
+ __PG=" tm_man_${__DRV} 8"
893
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " delprop " ${__PG} " 2> /dev/null || true
894
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " addpg " ${__PG} " template && \
895
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " setprop " ${__PG} /manpath" = " astring" " /usr/share/man" && \
896
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " setprop " ${__PG} /section" = " astring" " 8" && \
897
+ /usr/sbin/svccfg -s " ${__TARGET_FMRI} " setprop " ${__PG} /titke" = " astring" " ${__DRV} "
898
+ [ $? = 0 ] && echo " OK" || { echo " FAILED to stash the service property group ${__PG} for local docs" >&2 ; return 1 ; }
899
+
900
+ unset __DRV __PG __TARGET_FMRI
875
901
[ $? = 0 ] && echo " OK" || { echo " FAILED to stash the device doc links" >&2 ; return 1 ; }
876
902
}
877
903
smf_restart_upsd () {
@@ -1017,7 +1043,8 @@ EOF
1017
1043
[ $? = 0 ] && echo " OK" || { echo " FAILED to stash the device name" >&2 ; return 1 ; }
1018
1044
}
1019
1045
systemd_setDocLink () {
1020
- # Save device (config section) name $2 into service instance $1
1046
+ # Save documentation links for driver of device (config section) named $2
1047
+ # into service instance $1
1021
1048
[ -n " $1 " ] || return # No-op for global section
1022
1049
PROPFILE=" ${SYSTEMD_CONFPATH} /nut-driver@$1 .service.d/nut-driver-enumerator-generated-doclink.conf"
1023
1050
mkdir -p " ${SYSTEMD_CONFPATH} /nut-driver@$1 .service.d" && \
0 commit comments