### ### Copyright 2000-2007 University of Illinois Board of Trustees ### ### ShellStartupFiles.pm - shell startup files module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::ShellStartupFiles; use strict; use PSGConf::Action::GenerateFile::etc_cshrc; use PSGConf::Action::GenerateFile::etc_profile; use PSGConf::Data::Hash; use PSGConf::Data::List; use PSGConf::Data::String; ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; my ($cshrc, $profile, $path, $manpath, $env_vars, $shell_aliases); $cshrc = $psgconf->data_obj('cshrc_path')->get(); $profile = $psgconf->data_obj('profile_path')->get(); $path = $psgconf->data_obj('path')->get(); $manpath = $psgconf->data_obj('manpath')->get(); $env_vars = $psgconf->data_obj('env_vars')->get(); $shell_aliases = $psgconf->data_obj('shell_aliases')->get(); $psgconf->register_actions( PSGConf::Action::GenerateFile::etc_cshrc->new( name => $cshrc, description => 'csh and tcsh startup file', path => $path, manpath => $manpath, env_vars => $env_vars, shell_aliases => $shell_aliases, commands => $psgconf->data_obj('cshrc_commands')->get() ), PSGConf::Action::GenerateFile::etc_profile->new( name => $profile, description => 'sh and ksh startup file', path => $path, manpath => $manpath, env_vars => $env_vars, shell_aliases => $shell_aliases, commands => $psgconf->data_obj('profile_commands')->get() ) ); } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'ShellStartupFiles'; $psgconf->register_data( cshrc_path => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/etc/csh.cshrc' ), profile_path => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/etc/profile' ), cshrc_commands => PSGConf::Data::String->new(), profile_commands => PSGConf::Data::String->new(), path => PSGConf::Data::List->new( 'value_abspath' => 1, ), manpath => PSGConf::Data::List->new( value_abspath => 1 ), env_vars => PSGConf::Data::Hash->new(), shell_aliases => PSGConf::Data::Hash->new() ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::ShellStartupFiles - psgconf control class for shell startup files =head1 SYNOPSIS In F: Control PSGConf::Control::ShellStartupFiles =head1 DESCRIPTION The B module provides a B control object for configuring shell startup files. 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 absolute path to the system-wide csh(1)/tcsh(1) startup file. The default is C. =item I A B object containing the absolute path to the system-wide sh(1)/ksh(1) startup file. The default is C. =item I A B object containing commands to be added to the csh(1)/tcsh(1) startup file. =item I A B object containing commands to be added to the sh(1)/ksh(1) startup file. =item I A B object containing the directories to be added to the C environment variable. =item I A B object containing the directories to be added to the C environment variable. =item I A B object containing environment variables to be set in the shell startup files. =item I A B object containing shell aliases (or functions) to be set in the shell startup files. The arguments to the alias should be encoded with the CARGSE> token. =back =item decide() Registers a B object to generate the default csh(1)/tcsh(1) startup file in the location specified by the I Data object. Also registers a B object to generate the default sh(1)/ksh(1) startup file in the location specified by the I Data object. =back =head1 SEE ALSO L L L L L L L L =cut