### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### FreeBSD.pm - FreeBSD module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::FreeBSD; use strict; use PSGConf::Action::GenerateFile::EnvFile; use PSGConf::Data::Hash; ############################################################################### ### policy methods ############################################################################### require Exporter; our @ISA = qw (Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( _mod_periodic ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} }); our @EXPORT = qw(); sub _mod_periodic { my ($self, $psgconf) = @_; $psgconf->data_obj('periodic')->insert ({ $self->{periodic} => $self->{periodic_value} }) if ( ! defined $psgconf->data_obj('periodic')->find($self->{periodic})); } sub _policy_modify_periodic { my ($self, $psgconf) = @_; $self->{periodic} = 'daily_status_security_logdir'; $self->{periodic_value} = $psgconf->data_obj('log_dir')->get() . '/syslog'; $self->_mod_periodic($psgconf); } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; return if (! $psgconf->data_obj('platform')->match('freebsd')); $psgconf->register_actions( PSGConf::Action::GenerateFile::EnvFile->new( 'name' => '/etc/rc.conf', 'description' => 'FreeBSD startup config file', 'quote_values' => 1, 'requires_reboot' => 1, 'vars' => $psgconf->data_obj('rc_vars')->get() ), PSGConf::Action::GenerateFile::EnvFile->new( 'name' => '/etc/sysctl.conf', 'description' => 'FreeBSD system control file', 'requires_reboot' => 1, 'vars' => $psgconf->data_obj('sysctl_vars')->get() ), PSGConf::Action::GenerateFile::EnvFile->new( 'name' => '/etc/periodic.conf', 'comment_str' => '###', 'description' => 'FreeBSD periodic config file', 'backup' => 1, 'quote_values' => 1, 'vars' => $psgconf->data_obj('periodic')->get() ) ); } ############################################################################### ### Constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'FreeBSD'; $psgconf->register_data( 'rc_vars' => PSGConf::Data::Hash->new(), 'sysctl_vars' => PSGConf::Data::Hash->new(), 'periodic' => PSGConf::Data::Hash->new(), ); $psgconf->register_policy($self, freebsd_modify_periodic => '_policy_modify_periodic' ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::FreeBSD - psgconf control class for FreeBSD-specific configuration =head1 SYNOPSIS In F: Control PSGConf::Control::FreeBSD =head1 DESCRIPTION The B module provides a B control object for FreeBSD-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 definitions for rc variables to be added to F. =item I A B object that contains definitions for system control variables to be added to F. =item I A B object that contains definitions for control variables to be added to F. =back =item decide() Under systems other than FreeBSD, returns without doing anything. Otherwise, registers B action objects to create the F, F and F files. =back =head1 SEE ALSO L Crc.conf(5)E> Cperiodic.conf(5)E> Csysctl.conf(5)E> L L L L =cut