1 |
brianr |
1.1 |
diff -urN smeserver-durep-1.5.0.old/createlinks smeserver-durep-1.5.0/createlinks |
2 |
|
|
--- smeserver-durep-1.5.0.old/createlinks 1970-01-01 01:00:00.000000000 +0100 |
3 |
|
|
+++ smeserver-durep-1.5.0/createlinks 2020-10-23 12:03:51.203051620 +0100 |
4 |
|
|
@@ -0,0 +1,61 @@ |
5 |
|
|
+#!/usr/bin/perl -w |
6 |
|
|
+# This script creates the symlinks needed by this RPM |
7 |
|
|
+# Specific support exists to create symlinks within e-smith web "panels" |
8 |
|
|
+# and for links from named "events" directories into the "actions" directory |
9 |
|
|
+ |
10 |
|
|
+sub panel_link |
11 |
|
|
+{ |
12 |
|
|
+ my ($function, $panel) = @_; |
13 |
|
|
+ |
14 |
|
|
+ unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function"; |
15 |
|
|
+ symlink("../../../functions/$function", |
16 |
|
|
+ "root/etc/e-smith/web/panels/$panel/cgi-bin/$function") |
17 |
|
|
+ or die "Can't symlink to root/etc/e-smith/web/panels/$panel". |
18 |
|
|
+ "/cgi-bin/$function: $!"; |
19 |
|
|
+} |
20 |
|
|
+ |
21 |
|
|
+sub safe_symlink { |
22 |
|
|
+ my ($from, $to) = @_; |
23 |
|
|
+ use File::Basename; |
24 |
|
|
+ use File::Path; |
25 |
|
|
+ mkpath(dirname($to)); |
26 |
|
|
+ unlink($to); |
27 |
|
|
+ symlink($from, $to) or die "Can't create symlink from $from to $to: $!"; |
28 |
|
|
+} |
29 |
|
|
+ |
30 |
|
|
+sub event_link |
31 |
|
|
+{ |
32 |
|
|
+ my ($action, $event, $level) = @_; |
33 |
|
|
+ |
34 |
|
|
+ unlink "root/etc/e-smith/events/${event}/S${level}${action}"; |
35 |
|
|
+ symlink("../actions/${action}", |
36 |
|
|
+ "root/etc/e-smith/events/${event}/S${level}${action}") |
37 |
|
|
+ or die "Can't symlink to " . |
38 |
|
|
+ "root/etc/e-smith/events/${event}/S${level}${action}: $!"; |
39 |
|
|
+} |
40 |
|
|
+ |
41 |
|
|
+#-------------------------------------------------- |
42 |
|
|
+# functions for manager panel |
43 |
|
|
+#-------------------------------------------------- |
44 |
|
|
+my $panel = "manager"; |
45 |
|
|
+ |
46 |
|
|
+#panel_link("function1", $panel); |
47 |
|
|
+#panel_link("function2", $panel); |
48 |
|
|
+ |
49 |
|
|
+#-------------------------------------------------- |
50 |
|
|
+# actions for console-save event: |
51 |
|
|
+#-------------------------------------------------- |
52 |
|
|
+$event = "console-save"; |
53 |
|
|
+ |
54 |
|
|
+#event_link("action1", $event, "55"); |
55 |
|
|
+#event_link("action2", $event, "60"); |
56 |
|
|
+ |
57 |
|
|
+#-------------------------------------------------- |
58 |
|
|
+# actions for domain-create event: |
59 |
|
|
+#-------------------------------------------------- |
60 |
|
|
+$event = "domain-create"; |
61 |
|
|
+ |
62 |
|
|
+#event_link("action1", $event, "55"); |
63 |
|
|
+#event_link("action2", $event, "90"); |
64 |
|
|
+ |
65 |
|
|
+safe_symlink("/etc/e-smith/web/functions/wrapper","root/etc/e-smith/web/panels/manager/cgi-bin/durep"); |