#!/usr/bin/perl -w

my $root=$ARGV[0];

sub event_link
{
    my ($action, $event, $level) = @_;

	mkdir( "$root/etc/e-smith/events/${event}");
    unlink "$root/etc/e-smith/events/${event}/S${level}${action}";
    symlink("../actions/${action}",
	"$root/etc/e-smith/events/${event}/S${level}${action}")
    or die "Can't symlink to " .
	"$root/etc/e-smith/events/${event}/S${level}${action}: $!";
}

sub panel_link
{
    my ($function, $panel) = @_;

    unlink "$root/etc/e-smith/web/panels/$panel/cgi-bin/$function";
    symlink("../../../functions/$function",
	    "$root/etc/e-smith/web/panels/$panel/cgi-bin/$function")
	or die "Can't symlink to $root/etc/e-smith/web/panels/$panel".
	    "/cgi-bin/$function: $!";
}

event_link("affa-make-cronjobs", "post-upgrade", "90" );
