1 |
diff -urN smeserver-smbstatus-1.2.old/createlinks smeserver-smbstatus-1.2/createlinks |
2 |
--- smeserver-smbstatus-1.2.old/createlinks 2021-03-28 18:22:19.200819189 +0100 |
3 |
+++ smeserver-smbstatus-1.2/createlinks 2021-03-28 18:25:31.525686696 +0100 |
4 |
@@ -1,45 +1,32 @@ |
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-smbstatus-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 Manager panel link |
58 |
+#panel_link('somefunction', 'manager'); |
59 |
|
60 |
#-------------------------------------------------- |
61 |
# functions for manager panel |
62 |
#-------------------------------------------------- |
63 |
my $panel = "manager"; |
64 |
|
65 |
-#panel_link("function1", $panel); |
66 |
+panel_link("smbstatus", $panel); |
67 |
#panel_link("function2", $panel); |
68 |
|
69 |
#-------------------------------------------------- |
70 |
@@ -58,4 +45,3 @@ |
71 |
#event_link("action1", $event, "55"); |
72 |
#event_link("action2", $event, "90"); |
73 |
|
74 |
-safe_symlink("/etc/e-smith/web/functions/wrapper","root/etc/e-smith/web/panels/manager/cgi-bin/smbstatus"); |