package printer::services; use strict; use services; use run_program; sub restart ($) { my ($service) = @_; if (services::restart($service)) { # CUPS needs some time to come up. wait_for_cups() if $service eq "cups"; return 1; } else { return 0 } } sub start ($) { my ($service) = @_; if (services::start($service)) { # CUPS needs some time to come up. wait_for_cups() if $service eq "cups"; return 1; } else { return 0 } } sub start_not_running_service ($) { my ($service) = @_; # The exit status is not zero when the service is not running if (services::start_not_running_service($service)) { return 0; } else { run_program::rooted($::prefix, "/etc/rc.d/init.d/$service", "start"); if (($? >> 8) != 0) { return 0; } else { # CUPS needs some time to come up. wait_for_cups() if $service eq "cups"; return 1; } } } sub wait_for_cups() { # CUPS needs some time to come up. Wait up to 30 seconds, checking # whether CUPS is ready. my $cupsready = 0; my $i; for ($i = 0; $i < 30; $i++) { run_program::rooted($::prefix, "/usr/bin/lpstat", "-r"); if (($? >> 8) != 0) { # CUPS is not ready, continue sleep 1; } else { # CUPS is ready, quit $cupsready = 1; last; } } return $cupsready; } 1; alue='distro/mes5'>distro/mes5 Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/perl-install/install_messages.pm
blob: 764007fa1d6ad9c7822a3a0342ac516e181f9eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147