Setup - Global Customize functions
use vars qw(@ISA); use Setup; @ISA = qw(Setup);
This module implements standard customize functions, both functions that should be used in modules and internal customize functions.
First description of the arguments that are being used in the functions.
FILE, SRCFILE, DSTFILE are filenames. DATA is the data that is going to be inserted. PERM is if the file should have any specific permissions and its entered in an octal number. COMMENTSIGN is the commentsign to use when modifying a file. '#' is default. NOBACKUP set it to 1 if you don't want the function to take a backup for later uninstall
add_to_file('/etc/testfil','Testar',0755,'',1); $DATA = "set noexec_user_stack = 1\n"; $DATA .= "set noexec_user_stack_log = 1\n"; add_to_file('/etc/system',$DATA,'*');
The second exampel will give you this in your /etc/system
* BEGIN: setup_etc_system Checksum: 5139 set noexec_user_stack = 1 set noexec_user_stack_log = 1 * END: setup_etc_system Checksum: 5139
It returns 0 if an error accured, 1 if the file was changed and 2 if it didn't need to do anything.
verify_file('/etc/system',$DATA,'','*');
remove_from_file('/etc/testfil','',1); remove_from_file('/etc/system','*');
Returns 0 if an error accured, 1 if the file was changed and 2 if it didn't need to do anything
create_file($ypservers, $YPDATA, 0600);
verify_create_file($ypservers, $YPDATA, 0600);
symlink_file('/usr/src/tfil','/tfil');
verify_symlink_file('/opt/sendmail/8.10/sendmail','/usr/lib/sendmail');
restore_symlink_file('/usr/lib/sendmail');
get_datafile(SRCFILE)
If DSTFILE is a directory basename(SRCFILE)
is added to the path.
Then it checks if DSTFILE exists, size and its mtime. It compares
it with the SRCFILE and if its differs it will copy SRCFILE to DSTFILE.
The DSTFILE will be chown:ed if USER and GROUP is set. If only a
user is specified that users gid will be used. It is not allowed
to specify a group and not a user.
copy_file('rwhod','/etc/init.d/rwhod',0755,'root','sys'); copy_file('sendmail.cf','/etc/mail/sendmail.cf');
verify_copy_file('rwhod','/etc/init.d/',0755,'root','sys'); verify_copy_file('sendmail.cf','/etc/mail/sendmail.cf');
get_datafile(SRCFILE)
Then it copies it to the customize tempdirectory and searches
for @Custom::VAR_NAME@ and replaces it with the
value of $Custom::VAR_NAME. If the size or content diffs
with the DSTFILE it will replace it.
copy_template_file('customize','/usr/sbin/customize',0755);
verify_template_file('customize','/usr/sbin/customize',0755);
restore_file('/etc/mail/sendmail.cf');
rm_file('/etc/printers.conf');
verify_rm_file('/etc/printers.conf');
ch_file('/etc/init.d/sendmail','s/MODE=\"-bd\"/MODE=\"\"/');
verify_ch_file('/etc/init.d/sendmail','MODE=\"-bd\"');
verify_link("/usr/sbin/identd","/usr/lib/isaexec");
/custom/data/Local/<script name>/<OS>/filename /custom/data/Local/<script name>/filename /custom/data/<Category>/<script name>/<OS>/filename /custom/data/<Category>/<script name>/filename
get_datafile("${VER}/Driver.sis");
read_file("${Setup::TMPDIR}/sunrayinst.$$");
add_to_cron($CRONTAB);
verify_cron($CRONTAB);
remove_from_cron();
Returns true if its workhour. It can be usefull to know in scripts if we should start a process that can take several hours to complete or not. (Like patching Solaris machines).
Copyright (c) 2000-2001 Ericsson Erisoft AB. All rights reserved. Copyright (c) 2001-2003 Joacim Häggmark. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Joacim Häggmark <joacim@ludd.luth.se>