Go to main content

Customizing Automated Installations With Manifests and Profiles

Exit Print View

Updated: November 2020

How to Create and Publish the IPS Package for a First-Boot Script

    Create an IPS package that contains:

  • The service manifest file.

  • The first-boot script.

  • Any files needed by the script that cannot be provided from another location such as the AI server.

Before You Begin

Ensure that your role has the appropriate rights profiles to perform this procedure. See Using Rights Profiles to Install Oracle Solaris.

  1. Create the directory hierarchy.

    In this example, the service manifest is installed into /lib/svc/manifest/site, and the first-boot script is installed into /opt/site.

    $ mkdir -p proto/lib/svc/manifest/site
    $ mkdir -p proto/opt/site
    $ cp first-boot-script-svc-manifest.xml proto/lib/svc/manifest/site
    $ cp first-boot-script.sh proto/opt/site
  2. Create the package manifest.

    Create the following file named first-boot-script.p5m.

    set name=pkg.fmri value=first-boot-script@1.0,5.11-0
    set name=pkg.summary value="AI first-boot script"
    set name=pkg.description value="Script that runs at first boot after AI installation"
    set name=info.classification value=\
        "org.opensolaris.category.2008:System/Administration and Configuration"
    file lib/svc/manifest/site/first-boot-script-svc-manifest.xml \
        path=lib/svc/manifest/site/first-boot-script-svc-manifest.xml owner=root \
        group=sys mode=0444
    dir  path=opt/site owner=root group=sys mode=0755
    file opt/site/first-boot-script.sh path=opt/site/first-boot-script.sh \
        owner=root group=sys mode=0555

    Depending on what your first-boot script does, you might need to specify dependencies. If you modify this manifest, verify the new manifest is correct. You can ignore warnings. See Chapter 2, Packaging Software With IPS in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.4 for information about how to create a package, including information about the pkgdepend, pkgmogrify, and pkglint commands.

  3. Create the repository for the package.

    This example creates the repository in the local directory, with firstboot as the publisher.

    Note - Create the repository in a directory that is accessible by the AI clients at installation time.
    $ pkgrepo create firstbootrepo
    $ pkgrepo -s firstbootrepo add-publisher firstboot
  4. Publish the package.
    $ pkgsend publish -d ./proto -s ./firstbootrepo first-boot-script.p5m

    AI clients can install the package from the firstbootrepo repository. The firstboot publisher with firstbootrepo origin is defined in the AI manifest as shown in the next section.

  5. Verify that the package is available.

    List the package to verify that the package is available.

    $ pkg list -g ./firstbootrepo first-boot-script
    NAME (PUBLISHER)                 VERSION    IFO
    first-boot-script (firstboot)    1.0-0      ---
  6. (Optional) Test installation of the package.

    The –n option indicates not to install the package.

    $ pkg set-publisher -g ./firstbootrepo firstboot
    $ pkg publisher
    solaris    origin  online F http://pkg.oracle.com/solaris/release/
    firstboot  origin  online F file:///home/user1/firstboot/firstbootrepo/
    $ pkg list -af first-boot-script
    NAME (PUBLISHER)                 VERSION    IFO
    first-boot-script (firstboot)    1.0-0      ---
    $ pkg install -nv first-boot-script
               Packages to install:        1
         Estimated space available: 50.68 GB
    Estimated space to be consumed: 64.66 MB
           Create boot environment:       No
    Create backup boot environment:       No
              Rebuild boot archive:       No
    Changed packages:
        None -> 1.0,5.11-0:20140114T022508Z
    Planning linked: 0/2 done; 1 working: zone:z2
    Linked image 'zone:z2' output:
    |      Estimated space available: 50.68 GB
    | Estimated space to be consumed: 62.07 MB
    |           Rebuild boot archive:       No
    Planning linked: 1/2 done; 1 working: zone:z1
    Linked image 'zone:z1' output:
    |      Estimated space available: 50.67 GB
    | Estimated space to be consumed: 62.07 MB
    |           Rebuild boot archive:       No

Next Steps

See Creating Package Repositories in Oracle Solaris 11.4 for instructions to make the new repository accessible to AI clients through either NFS sharing or HTTP.