You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.0 KiB
93 lines
3.0 KiB
11 years ago
|
#!/usr/bin/perl -w
|
||
|
|
||
|
#----------------------------------------------------------------------
|
||
|
#
|
||
|
# Copyright (c) 2001 Daniel van Raay
|
||
|
#
|
||
|
# 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
|
||
|
#----------------------------------------------------------------------
|
||
|
|
||
|
package esmith;
|
||
|
|
||
|
use strict;
|
||
|
use Errno;
|
||
|
use esmith::config;
|
||
|
use esmith::util;
|
||
|
use esmith::db;
|
||
|
|
||
|
my %conf;
|
||
|
tie %conf, 'esmith::config';
|
||
|
|
||
|
my %accounts;
|
||
|
tie %accounts, 'esmith::config', '/home/e-smith/db/accounts';
|
||
|
|
||
|
#---------------------------------------------------------------------------
|
||
|
# clear and re-create all the user panel symlinks
|
||
|
#---------------------------------------------------------------------------
|
||
|
|
||
|
#clear
|
||
|
opendir (DIR, "/etc/e-smith/web/panels/user/cgi-bin/") or
|
||
|
die "Can't open directory /etc/e-smith/web/panels/user/cgi-bin/\n";
|
||
|
my @symlinks = grep (!/^\./, readdir (DIR));
|
||
|
closedir (DIR);
|
||
|
|
||
|
foreach my $link (@symlinks)
|
||
|
{
|
||
|
-e "/etc/e-smith/web/panels/user/cgi-bin/$link" && unlink("/etc/e-smith/web/panels/user/cgi-bin/$link");
|
||
|
}
|
||
|
|
||
|
#always link userpanels
|
||
|
my %newsymlinks;
|
||
|
opendir (DIR, "/etc/e-smith/web/functions/") or
|
||
|
die "Can't open directory /etc/e-smith/web/functions/\n";
|
||
|
foreach my $userpanels ( grep (/^(userpanel-initial|userpanel-navigation|userpanel-noframes|pleasewait)$/, readdir (DIR)) )
|
||
|
{
|
||
|
$newsymlinks{$userpanels} = 'Yes';
|
||
|
}
|
||
|
closedir (DIR);
|
||
|
|
||
|
#also add needed panels
|
||
|
foreach my $user (sort keys %accounts)
|
||
|
{
|
||
|
my $userAdminPanels = db_get_prop(\%accounts, $user, "AdminPanels");
|
||
|
$userAdminPanels = '' if ! defined ($userAdminPanels);
|
||
|
|
||
|
foreach my $panels (split (/,/, $userAdminPanels))
|
||
|
{
|
||
|
$newsymlinks{$panels} = 'Yes';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
foreach my $link ( sort keys %newsymlinks )
|
||
|
{
|
||
|
if ( -e "/etc/e-smith/web/functions/$link" &&
|
||
|
! -e "/etc/e-smith/web/panels/user/cgi-bin/$link" )
|
||
|
{
|
||
|
#symlink("../../../functions/$link", "/etc/e-smith/web/panels/user/cgi-bin/$link") ||
|
||
|
link("/etc/e-smith/web/functions/$link", "/etc/e-smith/web/panels/user/cgi-bin/$link") ||
|
||
|
warn "Couldn't link('functions/$link' to '/etc/e-smith/web/panels/user/cgi-bin/$link'): $!\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
system("/sbin/e-smith/expand-template /etc/httpd/admin-conf/httpd.conf") == 0
|
||
|
or warn ("Error expanding httpd.conf \n");
|
||
|
|
||
|
#system("/etc/rc.d/init.d/httpd-admin restart") == 0
|
||
|
# or warn ("Error occurred restarting httpd-admin \n");
|
||
|
esmith::util::backgroundCommand (1, "/usr/local/bin/svc", "-h", "/service/httpd-admin");# == 0
|
||
|
|
||
|
exit (0);
|
||
|
|