home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl -s
- # Create the directories needed for ftpmail to work
- # By Lee McLoughlin <lmjm@doc.ic.ac.uk>
- # You can do what you like with this except claim that you wrote it or
- # give copies with changes not approved by Lee. Neither Lee nor any other
- # organisation can be held liable for any problems caused by the use or
- # storage of this package.
- #
- # $Header: /a/swan/home/swan/staff/csg/lmjm/src/perl/mirror/ftpmail/RCS/inst.pl,v 1.7 1993/04/25 14:15:10 lmjm Exp lmjm $
- # $Log: inst.pl,v $
- # Revision 1.7 1993/04/25 14:15:10 lmjm
- # Allow for multiple help files (one per language).
- #
- # Revision 1.6 1993/04/23 23:27:05 lmjm
- # Massive renaming for sys5.
- #
- # Revision 1.5 1993/04/23 20:03:17 lmjm
- # Use own version of library routines before others.
- #
- # Revision 1.4 1993/04/23 17:23:39 lmjm
- # Renamed ftpmail-local-config.pl to ftpmail-config.pl
- # Made pathnames relative to $ftpmail_dir.
- #
- # Revision 1.3 1993/03/30 20:32:20 lmjm
- # Now requires an ftpmail account whose home directory everything is in
- # changed the -test option to use /tmp/ftpmail-test
- #
- # Revision 1.2 1993/03/23 21:40:12 lmjm
- # Cleaned up to use ftpmail's home and droped the .sh from the install.
- #
-
- $ftpmail = 'ftpmail';
-
- if( $test ){
- $ftpmail_dir = '/tmp/ftpmail-test';
- }
- else {
- # The ftpmail_dir is the home directory of ftpmail.
- $ftpmail_dir = (getpwnam( $ftpmail ))[ 7 ];
- $do_chown = 1;
- }
-
-
- mkdir( $ftpmail_dir, 0755 );
- print "mkdir $ftpmail_dir\n";
-
- if( ! $ftpmail_dir ){
- die "No home directory for ftpmail\n";
- }
-
- if( ! -d $ftpmail_dir ){
- die "no such directory as $ftpmail_dir\n";
- }
-
- chop( $here = `pwd` );
-
- chdir( $ftpmail_dir ) || die "cannot chdir to $ftpmail_dir\n";
-
- unshift( @INC, $here );
-
- require 'config.pl';
-
- @dirs = ( $tmpdir, $quedir, $helpdir );
- @files = (
- 'q.pl',
- 'dq.pl',
- 'support.pl',
- 'config.pl',
- 'ftp.pl',
- 'chat2.pl',
- 'socket.ph',
- $authfile );
- # All the help files are help_language
- @helpfiles = (
- 'help_english' );
-
- foreach $dir ( @dirs ){
- if( ! -d $dir ){
- print "mkdir $dir\n";
- if( ! mkdir( $dir, 0755 ) ){
- die "Failed to create $dir";
- }
- }
- }
-
- # Copy in the rest of the files
- print "Installing files\n";
- foreach $file ( @files ){
- print "copying $file\n";
- system( "cp $here/$file ." );
- }
- foreach $file ( @helpfiles ){
- print "copying $file\n";
- $f = $file;
- # change help_english -> english
- $f =~ s,help_,,;
- system( "cp $here/$file $helpdir/$f" );
- }
- link( "$helpdir/english", "$helpdir/help" );
- system( "chmod 755 q.pl dq.pl" );
- if( $do_chown ){
- $uid = (getpwnam( $ftpmail ))[ 2 ];
- chown $uid, 0, @files;
- chown $uid, 0, @dirs;
- chown $uid, 0, $ftpmail_dir;
- }
-