To test the service before you test an AI installation, you can simply install the package on a test system and reboot that test system.
# pkg install first-boot-script Packages to install: 1 Create boot environment: No Create backup boot environment: No DOWNLOAD PKGS FILES XFER (MB) SPEED Completed 1/1 2/2 0.0/0.0 0B/s PHASE ITEMS Installing new actions 7/7 Updating package state database Done Updating image state Done Creating fast lookup database Done Reading search index Done # pkg list first-boot-script NAME (PUBLISHER) VERSION IFO first-boot-script (firstboot) 1.0-0 i-- # pkg info first-boot-script Name: first-boot-script Summary: AI first-boot script Description: Script that runs at first boot after AI installation Category: System/Administration and Configuration State: Installed Publisher: firstboot Version: 1.0 Build Release: 5.11 Branch: 0 Packaging Date: Dec 23, 2013 02:50:31 PM Size: 3.89 kB FMRI: pkg://email@example.com,5.11-0:20131223T145031Z
Reboot the test system. If the script created a new boot environment as shown above, be sure to boot into that new boot environment.
Check that the script is in the /opt/site directory and the effects of the script are correct.
Check the state of the service. If the script finished and exited correctly, the service should be in the disabled state.
# svcs first-boot-script-svc STATE STIME FMRI disabled 8:24:16 svc:/site/first-boot-script-svc:default
Use one of the following commands to check the value of the completed property:
# svcprop first-boot-script-svc:default config/completed boolean true # svcprop -p config/completed first-boot-script-svc:default true
If you want to review the service log file, use the following command to find the location of the log file:
# svcs -x first-boot-script-svc svc:/site/first-boot-script-svc:default (?) State: disabled since Dec 23, 2013 08:24:16 AM PDT Reason: Temporarily disabled by service method: "Configuration completed." See: http://support.oracle.com/msg/SMF-8000-1S See: /var/svc/log/site-first-boot-script-svc:default.log Impact: This service is not running.
The log file contains the following information:
[ Jul 23 08:22:57 Enabled. ] [ Jul 23 08:24:14 Executing start method ("/opt/site/first-boot-script.sh"). ] [ Jul 23 08:24:16 Method "start" exited with status 101. ] [ Jul 23 08:24:16 "start" method requested temporary disable: "Configuration completed" ] [ Jul 23 08:24:16 Rereading configuration. ]
If you change the script or the service manifest, use this procedure to install the update.
$ cp first-boot-script-svc-manifest.xml proto/lib/svc/manifest/site $ cp first-boot-script.sh proto/opt/site
In the package manifest, change the value of the pkg.fmri attribute to the following, for example:
Publish the new version of the package to the repository.
$ pkgsend publish -d ./proto -s ./firstbootrepo first-boot-script.p5m pkg://firstname.lastname@example.org,5.11-0.1:2013123T231948Z PUBLISHED
Use the pkg list -af command to make sure you can access the new version. You might need to use the pkg refresh firstboot command to update the package list. Use the pkg update command to update the package.