diff -urN smeserver-durep-1.5.0.old/createlinks smeserver-durep-1.5.0/createlinks --- smeserver-durep-1.5.0.old/createlinks 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-durep-1.5.0/createlinks 2020-10-23 12:03:51.203051620 +0100 @@ -0,0 +1,61 @@ +#!/usr/bin/perl -w +# This script creates the symlinks needed by this RPM +# Specific support exists to create symlinks within e-smith web "panels" +# and for links from named "events" directories into the "actions" directory + +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: $!"; +} + +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 event_link +{ + my ($action, $event, $level) = @_; + + 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}: $!"; +} + +#-------------------------------------------------- +# functions for manager panel +#-------------------------------------------------- +my $panel = "manager"; + +#panel_link("function1", $panel); +#panel_link("function2", $panel); + +#-------------------------------------------------- +# actions for console-save event: +#-------------------------------------------------- +$event = "console-save"; + +#event_link("action1", $event, "55"); +#event_link("action2", $event, "60"); + +#-------------------------------------------------- +# actions for domain-create event: +#-------------------------------------------------- +$event = "domain-create"; + +#event_link("action1", $event, "55"); +#event_link("action2", $event, "90"); + +safe_symlink("/etc/e-smith/web/functions/wrapper","root/etc/e-smith/web/panels/manager/cgi-bin/durep");