/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.0-movese_services_to_systemd.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme10/e-smith-base-5.8.0-movese_services_to_systemd.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Apr 12 04:00:49 2016 UTC (8 years, 6 months ago) by unnilennium
Branch: MAIN
CVS Tags: e-smith-base-5_8_0-71_el7_sme, e-smith-base-5_8_0-67_el7_sme, e-smith-base-5_8_0-64_el7_sme, e-smith-base-5_8_0-70_el7_sme, e-smith-base-5_8_0-60_el7_sme, e-smith-base-5_8_0-96_el7_sme, e-smith-base-5_8_0-21_el7_sme, e-smith-base-5_8_0-85_el7_sme, e-smith-base-5_8_0-50_el7_sme, e-smith-base-5_8_0-22_el7_sme, e-smith-base-5_8_0-81_el7_sme, e-smith-base-5_8_0-88_el7_sme, e-smith-base-5_8_0-99_el7_sme, e-smith-base-5_8_0-94_el7_sme, e-smith-base-5_8_0-98_el7_sme, e-smith-base-5_8_0-97_el7_sme, e-smith-base-5_8_0-39_el7_sme, e-smith-base-5_8_0-55_el7_sme, e-smith-base-5_8_0-62_el7_sme, e-smith-base-5_8_0-63_el7_sme, e-smith-base-5_8_0-86_el7_sme, e-smith-base-5_8_0-47_el7_sme, e-smith-base-5_8_0-40_el7_sme, e-smith-base-5_8_0-33_el7_sme, e-smith-base-5_8_0-42_el7_sme, e-smith-base-5_8_0-72_el7_sme, e-smith-base-5_8_0-69_el7_sme, e-smith-base-5_8_0-29_el7_sme, e-smith-base-5_8_0-54_el7_sme, e-smith-base-5_8_0-13_el7_sme, e-smith-base-5_8_0-78_el7_sme, e-smith-base-5_8_0-61_el7_sme, e-smith-base-5_8_0-38_el7_sme, e-smith-base-5_8_0-79_el7_sme, e-smith-base-5_8_0-32_el7_sme, e-smith-base-5_8_0-59_el7_sme, e-smith-base-5_8_0-43_el7_sme, e-smith-base-5_8_0-19_el7_sme, e-smith-base-5_8_0-27_el7_sme, e-smith-base-5_8_0-68_el7_sme, e-smith-base-5_8_0-84_el7_sme, e-smith-base-5_8_0-45_el7_sme, e-smith-base-5_8_0-51_el7_sme, e-smith-base-5_8_0-28_el7_sme, e-smith-base-5_8_0-26_el7_sme, e-smith-base-5_8_0-95_el7_sme, e-smith-base-5_8_0-49_el7_sme, e-smith-base-5_8_0-82_el7_sme, e-smith-base-5_8_0-44_el7_sme, e-smith-base-5_8_0-41_el7_sme, e-smith-base-5_8_0-75_el7_sme, e-smith-base-5_8_0-90_el7_sme, e-smith-base-5_8_0-93_el7_sme, e-smith-base-5_8_0-46_el7_sme, e-smith-base-5_8_0-12_el7_sme, e-smith-base-5_8_0-36_el7_sme, e-smith-base-5_8_0-15_el7_sme, e-smith-base-5_8_0-76_el7_sme, e-smith-base-5_8_0-30_el7_sme, e-smith-base-5_8_0-58_el7_sme, e-smith-base-5_8_0-18_el7_sme, e-smith-base-5_8_0-87_el7_sme, e-smith-base-5_8_0-66_el7_sme, e-smith-base-5_8_0-17_el7_sme, e-smith-base-5_8_0-16_el7_sme, e-smith-base-5_8_0-65_el7_sme, e-smith-base-5_8_0-23_el7_sme, e-smith-base-5_8_0-83_el7_sme, e-smith-base-5_8_0-80_el7_sme, e-smith-base-5_8_0-92_el7_sme, e-smith-base-5_8_0-20_el7_sme, e-smith-base-5_8_0-34_el7_sme, e-smith-base-5_8_0-37_el7_sme, e-smith-base-5_8_0-52_el7_sme, e-smith-base-5_8_0-74_el7_sme, e-smith-base-5_8_0-77_el7_sme, e-smith-base-5_8_0-73_el7_sme, e-smith-base-5_8_0-35_el7_sme, e-smith-base-5_8_0-91_el7_sme, e-smith-base-5_8_0-31_el7_sme, e-smith-base-5_8_0-53_el7_sme, e-smith-base-5_8_0-24_el7_sme, e-smith-base-5_8_0-14_el7_sme, e-smith-base-5_8_0-48_el7_sme, e-smith-base-5_8_0-89_el7_sme
Changes since 1.1: +4 -4 lines
* Mon Apr 11 2016 Jean-Philipe Pialasse <tests@pialasse.com> 5.8.0-11.sme
- rearange startup [SME: 9352]
- let systemd handle following unsupervised services:
- bootstrap-console, rsyslog, irqbalance, crond, acpid, smartd
- disable from systemd services whith link in rc7.d
- let bootstrap-console run at every reboot and handle surpevised services startup

