### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### motd.pm - /etc/motd module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::motd; use strict; use PSGConf::Action::GenerateFile::Literal; use PSGConf::Data::String; use PSGConf::Util; ############################################################################### ### policy methods ############################################################################### sub _policy_expand_tokens { my ($self, $psgconf) = @_; $psgconf->data_obj('motd')->set ( &PSGConf::Util::_expand_tokens( $psgconf, $psgconf->data_obj('motd')->get(), ) ); } sub _policy_modify_rc_vars { my ($self, $psgconf) = @_; $psgconf->data_obj('rc_vars')->insert( { 'update_motd' => 'NO' } ) if ($psgconf->data_obj('platform')->match('freebsd')); } ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; $psgconf->register_actions( PSGConf::Action::GenerateFile::Literal->new( name => '/etc/motd', content => $psgconf->data_obj('motd')->get(), comment_str => undef ) ); } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'motd'; $psgconf->register_data( motd => PSGConf::Data::String->new() ); $psgconf->register_policy($self, motd_expand_tokens => '_policy_expand_tokens', motd_modify_rc_vars => '_policy_modify_rc_vars', ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::motd - psgconf control class for generating /etc/motd =head1 SYNOPSIS In F: Control PSGConf::Control::motd =head1 DESCRIPTION The B module provides a B control object for generating /etc/motd. 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 containing the text to be written to the F file. =back The constructor also registers the following policy methods: =over 4 =item I Expands the tokens of the form C<%{data_object_name}> in the I Data object. =item I On FreeBSD systems, modifies the I data object (provided by B) to avoid overwriting F. =back =item decide() Registers a B object to create F. =back =head1 SEE ALSO L L L L L L L =cut