1 |
brianr |
1.1 |
diff -urN smeserver-crontab_manager-2.4.old/createlinks smeserver-crontab_manager-2.4/createlinks |
2 |
|
|
--- smeserver-crontab_manager-2.4.old/createlinks 2021-03-24 06:09:49.807319619 +0000 |
3 |
|
|
+++ smeserver-crontab_manager-2.4/createlinks 2021-03-24 06:11:41.660369950 +0000 |
4 |
|
|
@@ -1,61 +1,23 @@ |
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 |
|
|
+use esmith::Build::CreateLinks qw(:all); |
32 |
|
|
+# our event specific for updating with yum without reboot |
33 |
|
|
+$event = 'smeserver-crontab_manager-update'; |
34 |
|
|
+#add here the path to your templates needed to expand |
35 |
|
|
+#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event |
36 |
|
|
+ |
37 |
|
|
+foreach my $file (qw( |
38 |
|
|
+ /etc/systemd/system-preset/49-koozali.preset |
39 |
|
|
+)) |
40 |
|
|
{ |
41 |
|
|
- my ($action, $event, $level) = @_; |
42 |
|
|
- |
43 |
|
|
- unlink "root/etc/e-smith/events/${event}/S${level}${action}"; |
44 |
|
|
- symlink("../actions/${action}", |
45 |
|
|
- "root/etc/e-smith/events/${event}/S${level}${action}") |
46 |
|
|
- or die "Can't symlink to " . |
47 |
|
|
- "root/etc/e-smith/events/${event}/S${level}${action}: $!"; |
48 |
|
|
+ templates2events( $file, $event ); |
49 |
|
|
} |
50 |
|
|
+#action needed in case we have a systemd unit |
51 |
|
|
+event_link('systemd-default', $event, '10'); |
52 |
|
|
+event_link('systemd-reload', $event, '50'); |
53 |
|
|
+#action specific to this package |
54 |
|
|
+#event_link('action', $event, '30'); |
55 |
|
|
+#services we need to restart |
56 |
|
|
+#safe_symlink('restart', 'root/etc/e-smith/events/$event/services2adjust/<service>) |
57 |
|
|
+#and Server Mmanager panel link |
58 |
|
|
+panel_link('cronmanager', 'manager'); |
59 |
|
|
|
60 |
|
|
-#-------------------------------------------------- |
61 |
|
|
-# functions for manager panel |
62 |
|
|
-#-------------------------------------------------- |
63 |
|
|
-my $panel = "manager"; |
64 |
|
|
- |
65 |
|
|
-#panel_link("function1", $panel); |
66 |
|
|
-#panel_link("function2", $panel); |
67 |
|
|
- |
68 |
|
|
-#-------------------------------------------------- |
69 |
|
|
-# actions for console-save event: |
70 |
|
|
-#-------------------------------------------------- |
71 |
|
|
-$event = "console-save"; |
72 |
|
|
- |
73 |
|
|
-#event_link("action1", $event, "55"); |
74 |
|
|
-#event_link("action2", $event, "60"); |
75 |
|
|
- |
76 |
|
|
-#-------------------------------------------------- |
77 |
|
|
-# actions for domain-create event: |
78 |
|
|
-#-------------------------------------------------- |
79 |
|
|
-$event = "domain-create"; |
80 |
|
|
- |
81 |
|
|
-#event_link("action1", $event, "55"); |
82 |
|
|
-#event_link("action2", $event, "90"); |
83 |
|
|
- |
84 |
|
|
-safe_symlink("/etc/e-smith/web/functions/wrapper","root/etc/e-smith/web/panels/manager/cgi-bin/cronmanager"); |