1 unnilennium 1.1 diff -Nur e-smith-base-5.8.0.old/createlinks e-smith-base-5.8.0/createlinks
2     --- e-smith-base-5.8.0.old/createlinks 2016-04-11 22:14:33.297000000 -0400
3     +++ e-smith-base-5.8.0/createlinks 2016-04-11 22:47:13.131000000 -0400
4     @@ -375,6 +375,7 @@
5    
6     $event = "post-install";
7    
8     +event_link("fix-startup", $event, "05");
9     event_link("rotate_timestamped_logfiles", $event, "05");
10     event_link("init-accounts", $event, "05");
11     event_link("init-passwords", $event, "10");
12     @@ -388,6 +389,7 @@
13    
14     $event = "post-upgrade";
15    
16     +event_link("fix-startup", $event, "05");
17     event_link("rotate_timestamped_logfiles", $event, "05");
18     event_link("init-accounts", $event, "05");
19     event_link("conf-startup", $event, "10");
20     @@ -538,15 +540,8 @@
21     my %service2order =
22     (
23     # Start rsyslog up before network!
24     - rsyslog => "05",
25     - #klogd => "06",
26     - 'bootstrap-console' => "10",
27     raidmonitor => "15",
28     network => "37",
29     - irqbalance => "39",
30     - crond => "40",
31     - smartd => "40",
32     - acpid => "44",
33     dhcpd => "65",
34     'local' => "99",
35     );
36     @@ -581,3 +576,10 @@
37    
38     # no template headers for /etc/pam_ldap.secret
39     safe_touch("root/etc/e-smith/templates/etc/pam_ldap.secret/template-begin");
40     +
41     +
42     +system('mkdir -p root/usr/lib/systemd/system/multi-user.target.wants/');
43     + unlink "root/usr/lib/systemd/system/multi-user.target.wants/bootstrap-console.service";
44     +symlink("/usr/lib/systemd/system/bootstrap-console.service",
45     + "root/usr/lib/systemd/system/multi-user.target.wants/bootstrap-console.service")
46     + or die "Can't symlink to root/usr/lib/systemd/system/multi-user.target.wants/bootstrap-console.service: $!";
47     diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/fix-startup e-smith-base-5.8.0/root/etc/e-smith/events/actions/fix-startup
48     --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/fix-startup 1969-12-31 19:00:00.000000000 -0500
49     +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/fix-startup 2016-04-11 22:48:23.867000000 -0400
50     @@ -0,0 +1,42 @@
51     +#! /usr/bin/perl
52     +
53     +use strict;
54     +use warnings;
55     +use DirHandle;
56     +my $d = DirHandle->new("/etc/rc7.d");
57     +
58     +my @d =
59     + sort { $a->{order} cmp $b->{order} }
60     + map { /^S(\d+)([\w\-.]+)/ ; { name => $2 , order => $1 } }
61     + grep { /^S/ } $d->read;
62     +
63     +my $equivalent = {'oidentd'=> 'identd',
64     + 'nut'=> 'ups',
65     + 'raidmonitor' => 'mdmonitor'
66     + };
67     +
68     +
69     +foreach my $service (@d)
70     +{
71     +my $sv=$service->{'name'};
72     +next if $sv eq 'bootstrap-console';
73     +$sv= $equivalent->{$sv} || $sv;
74     +#print "$sv: ";
75     + if (-e "/lib/systemd/system/multi-user.target.wants/$sv.service")
76     + {
77     + #print "systemd (lib) ";
78     + system(qw(systemctl disable), $sv);
79     + }
80     + elsif (-e "/etc/systemd/system/multi-user.target.wants/$sv.service")
81     + {
82     + #print "systemd (etc)";
83     + system(qw(systemctl disable), $sv);
84     + }
85     + elsif (-e "/etc/init.d/$sv")
86     + {
87     + #print "chkconfig $sv off ";
88     + system("chkconfig", $sv, "off");
89     + #print "\n";
90     + }
91     + #else {print "\n";}
92     +}
93     diff -Nur e-smith-base-5.8.0.old/root/sbin/e-smith/bootstrap-console e-smith-base-5.8.0/root/sbin/e-smith/bootstrap-console
94     --- e-smith-base-5.8.0.old/root/sbin/e-smith/bootstrap-console 2014-03-23 22:47:25.000000000 -0400
95     +++ e-smith-base-5.8.0/root/sbin/e-smith/bootstrap-console 2016-04-11 22:42:48.072000000 -0400
96     @@ -48,6 +48,11 @@
97     use esmith::console::save_config;
98     esmith::console::save_config->new->doit($console, $db);
99    
100     +$ARGV[0] = 'tty';
101     +$console = esmith::console->new();
102     +use esmith::console::startup;
103     +esmith::console::startup->new->doit($console,$db);
104     +
105     system("/usr/bin/tput", "clear");
106     exit (0);
107    
108 unnilennium 1.2 diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/bootstrap-console.service e-smith-base-5.8.0/root/usr/lib/systemd/system/boostrap-console.service
109     --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/bootstrap-console.service 1969-12-31 19:00:00.000000000 -0500
110     +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/bootstrap-console.service 2016-04-11 22:23:50.332000000 -0400
111 unnilennium 1.1 @@ -0,0 +1,27 @@
112     +[Unit]
113 unnilennium 1.2 +Description=SME server bootstrap-console
114 unnilennium 1.1 +DefaultDependencies=no
115     +Conflicts=shutdown.target
116     +After=livesys.service plymouth-quit-wait.service
117     +After=systemd-vconsole-setup.service
118     +Before=getty@tty1.service
119     +Before=shutdown.target
120     +
121     +[Service]
122     +Environment=HOME=/root
123     +WorkingDirectory=/root
124     +ExecStartPre=-/bin/plymouth quit
125     +ExecStart=/sbin/e-smith/bootstrap-console
126     +Type=oneshot
127     +Restart=no
128     +TimeoutSec=0
129     +StandardInput=tty
130     +StandardOutput=tty
131     +StandardError=tty
132     +KillMode=process
133     +IgnoreSIGPIPE=no
134     +SendSIGHUP=yes
135     +
136     +[Install]
137     +WantedBy=multi-user.target
138     +
139     diff -Nur e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/console/startup.pm e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/console/startup.pm
140     --- e-smith-base-5.8.0.old/root/usr/share/perl5/vendor_perl/esmith/console/startup.pm 1969-12-31 19:00:00.000000000 -0500
141     +++ e-smith-base-5.8.0/root/usr/share/perl5/vendor_perl/esmith/console/startup.pm 2016-04-11 22:36:08.133000000 -0400
142     @@ -0,0 +1,132 @@
143     +package esmith::console::startup;
144     +use Locale::gettext;
145     +use esmith::console;
146     +use esmith::ConfigDB;
147     +use strict;
148     +use warnings;
149     +
150     +sub new
151     +{
152     + my $class = shift;
153     + my $self = {
154     + @_,
155     + };
156     + bless $self, $class;
157     + return $self;
158     +}
159     +
160     +sub startup_callback {
161     + my $fd = shift;
162     + my @out = ();
163     + my $done = 0;
164     +
165     + use DirHandle;
166     + my $d = DirHandle->new("/etc/rc7.d");
167     + my @services = sort
168     + {
169     + $a =~ /^S(\d+)/; my $A = $1;
170     + $b =~ /^S(\d+)/; my $B = $1;
171     + $A <=> $B
172     + } grep { /^S/ } $d->read;
173     + my $rows = 12;
174     + my $status_col = 65;
175     +
176     + my $db = esmith::ConfigDB->open_ro;
177     + my $rec = $db->get('smb');
178     + my $i=0;
179     + foreach (@services) {
180     + $i=$i+1;
181     + next unless /^S(\d+)([^\.][\.\w\-]+)$/;
182     + next unless $2 eq "smb";
183     + splice @services,$i-1 , 1, "S${1}4smbd", "S${1}5nmbd" unless ($rec and $rec->prop('status') eq 'disabled');
184     + last;
185     + }
186     +
187     +
188     + open(STDOUT, ">&STDERR");
189     + foreach (@services)
190     + {
191     + sleep 1;
192     + my $percent = int(($done * 100) / ($#services + 1));
193     + $done += 1;
194     + my $link = $_;
195     + #warn "Looking at symlink $_\n";
196     + next unless /^S\d+([^\.][\.\w\-]+)$/; # Untaint service name
197     + my $service = $1;
198     + #my $db = esmith::ConfigDB->open_ro;
199     + $rec = $db->get($service);
200     + do
201     + {
202     + warn "not starting disabled service $service\n";
203     + next;
204     + } unless ($rec and $rec->prop('status') eq 'enabled');
205     + my $prompt = "starting ";
206     + my $supervised = -x "/service/$service/run";
207     + my @cmd;
208     + if (-x "/service/$service/run")
209     + {
210     + $prompt .= " supervised service $service";
211     + warn "starting supervised service $service\n";
212     + @cmd = ("sv", "up", "/service/$service");
213     + }
214     + elsif (-x "/etc/init.d/$service")
215     + {
216     + $prompt .= " unsupervised service $service";
217     + warn "starting unsupervised service $service\n";
218     + @cmd = ("/etc/init.d/$service", "start");
219     + }
220     + else
221     + {
222     + warn "ignoring unknown service $service: bogus start symlink $link\n";
223     + next;
224     + }
225     +
226     + push @out, "$prompt\n";
227     + print $fd "XXX\n";
228     + print $fd "$percent\n";
229     + my @show = $#out > $rows ? @out[$#out - $rows .. $#out] : @out;
230     + do { print $fd $_ } foreach @show;
231     + print $fd "XXX\n";
232     + $prompt .= " " x ($status_col - length($prompt));
233     + $prompt .= system(@cmd) ? "\\Z1FAILED\\Zn" : "\\Z2OK\\Zn";
234     + $out[-1] = "$prompt\n";
235     + @show = $#out > $rows ? @out[$#out - $rows .. $#out] : @out;
236     + print $fd "XXX\n";
237     + print $fd "$percent\n";
238     + do { print $fd $_ } foreach @show;
239     + print $fd "XXX\n";
240     + }
241     + print $fd "100\n";
242     + sleep 2;
243     + return undef;
244     +};
245     +
246     +my $console = esmith::console->new;
247     +
248     +sub doit
249     +{
250     + my ($self, $console, $db) = @_;
251     +
252     + $console->infobox
253     + (
254     + title => gettext("Starting system services"),
255     + text => "\n" .
256     + gettext("Please standby while system services are started ..."
257     +),
258     + );
259     +
260     + system(qw(touch /var/lock/subsys/backup-running));
261     + system(qw(chown admin /var/lock/subsys/backup-running));
262     + sleep(6); # Wait to be certain that all runsv services have been started.
263     + $console->gauge(\&startup_callback,
264     + text => '',
265     + title => 'Starting system services',
266     + colors => 1,
267     + no_collapse => 1);
268     +}
269     +
270     +#use esmith::console;
271     +#use esmith::ConfigDB;
272     +#esmith::console::startup->new->doit(esmith::console->new(),
273     +# esmith::ConfigDB->open);
274     +1;

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed