e-smith-test/createlinks

44 lines
1009 B
Perl
Executable File

#!/usr/bin/perl -w
sub safe_symlink {
my ($from, $to) = @_;
use File::Basename;
use File::Path;
mkpath(dirname($to));
unlink($to);
symlink($from, $to) or die "Can't create symlink from $from to $to: $!";
}
sub panel_link
{
my ($function, $panel) = @_;
my $cgibin = "root/etc/e-smith/web/panels/$panel/cgi-bin";
safe_symlink("../../../functions/$function",
"$cgibin/$function")
}
sub event_link
{
my ($action, $event, $level) = @_;
safe_symlink("../actions/${action}",
"root/etc/e-smith/events/${event}/S${level}${action}");
}
#--------------------------------------------------
# actions for post-install event
#--------------------------------------------------
$event = "post-install";
event_link("testing-conf", $event, "90");
#--------------------------------------------------
# actions for post-upgrade event
#--------------------------------------------------
$event = "post-upgrade";
event_link("testing-conf", $event, "90");