### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### Solaris.pm - Solaris module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::Solaris; use strict; use PSGConf::Action::GenerateFile::etc_system; use PSGConf::Action::GenerateFile::EnvFile; use PSGConf::Action::MkDir; use PSGConf::Action::RunCommand; use PSGConf::Data::Hash; use PSGConf::Data::String; ############################################################################### ### PSGConf::Action::RunCommand plugin for dumpadm ############################################################################### sub _check_dumpadm { my ($action, $psgconf) = @_; return (! -d '/var/crash/' . $psgconf->data_obj('hostname')->get()); } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; my ($admin); return if (! $psgconf->data_obj('platform')->match('solaris')); $admin = $psgconf->data_obj('pkg_admin')->get(); $psgconf->register_actions( PSGConf::Action::GenerateFile::etc_system->new( 'name' => '/etc/system', 'comment_str' => '***', 'description' => 'Solaris kernel config file', 'requires_reboot' => 1, system_vars => $psgconf->data_obj('system_vars')->get(), system_literal => $psgconf->data_obj('system_literal')->get() ), PSGConf::Action::MkDir->new( 'name' => '/var/crash/' . $psgconf->data_obj('hostname')->get(), 'mode' => 0700, 'requires_reboot' => 1 ), PSGConf::Action::RunCommand->new( 'name' => '/etc/dumpadm.conf', 'check_func' => \&_check_dumpadm, 'command' => '/usr/sbin/dumpadm -s /var/crash/' . $psgconf->data_obj('hostname')->get(), 'requires_reboot' => 1 ), (map { PSGConf::Action::GenerateFile::EnvFile->new( 'name' => "/var/sadm/install/admin/$_", 'comment_str' => '###', 'description' => 'pkgadd admin file', 'vars' => $admin->{$_} )} keys %$admin) ); ### ### Run the kbd command only on machines that have /dev/kbd, this ### is not the case for Solaris Zones (non global ones). ### if ( $psgconf->data_obj('solaris_kbd')->count() && -e '/dev/kbd' ) { $psgconf->register_actions( PSGConf::Action::GenerateFile::EnvFile->new( 'name' => "/etc/default/kbd", 'comment_str' => '###', 'description' => 'kbd default settings file', 'vars' => $psgconf->data_obj('solaris_kbd')->get() ), PSGConf::Action::RunCommand->new( 'name' => 'Update default kbd options', 'command' => '/usr/bin/kbd -i', 'filename' => [ '/etc/default/kbd' ] ) ); } } ############################################################################### ### Constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'Solaris'; $psgconf->register_data( 'system_literal' => PSGConf::Data::String->new(), 'system_vars' => PSGConf::Data::Hash->new(), 'solaris_kbd' => PSGConf::Data::Hash->new(), 'pkg_admin' => PSGConf::Data::Hash->new( value_type => 'HASH' ) ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::Solaris - psgconf control class for Solaris-specific configuration =head1 SYNOPSIS In F: Control PSGConf::Control::Solaris =head1 DESCRIPTION The B module provides a B control object for Solaris-specific configuration. It supports the following methods: =over 4 =item new() The constructor. Its parameter is a reference to the B object. It registers the following data objects: =over 4 =item I A B object that contains literal text to be added to F. =item I A B object that contains definitions for system variables to be added to F. =item I A B object that contains definitions for the F file. =item I A B object that contains definitions for a C file where the filename is the key, and the contents is an anomoyous hash of values to put into the admin file. =back =item decide() Under systems other than Solaris, returns without doing anything. Otherwise, does the following: =over 4 =item * Registers a B action object to create F. =item * Registers a B action object to create the directory F>. (The I data object is provided by the B module.) =item * Registers a B action object to run the C command to set the dump directory to F>. =item * Registers a B for each key in the I hash to create the admin files in F diretory. =item * Registers a B for creating the F file from the contents of the I hash. =item * Registers a B action object to run the C command every time the F file is updated. =back =back =head1 SEE ALSO L system(4) dumpadm(1M) L L L L L L L L L =cut