#!/usr/bin/perl -w #---------------------------------------------------------------------- # copyright (C) 1999-2003 Mitel Networks Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Technical support for this program is available from Mitel Networks # Please visit our web site www.mitel.com/sme/ for details. #---------------------------------------------------------------------- package esmith; use strict; use Errno; use esmith::util; use esmith::AccountsDB; # Populate pre-defined Primary i-bay # Start with top level owner/permissions my $files = "/home/e-smith/files"; my $perms = 0755; my $owner = 'root'; my $group = 'root'; foreach (qw(Primary Primary/cgi-bin Primary/html Primary/files)) { my $dir = "$files/ibays/$_"; unless (-d "$dir") { mkdir ($dir, $perms) or warn "Could not create dir $dir: $!"; chmod ($perms, $dir) or warn "Could not chmod dir $dir: $!"; esmith::util::chownFile($owner, $group, $dir); } # Switch to subdir owner/permissions $perms = 02750; $owner = 'admin'; $group = 'shared'; } # Create a starter website index page if necessary if( !grep /\.\w+$/, ) { system("/bin/cp", "-p", "/etc/e-smith/skel/e-smith/files/primary/html/index.htm", "/home/e-smith/files/ibays/Primary/html/index.htm"); chmod 0640, "/home/e-smith/files/ibays/Primary/html/index.htm"; esmith::util::chownFile('admin', 'shared', "/home/e-smith/files/ibays/Primary/html/index.htm"); } exit (0);