Dans cet exemple, le manifeste de service est installé dans /lib/svc/manifest/site et le script de première initialisation est installé dans /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
Créez le fichier suivant nommé 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
En fonction des actions du script de première initialisation, il est possible que vous n'ayez pas besoin de spécifier des dépendances. Si vous modifiez ce manifeste, vérifiez que le nouveau manifeste est correct. Vous pouvez ignorer les avertissements. Reportez-vous au chapitre Chapitre 2, Packaging Software With IPS du manuel Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.2 pour plus d'informations sur la manière de créer un package, dont les informations sur les commandes pkgdepend, pkgmogrify et pkglint.
Cet exemple permet de créer le référentiel dans le répertoire local, avec firstboot en tant qu'éditeur.
$ pkgrepo create firstbootrepo $ pkgrepo -s firstbootrepo add-publisher firstboot
$ pkgsend publish -d ./proto -s ./firstbootrepo first-boot-script.p5m pkg://firstboot/first-boot-script@1.0,5.11-0:20140114T022508Z PUBLISHED
Les clients peuvent installer le package à partir du référentiel firstbootrepo. L'éditeur firstboot avec l'origine firstbootrepo est défini dans le manifeste AI comme indiqué dans l'étape suivante.
Répertoriez le package pour vérifier qu'il est disponible.
$ pkg list -g ./firstbootrepo first-boot-script NAME (PUBLISHER) VERSION IFO first-boot-script (firstboot) 1.0-0 ---
L'option –n indique de ne pas installer le package.
# pkg set-publisher -g ./firstbootrepo firstboot # pkg publisher PUBLISHER TYPE STATUS P LOCATION solaris origin online F http://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: firstboot first-boot-script 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
Etapes suivantes
Reportez-vous à la section Copie et création de référentiels de packages dans Oracle Solaris 11.2 pour obtenir des instructions permettant de rendre le nouveau référentiel accessible aux systèmes client via le partage NFS ou HTTP.