Import Debian changes 1.09.0-1
insserv (1.09.0-1) unstable; urgency=low
* New upstream release. (Closes: #426091)
- Support X-Start-Before and X-Stop-After (Closes: #326120)
- Building with DEB_BUILD_OPTIONS=nostrip no longer strip the
binary. (Closes: #437210)
* Let /usr/share/insserv/check-initd-order read override files in
/etc/insserv/overrides/ just like insserv does. Patch from Arjan
Oosting. (Closes: #429398)
* Correct the dependencies for nbd-client and libnss-ldap.
* Add override file for spamassassin.
* Update watch file with new upstream URL. (Closes: #450044)
Petter Reinholdtsen authored 16 years ago
Dmitry Bogatov committed 5 years ago
0 | ------------------------------------------------------------------- | |
1 | Tue Jan 16 14:04:06 CET 2007 - werner@suse.de | |
2 | ||
3 | - Remove obsolate `$netdaemons' facility (#209380) | |
4 | - Add `start this script before' feature (fate #301269) | |
5 | ||
6 | ------------------------------------------------------------------- | |
7 | Mon Nov 20 11:42:40 CET 2006 - werner@suse.de | |
8 | ||
9 | - Expand aliases even for services which requires $all (#216202) | |
10 | ||
11 | ------------------------------------------------------------------- | |
12 | Mon May 15 12:56:27 CEST 2006 - werner@suse.de | |
13 | ||
14 | - Make kdump boot script a interactive script to enforce that this | |
15 | script runs not in parallel with other script (#175340, #171332) | |
16 | ||
17 | ------------------------------------------------------------------- | |
18 | Wed Mar 8 17:06:47 CET 2006 - werner@suse.de | |
19 | ||
20 | - Ignore .orig and .org file (bug #155944) | |
21 | ||
22 | ------------------------------------------------------------------- | |
23 | Wed Mar 1 12:51:17 CET 2006 - werner@suse.de | |
24 | ||
25 | - Add a few lines about $all into the man page (bug #151561) | |
26 | ||
27 | ------------------------------------------------------------------- | |
28 | Mon Feb 6 16:40:46 CET 2006 - werner@suse.de | |
29 | ||
30 | - Handle duplets even for interactive scripts | |
31 | ||
32 | ------------------------------------------------------------------- | |
33 | Tue Jan 31 15:06:53 CET 2006 - werner@suse.de | |
34 | ||
35 | - Be sure to find all interactive scripts and set their unique | |
36 | start number. This solves the problem of two interactive | |
37 | scripts in the same start order. | |
38 | ||
39 | ------------------------------------------------------------------- | |
40 | Tue Apr 4 18:23:24 CEST 2006 - werner@suse.de | |
41 | ||
42 | - Add patches from Petter Reinholdtsen | |
43 | - Make debian part work | |
44 | ||
0 | 45 | ------------------------------------------------------------------- |
1 | 46 | Wed Jan 25 14:52:26 CET 2006 - werner@suse.de |
2 | 47 |
12 | 12 | DEBUG = |
13 | 13 | ISSUSE = -DSUSE |
14 | 14 | DESTDIR = |
15 | VERSION = 1.08.0 | |
15 | VERSION = 1.09.0 | |
16 | 16 | DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]') |
17 | 17 | |
18 | 18 | # |
38 | 38 | RM = rm -f |
39 | 39 | MKDIR = mkdir -p |
40 | 40 | RMDIR = rm -rf |
41 | INSTBINFLAGS = -s -m 0700 | |
41 | INSTBINFLAGS = -m 0700 | |
42 | 42 | INSTBIN = install $(INSTBINFLAGS) |
43 | 43 | INSTSRPFLAGS = -m 0700 |
44 | 44 | INSTSRP = install $(INSTSRPFLAGS) |
0 | insserv (1.09.0-1) unstable; urgency=low | |
1 | ||
2 | * New upstream release. (Closes: #426091) | |
3 | - Support X-Start-Before and X-Stop-After (Closes: #326120) | |
4 | - Building with DEB_BUILD_OPTIONS=nostrip no longer strip the | |
5 | binary. (Closes: #437210) | |
6 | * Let /usr/share/insserv/check-initd-order read override files in | |
7 | /etc/insserv/overrides/ just like insserv does. Patch from Arjan | |
8 | Oosting. (Closes: #429398) | |
9 | * Correct the dependencies for nbd-client and libnss-ldap. | |
10 | * Add override file for spamassassin. | |
11 | * Update watch file with new upstream URL. (Closes: #450044) | |
12 | ||
13 | -- Petter Reinholdtsen <pere@debian.org> Sat, 17 Nov 2007 21:17:20 +0100 | |
14 | ||
0 | 15 | insserv (1.08.0-14) unstable; urgency=low |
1 | 16 | |
2 | 17 | * Correct the dependencies for hwclock.sh. |
16 | 16 | #$rcbase = "/opt/ltsp/i386/etc"; |
17 | 17 | |
18 | 18 | my $overridepath = "/usr/share/insserv/overrides"; |
19 | my $hostoverridepath = "/etc/insserv/overrides"; | |
19 | 20 | |
20 | 21 | my $debug = 0; |
21 | 22 | |
207 | 208 | |
208 | 209 | sub load_lsb_tags { |
209 | 210 | my ($initfile, $useoverrides) = @_; |
210 | print STDERR "Loading $initfile\n" if $debug; | |
211 | my $lsbinforef = load_lsb_tags_from_file($initfile); | |
212 | ||
213 | if ($useoverrides) { | |
214 | # Try override file | |
215 | $initfile = readlink($initfile) if (-l $initfile); | |
216 | my $basename = basename($initfile); | |
217 | ||
218 | # Only read shipped override file when initscript does not | |
219 | # contain LSB tags. | |
220 | if (! defined($lsbinforef) && -f "$overridepath/$basename") { | |
221 | print STDERR "Override $overridepath/$basename\n" if $debug; | |
222 | $lsbinforef = load_lsb_tags_from_file("$overridepath/$basename"); | |
223 | } | |
224 | ||
225 | # Always read the host override in $hostoverridepath. | |
226 | if (-f "$hostoverridepath/$basename") { | |
227 | print STDERR "Override $hostoverridepath/$basename\n" if $debug; | |
228 | $lsbinforef = load_lsb_tags_from_file("$hostoverridepath/$basename"); | |
229 | } | |
230 | ||
231 | } | |
232 | return $lsbinforef; | |
233 | } | |
234 | ||
235 | sub load_lsb_tags_from_file { | |
236 | my ($file) = @_; | |
237 | print STDERR "Loading $file\n" if $debug; | |
211 | 238 | ### BEGIN INIT INFO |
212 | 239 | # Provides: xdebconfigurator |
213 | 240 | # Required-Start: $syslog |
218 | 245 | # Description: Preseed X configuration and use dexconf to |
219 | 246 | # genereate a new configuration file. |
220 | 247 | ### END INIT INFO |
221 | unless (open(FILE, "<$initfile")) { | |
222 | warn "error: Unable to read $initfile"; | |
248 | unless (open(FILE, "<$file")) { | |
249 | warn "error: Unable to read $file"; | |
223 | 250 | return; |
224 | 251 | } |
225 | 252 | my $found = 0; |
238 | 265 | } |
239 | 266 | close(FILE); |
240 | 267 | |
241 | # Try override file | |
242 | $initfile = readlink($initfile) if (-l $initfile); | |
243 | my $basename = basename($initfile); | |
244 | ||
245 | if (!$found) { | |
246 | if ($useoverrides && -f "$overridepath/$basename") { | |
247 | print STDERR "Override $overridepath/$basename\n" | |
248 | if $debug; | |
249 | return load_lsb_tags("$overridepath/$basename", $useoverrides); | |
250 | } | |
251 | } | |
252 | 268 | return undef unless ($found); |
253 | 269 | |
254 | 270 | # print "Provides: $provides\n" if $provides; |
258 | 274 | 'required-stop' => $requiredstop, |
259 | 275 | 'should-start' => $shouldstart, |
260 | 276 | 'should-stop' => $shouldstop, |
261 | 'file' => $initfile, | |
277 | 'file' => $file, | |
262 | 278 | }; |
263 | 279 | } |
0 | 0 | ### BEGIN INIT INFO |
1 | 1 | # Provides: libnss-ldap |
2 | 2 | # Required-Start: mountkernfs |
3 | # Required-Stop: | |
3 | # Required-Stop: $local_fs | |
4 | 4 | # Default-Start: S |
5 | # Default-Stop: 0 2 3 4 5 6 | |
5 | # Default-Stop: 0 6 | |
6 | 6 | ### END INIT INFO |
0 | 0 | ### BEGIN INIT INFO |
1 | 1 | # Provides: nbd-client |
2 | 2 | # Required-Start: $network |
3 | # X-Start-Before: $remote_fs | |
3 | 4 | # Required-Stop: $network |
4 | # Default-Start: S 1 2 3 4 5 | |
5 | # Default-Stop: 0 6 | |
5 | # Default-Start: 2 3 4 5 | |
6 | # Default-Stop: 0 1 6 | |
6 | 7 | ### END INIT INFO |
0 | ### BEGIN INIT INFO | |
1 | # Provides: spamassassin | |
2 | # Required-Start: $remote_fs | |
3 | # Required-Stop: $remote_fs | |
4 | # Default-Start: 2 3 4 5 | |
5 | # Default-Stop: 0 1 6 | |
6 | ### END INIT INFO |
0 | #10_readme | |
1 | 0 | 20_overrides |
2 | #30_non_suse | |
3 | 1 | 31_debian_conf |
4 | 2 | 32_debian_nolsb |
5 | 3 | 33_debian_localok |
6 | #34_debian | |
7 | 35_fixunused | |
8 | 36_memleak | |
9 | 37_consistent_path | |
10 | 4 | 38_debuginfo |
11 | 39_debianlvl | |
12 | 5 | 40_nosusescript |
13 | 6 | 41_debiandefault |
14 | #51_cfgfilter_dpkg | |
7 | 42_redundantlvl |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 10_readme.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ## | |
3 | ## All lines beginning with `## DP:' are a description of the patch. | |
4 | ## DP: Add URL to upstream source in README. | |
5 | ||
6 | @DPATCH@ | |
7 | diff -ur insserv-1.04.0/README insserv-1.04.0/README | |
8 | --- insserv-1.04.0/README 2005-09-14 17:53:05.000000000 +0200 | |
9 | +++ insserv-1.04.0/README 2005-11-10 21:47:38.000000000 +0100 | |
10 | @@ -5,6 +5,12 @@ | |
11 | boot scripts used by the system during boot time), | |
12 | type `make' and `make install'. | |
13 | ||
14 | + Downloading latest version | |
15 | + ========================== | |
16 | + | |
17 | +The latest version of the insserv source is available from | |
18 | +<URL: ftp://ftp.suse.com/pub/projects/init/ >. | |
19 | + | |
20 | Processes controlling | |
21 | ===================== | |
22 |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 30_non_suse.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ## | |
3 | ## All lines beginning with `## DP:' are a description of the patch. | |
4 | ## DP: Avoid crashing with null-pointer when compiling without SUSE flag. | |
5 | ||
6 | @DPATCH@ | |
7 | --- insserv-1.04.0.orig/insserv.c | |
8 | +++ insserv-1.04.0/insserv.c | |
9 | @@ -1984,7 +1984,7 @@ | |
10 | * default_stop arn't used in SuSE Linux. | |
11 | */ | |
12 | if (script_inf.default_stop && script_inf.default_stop != empty) { | |
13 | - if (!service || !del) | |
14 | + if (service && !del) | |
15 | service->lvlk = str2lvl(script_inf.default_stop); | |
16 | } | |
17 | #endif |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 34_debian.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ## | |
3 | ## All lines beginning with `## DP:' are a description of the patch. | |
4 | ## DP: Fix a few remaining ../init.d/ issues. | |
5 | ||
6 | @DPATCH@ | |
7 | --- insserv-1.03.0.orig/insserv.c | |
8 | +++ insserv-1.03.0/insserv.c | |
9 | @@ -1877,17 +1877,21 @@ | |
10 | * Do _not_ set default stop levels | |
11 | */ | |
12 | } | |
13 | -#endif | |
14 | +#endif /* not SUSE */ | |
15 | } | |
16 | } | |
17 | free(begin); | |
18 | } | |
19 | ||
20 | +#ifdef SUSE | |
21 | /* Ahh ... set default multiuser with network */ | |
22 | if (!script_inf.default_start) | |
23 | script_inf.default_start = xstrdup("3 5"); | |
24 | -#ifndef SUSE | |
25 | - /* Do _not_ set default stop levels */ | |
26 | +#else /* not SUSE */ | |
27 | + if (!script_inf.default_start) | |
28 | + script_inf.default_start = xstrdup("2 3 4 5"); /* for Debian*/ | |
29 | + if (!script_inf.default_stop) | |
30 | + script_inf.default_stop = xstrdup("S 0 1 6"); /* for Debian*/ | |
31 | #endif | |
32 | ||
33 | if (chkfor(d->d_name, argv, argc) && !defaults) { | |
34 | @@ -2265,7 +2269,7 @@ | |
35 | order = (maxorder + 1) - order; | |
36 | } | |
37 | ||
38 | - sprintf(olink, "../%s", script); | |
39 | + sprintf(olink, "../init.d/%s", script); | |
40 | sprintf(nlink, "%c%.2d%s", mode, order, script); | |
41 | ||
42 | found = false; |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 35_fixunused.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ||
3 | When uploading version 1.08.0 of insserv into Debian this build | |
4 | warning was discovered on s390: | |
5 | ||
6 | insserv.c:35: warning: type qualifiers ignored on function return type | |
7 | insserv.c:36: warning: type qualifiers ignored on function return type | |
8 | insserv.c:1237: warning: type qualifiers ignored on function return type | |
9 | insserv.c:1242: warning: type qualifiers ignored on function return type | |
10 | ||
11 | The problem is the use of the unused attribute. There is also a | |
12 | problem with lack of 'const' on the map_runlevel_to_location() | |
13 | function. This patch fixes these problems. | |
14 | ||
15 | It was sent upstream 2006-04-01 and found to be fixed in version | |
16 | 1.09.0. | |
17 | ||
18 | @DPATCH@ | |
19 | --- insserv-1.08.0.orig/insserv.c | |
20 | +++ insserv-1.08.0/insserv.c | |
21 | @@ -30,9 +30,11 @@ | |
22 | #include <getopt.h> | |
23 | #include "listing.h" | |
24 | ||
25 | -static char *map_runlevel_to_location(const int runlevel); | |
26 | -static const int map_runlevel_to_lvl (const int runlevel) __attribute__ ((unused)); | |
27 | -static const int map_runlevel_to_seek(const int runlevel) __attribute__ ((unused)); | |
28 | +static const char *map_runlevel_to_location(const int runlevel); | |
29 | +#ifndef SUSE | |
30 | +static const int map_runlevel_to_lvl (const int runlevel); | |
31 | +static const int map_runlevel_to_seek(const int runlevel); | |
32 | +#endif /* not SUSE */ | |
33 | ||
34 | #ifndef INITDIR | |
35 | # define INITDIR "/etc/init.d" | |
36 | @@ -1140,11 +1142,12 @@ | |
37 | ||
38 | #define RUNLEVLES (sizeof(runlevel_locations)/sizeof(runlevel_locations[0])) | |
39 | ||
40 | -static char *map_runlevel_to_location(const int runlevel) | |
41 | +static const char *map_runlevel_to_location(const int runlevel) | |
42 | { | |
43 | return runlevel_locations[runlevel].location; | |
44 | } | |
45 | ||
46 | +#ifndef SUSE | |
47 | static const int map_runlevel_to_lvl(const int runlevel) | |
48 | { | |
49 | return runlevel_locations[runlevel].lvl; | |
50 | @@ -1154,6 +1157,7 @@ | |
51 | { | |
52 | return runlevel_locations[runlevel].seek; | |
53 | } | |
54 | +#endif /* not SUSE */ | |
55 | ||
56 | /* | |
57 | * Scan current service structure | |
58 | @@ -1164,7 +1164,7 @@ | |
59 | ||
60 | pushd(path); | |
61 | for (runlevel = 0; runlevel < RUNLEVLES; runlevel++) { | |
62 | - char * rcd = NULL; | |
63 | + const char * rcd = NULL; | |
64 | DIR * rcdir; | |
65 | struct dirent *d; | |
66 | char * token; | |
67 | @@ -2134,7 +2134,7 @@ | |
68 | int order; | |
69 | const char * script; | |
70 | char nlink[PATH_MAX+1], olink[PATH_MAX+1]; | |
71 | - char * rcd = NULL; | |
72 | + const char * rcd = NULL; | |
73 | DIR * rcdir; | |
74 | ||
75 | rcd = map_runlevel_to_location(runlevel); | |
76 | @@ -2280,7 +2280,7 @@ | |
77 | int lvl = 0, seek = 0; | |
78 | const char * script; | |
79 | char nlink[PATH_MAX+1], olink[PATH_MAX+1]; | |
80 | - char * rcd = NULL; | |
81 | + const char * rcd = NULL; | |
82 | DIR * rcdir; | |
83 | ||
84 | rcd = map_runlevel_to_location(runlevel); |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 36_memleak.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ||
3 | Fix minor memleak. Patch sent upstream 2006-04-01. Seem to be fixed | |
4 | in version 1.09.0. | |
5 | ||
6 | --- insserv-1.08.0.orig/insserv.c | |
7 | +++ insserv-1.08.0/insserv.c | |
8 | @@ -1773,7 +1773,7 @@ | |
9 | } | |
10 | if (!script_inf.default_start || script_inf.default_start == empty) { | |
11 | if (guess->lvls) | |
12 | - script_inf.default_start = xstrdup(lvl2str(guess->lvls)); | |
13 | + script_inf.default_start = lvl2str(guess->lvls); | |
14 | } | |
15 | } else { | |
16 | /* | |
17 | @@ -1795,7 +1795,7 @@ | |
18 | ||
19 | list_for_each(req, &(cur->sort.req)) { | |
20 | if (!strcmp(getreq(req)->serv, script_inf.provides)) { | |
21 | - script_inf.default_start = xstrdup(lvl2str(getserv(ptr)->lvls)); | |
22 | + script_inf.default_start = lvl2str(getserv(ptr)->lvls); | |
23 | break; | |
24 | } | |
25 | } |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 37_consistent_path.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ||
3 | Make sure the following invocations of insserv uses the same path to | |
4 | init.d/: | |
5 | ||
6 | insserv -nv | |
7 | insserv -nv /etc/init.d | |
8 | insserv -nv /etc/init.d/ | |
9 | insserv -nv /etc/init.d/hostname.sh | |
10 | ||
11 | Without this patch, they will use '/etc/init.d' and /etc/init.d/' | |
12 | respectively, and this produces strange paths in the log output. | |
13 | ||
14 | It was sent upstream 2006-09-07. The issue seem to be fixed slightly | |
15 | different in version 1.09.0. | |
16 | ||
17 | @DPATCH@ | |
18 | --- insserv-1.08.0.orig/insserv.c | |
19 | +++ insserv-1.08.0/insserv.c | |
20 | @@ -1651,7 +1651,15 @@ | |
21 | } | |
22 | ||
23 | if (S_ISDIR(st_script.st_mode)) { | |
24 | - path = *argv; | |
25 | + | |
26 | + /* Remove trailing slash from the directory path */ | |
27 | + if ('/' == (*argv)[strlen(*argv)-1]) { | |
28 | + char * ptr = xstrdup(*argv); | |
29 | + ptr[strlen(ptr)-1] = '\0'; | |
30 | + path = ptr; | |
31 | + } else | |
32 | + path = *argv; | |
33 | + | |
34 | if (del) | |
35 | error("usage: %s [[-r] init_script|init_directory]\n", myname); | |
36 | argv++; | |
37 | @@ -1662,7 +1670,7 @@ | |
38 | char * base, * ptr = xstrdup(*argv); | |
39 | ||
40 | if ((base = strrchr(ptr, '/'))) { | |
41 | - *(++base) = '\0'; | |
42 | + *(base) = '\0'; | |
43 | path = ptr; | |
44 | } else | |
45 | free(ptr); |
0 | 0 | #! /bin/sh /usr/share/dpatch/dpatch-run |
1 | 1 | ## 38_debuginfo.dpatch by Petter Reinholdtsen <pere@hungry.com> |
2 | 2 | |
3 | Change debug output to print symbolic runlevel names instead of a hex | |
3 | Change debug output to print symbolic runlevel names as wellas a hex | |
4 | 4 | value with the bit pattern representing the runlevels. |
5 | 5 | |
6 | 6 | @DPATCH@ |
12 | 12 | if (dir->script) |
13 | 13 | - fprintf(stderr, "%.2d %s 0x%.2x (%s)\n", |
14 | 14 | - dir->order, dir->script, dir->lvl, dir->name); |
15 | + fprintf(stderr, "%.2d %s '%s' (%s)\n", | |
16 | + dir->order, dir->script, lvl2str(dir->lvl), dir->name); | |
15 | + fprintf(stderr, "%.2d %s 0x%.2x '%s' (%s)\n", | |
16 | + dir->order, dir->script, dir->lvl, lvl2str(dir->lvl), dir->name); | |
17 | 17 | else |
18 | 18 | - fprintf(stderr, "%.2d %s 0x%.2x (%%%s)\n", |
19 | 19 | - dir->order, dir->name, dir->lvl, *dir->name == '$' ? "system" : "guessed"); |
20 | + fprintf(stderr, "%.2d %s '%s' (%%%s)\n", | |
21 | + dir->order, dir->name, lvl2str(dir->lvl), *dir->name == '$' ? "system" : "guessed"); | |
20 | + fprintf(stderr, "%.2d %s 0x%.2x '%s' (%%%s)\n", | |
21 | + dir->order, dir->name, dir->lvl, lvl2str(dir->lvl), *dir->name == '$' ? "system" : "guessed"); | |
22 | 22 | } |
23 | 23 | } |
24 | 24 | #endif |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 39_debianlvl.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ||
3 | Adjust insserv to handle 'S' in the init.d script level list as the | |
4 | boot directory on debian. A better solution would be to reengineer | |
5 | insserv to have the runlevel info in one location instead of all over | |
6 | the code. | |
7 | ||
8 | @DPATCH@ | |
9 | --- insserv-1.08.0.orig/insserv.c | |
10 | +++ insserv-1.08.0/insserv.c | |
11 | @@ -418,7 +418,11 @@ | |
12 | ||
13 | switch (runlvl) { | |
14 | case 0: serv->lvls |= LVL_HALT; break; | |
15 | +#ifdef SUSE | |
16 | case 1: serv->lvls |= LVL_ONE; break; | |
17 | +#else /* not SUSE */ | |
18 | + case 1: serv->lvls |= LVL_SINGLE; break; | |
19 | +#endif | |
20 | case 2: serv->lvls |= LVL_TWO; break; | |
21 | case 3: serv->lvls |= LVL_THREE; break; | |
22 | case 4: serv->lvls |= LVL_FOUR; break; | |
23 | @@ -1133,6 +1137,7 @@ | |
24 | {"../rc4.d/", LVL_FOUR, LVL_NORM}, | |
25 | {"../rc5.d/", LVL_FIVE, LVL_NORM}, | |
26 | {"../rc6.d/", LVL_REBOOT, LVL_NORM}, | |
27 | + {"../rc1.d/", LVL_ONE, LVL_NORM}, /* placeholder */ | |
28 | {"../rcS.d/", LVL_BOOT, LVL_BOOT}, /* runlevel S */ | |
29 | /* On e.g. Debian there exist no boot.d */ | |
30 | #endif /* not SUSE */ | |
31 | --- insserv-1.08.0.orig/listing.c | |
32 | +++ insserv-1.08.0/listing.c | |
33 | @@ -578,9 +578,15 @@ | |
34 | if (!strpbrk(token, "0123456sSbB")) | |
35 | continue; | |
36 | if (*token == 'S' || *token == 's') | |
37 | +#ifdef SUSE | |
38 | num = 7; | |
39 | +#else | |
40 | + num = 8; | |
41 | +#endif | |
42 | +#ifdef SUSE | |
43 | else if (*token == 'B' || *token == 'b') | |
44 | num = 8; | |
45 | +#endif /* SUSE */ | |
46 | else | |
47 | num = atoi(token); | |
48 | switch (num) { |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 42_redundantlvl.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ||
3 | Rewrite most locations with hardcoded information about levels to use | |
4 | the runlevel_locations array to fetch the information instead. This | |
5 | reduces the redundancy and make it easier to keep the level settings | |
6 | in sync across the code. | |
7 | ||
8 | The runlevel_locations array is extended to include the runlevel kode | |
9 | in it. | |
10 | ||
11 | @DPATCH@ | |
12 | --- insserv-1.09.0.orig/insserv.c | |
13 | +++ insserv-1.09.0/insserv.c | |
14 | @@ -31,8 +31,8 @@ | |
15 | #include "listing.h" | |
16 | ||
17 | static const char *map_runlevel_to_location(const int runlevel); | |
18 | +const int map_runlevel_to_lvl (const int runlevel); | |
19 | #ifndef SUSE | |
20 | -static const int map_runlevel_to_lvl (const int runlevel); | |
21 | static const int map_runlevel_to_seek(const int runlevel); | |
22 | #endif /* not SUSE */ | |
23 | ||
24 | @@ -418,22 +418,7 @@ | |
25 | if (serv->order < order) | |
26 | serv->order = order; | |
27 | ||
28 | - switch (runlvl) { | |
29 | - case 0: serv->lvls |= LVL_HALT; break; | |
30 | - case 1: serv->lvls |= LVL_ONE; break; | |
31 | - case 2: serv->lvls |= LVL_TWO; break; | |
32 | - case 3: serv->lvls |= LVL_THREE; break; | |
33 | - case 4: serv->lvls |= LVL_FOUR; break; | |
34 | - case 5: serv->lvls |= LVL_FIVE; break; | |
35 | - case 6: serv->lvls |= LVL_REBOOT; break; | |
36 | -#ifdef SUSE | |
37 | - case 7: serv->lvls |= LVL_SINGLE; break; | |
38 | - case 8: serv->lvls |= LVL_BOOT; break; | |
39 | -#else /* not SUSE */ | |
40 | - case 7: serv->lvls |= LVL_BOOT; break; | |
41 | -#endif /* not SUSE */ | |
42 | - default: break; | |
43 | - } | |
44 | + serv->lvls |= map_runlevel_to_lvl(runlvl); | |
45 | ||
46 | return serv; | |
47 | } | |
48 | @@ -1124,45 +1109,82 @@ | |
49 | char *location; | |
50 | const int lvl; | |
51 | const int seek; | |
52 | + char key; | |
53 | } runlevel_locations[] = { | |
54 | #ifdef SUSE /* SuSE's SystemV link scheme */ | |
55 | - {"rc0.d/", LVL_HALT, LVL_NORM}, | |
56 | - {"rc1.d/", LVL_ONE, LVL_NORM}, /* runlevel 1 switch over to single user mode */ | |
57 | - {"rc2.d/", LVL_TWO, LVL_NORM}, | |
58 | - {"rc3.d/", LVL_THREE, LVL_NORM}, | |
59 | - {"rc4.d/", LVL_FOUR, LVL_NORM}, | |
60 | - {"rc5.d/", LVL_FIVE, LVL_NORM}, | |
61 | - {"rc6.d/", LVL_REBOOT, LVL_NORM}, | |
62 | - {"rcS.d/", LVL_SINGLE, LVL_NORM}, /* runlevel S is for single user mode */ | |
63 | - {"boot.d/", LVL_BOOT, LVL_BOOT}, /* runlevel B is for system initialization */ | |
64 | + {"rc0.d/", LVL_HALT, LVL_NORM, '0'}, | |
65 | + {"rc1.d/", LVL_ONE, LVL_NORM, '1'}, /* runlevel 1 switch over to single user mode */ | |
66 | + {"rc2.d/", LVL_TWO, LVL_NORM, '2'}, | |
67 | + {"rc3.d/", LVL_THREE, LVL_NORM, '3'}, | |
68 | + {"rc4.d/", LVL_FOUR, LVL_NORM, '4'}, | |
69 | + {"rc5.d/", LVL_FIVE, LVL_NORM, '5'}, | |
70 | + {"rc6.d/", LVL_REBOOT, LVL_NORM, '6'}, | |
71 | + {"rcS.d/", LVL_SINGLE, LVL_NORM, 'S'}, /* runlevel S is for single user mode */ | |
72 | + {"boot.d/", LVL_BOOT, LVL_BOOT, 'B'}, /* runlevel B is for system initialization */ | |
73 | #else /* not SUSE (actually, Debian) */ | |
74 | - {"../rc0.d/", LVL_HALT, LVL_NORM}, | |
75 | - {"../rc1.d/", LVL_ONE, LVL_NORM}, /* runlevel 1 switch over to single user mode */ | |
76 | - {"../rc2.d/", LVL_TWO, LVL_NORM}, | |
77 | - {"../rc3.d/", LVL_THREE, LVL_NORM}, | |
78 | - {"../rc4.d/", LVL_FOUR, LVL_NORM}, | |
79 | - {"../rc5.d/", LVL_FIVE, LVL_NORM}, | |
80 | - {"../rc6.d/", LVL_REBOOT, LVL_NORM}, | |
81 | - {"../rcS.d/", LVL_BOOT, LVL_BOOT}, /* runlevel S is for system initialization */ | |
82 | + {"../rc0.d/", LVL_HALT, LVL_NORM, '0'}, | |
83 | + {"../rc1.d/", LVL_ONE, LVL_NORM, '1'}, /* runlevel 1 switch over to single user mode */ | |
84 | + {"../rc2.d/", LVL_TWO, LVL_NORM, '2'}, | |
85 | + {"../rc3.d/", LVL_THREE, LVL_NORM, '3'}, | |
86 | + {"../rc4.d/", LVL_FOUR, LVL_NORM, '4'}, | |
87 | + {"../rc5.d/", LVL_FIVE, LVL_NORM, '5'}, | |
88 | + {"../rc6.d/", LVL_REBOOT, LVL_NORM, '6'}, | |
89 | + {"../rcS.d/", LVL_BOOT, LVL_BOOT, 'S'}, /* runlevel S is for system initialization */ | |
90 | /* On e.g. Debian there exist no boot.d */ | |
91 | #endif /* not SUSE */ | |
92 | }; | |
93 | ||
94 | #define RUNLEVLES (sizeof(runlevel_locations)/sizeof(runlevel_locations[0])) | |
95 | ||
96 | +const int map_has_runlevels(void) | |
97 | +{ | |
98 | + return RUNLEVLES; | |
99 | +} | |
100 | + | |
101 | +const char map_runlevel_to_key(const int runlevel) | |
102 | +{ | |
103 | + if (runlevel >= RUNLEVLES) { | |
104 | + warn("Wrong runlevel %d\n", runlevel); | |
105 | + } | |
106 | + return runlevel_locations[runlevel].key; | |
107 | +} | |
108 | + | |
109 | +const int map_key_to_lvl(const char key) | |
110 | +{ | |
111 | + int runlevel; | |
112 | + const char uckey = toupper(key); | |
113 | + for (runlevel = 0; runlevel < RUNLEVLES; runlevel++) { | |
114 | + if (uckey == runlevel_locations[runlevel].key) | |
115 | + return runlevel_locations[runlevel].lvl; | |
116 | + } | |
117 | + warn("Wrong runlevel key '%c'\n", uckey); | |
118 | + return 0; | |
119 | +} | |
120 | + | |
121 | static const char *map_runlevel_to_location(const int runlevel) | |
122 | { | |
123 | + if (runlevel >= RUNLEVLES) { | |
124 | + warn("Wrong runlevel %d\n", runlevel); | |
125 | + } | |
126 | return runlevel_locations[runlevel].location; | |
127 | } | |
128 | ||
129 | -#ifndef SUSE | |
130 | -static const int map_runlevel_to_lvl(const int runlevel) | |
131 | +const int map_runlevel_to_lvl(const int runlevel) | |
132 | { | |
133 | + if (runlevel >= RUNLEVLES) { | |
134 | + warn("Wrong runlevel %d\n", runlevel); | |
135 | + return 0; | |
136 | + } | |
137 | return runlevel_locations[runlevel].lvl; | |
138 | } | |
139 | ||
140 | +#ifndef SUSE | |
141 | static const int map_runlevel_to_seek(const int runlevel) | |
142 | { | |
143 | + if (runlevel >= RUNLEVLES) { | |
144 | + warn("Wrong runlevel %d\n", runlevel); | |
145 | + return LVL_NORM; | |
146 | + } | |
147 | return runlevel_locations[runlevel].seek; | |
148 | } | |
149 | #endif /* not SUSE */ | |
150 | --- insserv-1.09.0.orig/listing.c | |
151 | +++ insserv-1.09.0/listing.c | |
152 | @@ -58,6 +58,9 @@ | |
153 | #define DIR_LOOP 0x00000002 | |
154 | #define DIR_ISACTIVE 0x00000004 | |
155 | ||
156 | +/* From insserv.c */ | |
157 | +extern const int map_has_runlevels(void); | |
158 | +extern const int map_runlevel_to_lvl (const int runlevel); | |
159 | /* | |
160 | * Provide or find a service dir, set initial states and | |
161 | * link it into the maintaining if a new one. | |
162 | @@ -428,24 +431,7 @@ | |
163 | boolean ret = false; | |
164 | unsigned int lvl = 0; | |
165 | ||
166 | - switch (runlevel) { | |
167 | - case 0: lvl = LVL_HALT; break; | |
168 | - case 1: lvl = LVL_ONE; break; | |
169 | - case 2: lvl = LVL_TWO; break; | |
170 | - case 3: lvl = LVL_THREE; break; | |
171 | - case 4: lvl = LVL_FOUR; break; | |
172 | - case 5: lvl = LVL_FIVE; break; | |
173 | - case 6: lvl = LVL_REBOOT; break; | |
174 | -#ifdef SUSE | |
175 | - case 7: lvl = LVL_SINGLE; break; | |
176 | - case 8: lvl = LVL_BOOT; break; | |
177 | -#else | |
178 | - case 7: lvl = LVL_BOOT; break; | |
179 | -#endif /* not SUSE */ | |
180 | - | |
181 | - default: | |
182 | - warn("Wrong runlevel %d\n", runlevel); | |
183 | - } | |
184 | + lvl = map_runlevel_to_lvl (runlevel); | |
185 | ||
186 | list_for_each(tmp, d_start) { | |
187 | dir_t * dir = getdir(tmp); | |
188 | @@ -480,23 +466,7 @@ | |
189 | if (!*script) | |
190 | tmp = d_start->next; | |
191 | ||
192 | - switch (runlevel) { | |
193 | - case 0: lvl = LVL_HALT; break; | |
194 | - case 1: lvl = LVL_ONE; break; | |
195 | - case 2: lvl = LVL_TWO; break; | |
196 | - case 3: lvl = LVL_THREE; break; | |
197 | - case 4: lvl = LVL_FOUR; break; | |
198 | - case 5: lvl = LVL_FIVE; break; | |
199 | - case 6: lvl = LVL_REBOOT; break; | |
200 | -#ifdef SUSE | |
201 | - case 7: lvl = LVL_SINGLE; break; | |
202 | - case 8: lvl = LVL_BOOT; break; | |
203 | -#else | |
204 | - case 7: lvl = LVL_BOOT; break; | |
205 | -#endif /* not SUSE */ | |
206 | - default: | |
207 | - warn("Wrong runlevel %d\n", runlevel); | |
208 | - } | |
209 | + lvl = map_runlevel_to_lvl (runlevel); | |
210 | ||
211 | do { | |
212 | ret = false; | |
213 | @@ -587,30 +557,7 @@ | |
214 | if (!strpbrk(token, "0123456sSbB")) | |
215 | continue; | |
216 | ||
217 | - if (*token == 'S' || *token == 's') | |
218 | - num = 7; | |
219 | - else if (*token == 'B' || *token == 'b') | |
220 | - num = 8; | |
221 | - else | |
222 | - num = atoi(token); | |
223 | - | |
224 | - switch (num) { | |
225 | - case 0: ret |= LVL_HALT; break; | |
226 | - case 1: ret |= LVL_ONE; break; | |
227 | - case 2: ret |= LVL_TWO; break; | |
228 | - case 3: ret |= LVL_THREE; break; | |
229 | - case 4: ret |= LVL_FOUR; break; | |
230 | - case 5: ret |= LVL_FIVE; break; | |
231 | - case 6: ret |= LVL_REBOOT; break; | |
232 | -#ifdef SUSE | |
233 | - case 7: ret |= LVL_SINGLE; break; | |
234 | - case 8: ret |= LVL_BOOT; break; | |
235 | -#else | |
236 | - case 7: ret |= LVL_BOOT; break; | |
237 | -#endif /* not SUSE */ | |
238 | - default: | |
239 | - warn("Wrong runlevel %d\n", num); | |
240 | - } | |
241 | + ret |= map_key_to_lvl(*token); | |
242 | } | |
243 | ||
244 | return ret; |
0 | #! /bin/sh /usr/share/dpatch/dpatch-run | |
1 | ## 51_cfgfilter_dpkg.dpatch by Petter Reinholdtsen <pere@hungry.com> | |
2 | ## | |
3 | ## All lines beginning with `## DP:' are a description of the patch. | |
4 | ## DP: Ignore tempfiles from dpkg. Fixes bug #326445. | |
5 | ||
6 | --- insserv-1.02.0.orig/insserv.c | |
7 | +++ insserv-1.02.0/insserv.c | |
8 | @@ -1290,6 +1293,7 @@ | |
9 | !strncmp(end, "ba", 2) || /* .bak, .backup, ... */ | |
10 | !strcmp(end, "old") || | |
11 | !strcmp(end, "new") || | |
12 | + !strncmp(end, "dpkg", 3) || /* .dpkg-old, .dpkg-new ... */ | |
13 | !strcmp(end, "save") || | |
14 | !strcmp(end, "swp") || /* Used by vi like editors */ | |
15 | !strcmp(end, "core")) /* modern core dump */ |
5 | 5 | |
6 | 6 | PACKAGE = insserv |
7 | 7 | |
8 | CFLAGS = -W -g | |
8 | CFLAGS = -W -Wall -g | |
9 | 9 | |
10 | 10 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
11 | 11 | CFLAGS += -O0 |
12 | 12 | else |
13 | 13 | CFLAGS += -O2 |
14 | 14 | endif |
15 | ||
16 | #CFLAGS += -DDEBUG=1 | |
15 | 17 | |
16 | 18 | INSTALL = install |
17 | 19 | INSTALL_DATA = $(INSTALL) -m644 |
24 | 26 | |
25 | 27 | build: build-stamp |
26 | 28 | |
27 | build-stamp: patch-stamp | |
29 | build-stamp: patch-stamp | |
28 | 30 | dh_testdir |
29 | 31 | |
30 | 32 | # Add here commands to compile the package. |
82 | 84 | |
83 | 85 | binary: binary-indep binary-arch |
84 | 86 | .PHONY: build clean binary-indep binary-arch binary install |
87 | ||
88 | # List the init.d missing LSB headers and override files | |
89 | missing-overrides: | |
90 | @GET http://lintian.debian.org/reports/Tinit.d-script-missing-lsb-section.html| grep W: | rev | cut -d/ -f1 | rev | sort > missing | |
91 | @ls debian/overrides/ |sort > overrides | |
92 | @echo "Init.d scripts in need of overrides:" | |
93 | @echo $$(comm -23 missing overrides) |fold -s | sed 's/^/ /' | |
94 | ||
95 | @echo -n "Scripts missing overrides: "; comm -23 missing overrides|wc -l | |
96 | @echo -n "Scripts with overrides and no LSB header: "; comm -12 missing overrides|wc -l | |
97 | @echo -n "Scripts with overrides and LSB header: "; comm -13 missing overrides|wc -l |
2 | 2 | |
3 | 3 | version=2 |
4 | 4 | |
5 | ftp://ftp.suse.com/pub/suse/i386/current/suse/src/insserv-(.*)\.src\.rpm debian uupdate | |
5 | ftp://ftp.suse.com/pub/projects/init/insserv-(.*).tar.gz debian uupdate |
0 | Begin3 | |
1 | Title: insserv tool for boot scripts | |
2 | Version: 1.08.0 | |
3 | Entered-date: 06FEB06 | |
4 | Description: Used for enabling of installed boot scripts | |
5 | by scanning comment headers which are LSB conform. | |
6 | Keywords: boot service control, LSB | |
7 | Author: Werner Fink <werner@suse.de> | |
8 | Maintained-by: Werner Fink <werner@suse.de> | |
9 | Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init | |
10 | @UNKNOWN insserv-1.08.0.tar.gz | |
11 | Alternate-site: ftp.suse.com /pub/projects/init | |
12 | Platforms: Linux with System VR2 or higher boot scheme | |
13 | Copying-policy: GPL | |
14 | End |
0 | Begin3 | |
1 | Title: insserv tool for boot scripts | |
2 | Version: 1.09.0 | |
3 | Entered-date: 16JAN07 | |
4 | Description: Used for enabling of installed boot scripts | |
5 | by scanning comment headers which are LSB conform. | |
6 | Keywords: boot service control, LSB | |
7 | Author: Werner Fink <werner@suse.de> | |
8 | Maintained-by: Werner Fink <werner@suse.de> | |
9 | Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init | |
10 | @UNKNOWN insserv-1.09.0.tar.gz | |
11 | Alternate-site: ftp.suse.com /pub/projects/init | |
12 | Platforms: Linux with System VR2 or higher boot scheme | |
13 | Copying-policy: GPL | |
14 | End |
50 | 50 | # Required-Stop: boot_facility_1 [ boot_facility_2 ...] |
51 | 51 | # Should-Start: boot_facility_1 [ boot_facility_2 ...] |
52 | 52 | # Should-Stop: boot_facility_1 [ boot_facility_2 ...] |
53 | # X-Start-Before: boot_facility_1 [ boot_facility_2 ...] | |
54 | # X-Stop-After: boot_facility_1 [ boot_facility_2 ...] | |
53 | 55 | # Default-Start: run_level_1 [ run_level_2 ...] |
54 | 56 | # Default-Stop: run_level_1 [ run_level_2 ...] |
55 | 57 | # Description: multiline_description |
61 | 63 | Please note, that the |
62 | 64 | .BR Required-Stop, |
63 | 65 | .BR Should-Stop , |
66 | .BR X-Stop-After, | |
64 | 67 | and |
65 | 68 | .B Default\-Stop |
66 | 69 | are ignored in SuSE Linux, because the SuSE boot script concept |
67 | 70 | uses a differential link scheme (see |
68 | 71 | .IR init.d (7)). |
72 | The optional | |
73 | .B X\-Start\-Before | |
74 | keyword implies that the script using this keyword | |
75 | should be started | |
76 | .B before | |
77 | the specified service names. This implies that those | |
78 | services now depend on the specifying script. | |
69 | 79 | With known dependencies and runlevel(s) |
70 | 80 | .B insserv |
71 | 81 | sets and reorders the corresponding symbolic links |
144 | 154 | as an interactive one, e.g. a service which requires |
145 | 155 | a passphrase or password input during boot |
146 | 156 | or runlevel change. |
157 | .P | |
158 | Beside the defined | |
159 | .B System Facilities | |
160 | in the configuration file | |
161 | .IR /etc/insserv.conf , | |
162 | .B insserv | |
163 | also knows the special facility | |
164 | .BR $all . | |
165 | This facility indicates that a service should be inserted | |
166 | at the end of all services. Clearly all services using | |
167 | this facility will be grouped into one starting order. | |
147 | 168 | .\" |
148 | 169 | .SH OPTIONS |
149 | 170 | Currently there are only four options for |
239 | 260 | *.ba* |
240 | 261 | *.old |
241 | 262 | *.new |
263 | *.org | |
264 | *.orig | |
242 | 265 | *.save |
243 | 266 | *.swp |
244 | 267 | *.core |
29 | 29 | #include <getopt.h> |
30 | 30 | #include "listing.h" |
31 | 31 | |
32 | static char *map_runlevel_to_location(const int runlevel); | |
33 | static const int map_runlevel_to_lvl (const int runlevel) __attribute__ ((unused)); | |
34 | static const int map_runlevel_to_seek(const int runlevel) __attribute__ ((unused)); | |
32 | static const char *map_runlevel_to_location(const int runlevel); | |
33 | #ifndef SUSE | |
34 | static const int map_runlevel_to_lvl (const int runlevel); | |
35 | static const int map_runlevel_to_seek(const int runlevel); | |
36 | #endif /* not SUSE */ | |
35 | 37 | |
36 | 38 | #ifndef INITDIR |
37 | 39 | # define INITDIR "/etc/init.d" |
423 | 425 | case 4: serv->lvls |= LVL_FOUR; break; |
424 | 426 | case 5: serv->lvls |= LVL_FIVE; break; |
425 | 427 | case 6: serv->lvls |= LVL_REBOOT; break; |
428 | #ifdef SUSE | |
426 | 429 | case 7: serv->lvls |= LVL_SINGLE; break; |
427 | 430 | case 8: serv->lvls |= LVL_BOOT; break; |
431 | #else /* not SUSE */ | |
432 | case 7: serv->lvls |= LVL_BOOT; break; | |
433 | #endif /* not SUSE */ | |
428 | 434 | default: break; |
429 | 435 | } |
430 | 436 | |
505 | 511 | continue; |
506 | 512 | |
507 | 513 | if (cur->opts & SERV_DUPLET) |
508 | continue; /* Duplet */ | |
514 | continue; /* Duplet */ | |
509 | 515 | |
510 | 516 | if (cur == serv) |
511 | 517 | continue; |
549 | 555 | } |
550 | 556 | |
551 | 557 | /* |
552 | * Alt last but not least the `$all' scripts will be set to the of | |
558 | * Last but not least the `$all' scripts will be set to the of | |
553 | 559 | * current the start order. |
554 | 560 | */ |
555 | 561 | |
560 | 566 | list_for_each(pos, serv_start) { |
561 | 567 | serv_t * serv = getserv(pos); |
562 | 568 | list_t * tmp; |
569 | const char *name; | |
563 | 570 | int neworder; |
564 | 571 | |
565 | 572 | if (!(serv->opts & SERV_ALL)) |
586 | 593 | neworder = maxorder; |
587 | 594 | else if (neworder > maxorder) |
588 | 595 | maxorder = neworder; |
589 | setorder(serv->name, neworder, false); | |
596 | /* Expand aliases to the real script name */ | |
597 | if ((name = getscript(serv->name)) == NULL) | |
598 | name = serv->name; | |
599 | setorder(name, neworder, false); | |
590 | 600 | } |
591 | 601 | } |
592 | 602 | |
1116 | 1126 | } runlevel_locations[] = { |
1117 | 1127 | #ifdef SUSE /* SuSE's SystemV link scheme */ |
1118 | 1128 | {"rc0.d/", LVL_HALT, LVL_NORM}, |
1119 | {"rc1.d/", LVL_ONE, LVL_NORM}, | |
1129 | {"rc1.d/", LVL_ONE, LVL_NORM}, /* runlevel 1 switch over to single user mode */ | |
1120 | 1130 | {"rc2.d/", LVL_TWO, LVL_NORM}, |
1121 | 1131 | {"rc3.d/", LVL_THREE, LVL_NORM}, |
1122 | 1132 | {"rc4.d/", LVL_FOUR, LVL_NORM}, |
1123 | 1133 | {"rc5.d/", LVL_FIVE, LVL_NORM}, |
1124 | 1134 | {"rc6.d/", LVL_REBOOT, LVL_NORM}, |
1125 | {"rcS.d/", LVL_SINGLE, LVL_NORM}, /* runlevel S */ | |
1126 | {"boot.d/", LVL_BOOT, LVL_BOOT}, /* runlevel B */ | |
1135 | {"rcS.d/", LVL_SINGLE, LVL_NORM}, /* runlevel S is for single user mode */ | |
1136 | {"boot.d/", LVL_BOOT, LVL_BOOT}, /* runlevel B is for system initialization */ | |
1127 | 1137 | #else /* not SUSE (actually, Debian) */ |
1128 | 1138 | {"../rc0.d/", LVL_HALT, LVL_NORM}, |
1129 | {"../rc1.d/", LVL_SINGLE, LVL_NORM}, | |
1139 | {"../rc1.d/", LVL_ONE, LVL_NORM}, /* runlevel 1 switch over to single user mode */ | |
1130 | 1140 | {"../rc2.d/", LVL_TWO, LVL_NORM}, |
1131 | 1141 | {"../rc3.d/", LVL_THREE, LVL_NORM}, |
1132 | 1142 | {"../rc4.d/", LVL_FOUR, LVL_NORM}, |
1133 | 1143 | {"../rc5.d/", LVL_FIVE, LVL_NORM}, |
1134 | 1144 | {"../rc6.d/", LVL_REBOOT, LVL_NORM}, |
1135 | {"../rcS.d/", LVL_BOOT, LVL_BOOT}, /* runlevel S */ | |
1145 | {"../rcS.d/", LVL_BOOT, LVL_BOOT}, /* runlevel S is for system initialization */ | |
1136 | 1146 | /* On e.g. Debian there exist no boot.d */ |
1137 | 1147 | #endif /* not SUSE */ |
1138 | 1148 | }; |
1139 | 1149 | |
1140 | 1150 | #define RUNLEVLES (sizeof(runlevel_locations)/sizeof(runlevel_locations[0])) |
1141 | 1151 | |
1142 | static char *map_runlevel_to_location(const int runlevel) | |
1152 | static const char *map_runlevel_to_location(const int runlevel) | |
1143 | 1153 | { |
1144 | 1154 | return runlevel_locations[runlevel].location; |
1145 | 1155 | } |
1146 | 1156 | |
1157 | #ifndef SUSE | |
1147 | 1158 | static const int map_runlevel_to_lvl(const int runlevel) |
1148 | 1159 | { |
1149 | 1160 | return runlevel_locations[runlevel].lvl; |
1153 | 1164 | { |
1154 | 1165 | return runlevel_locations[runlevel].seek; |
1155 | 1166 | } |
1167 | #endif /* not SUSE */ | |
1156 | 1168 | |
1157 | 1169 | /* |
1158 | 1170 | * Scan current service structure |
1163 | 1175 | |
1164 | 1176 | pushd(path); |
1165 | 1177 | for (runlevel = 0; runlevel < RUNLEVLES; runlevel++) { |
1166 | char * rcd = NULL; | |
1178 | const char * rcd = NULL; | |
1167 | 1179 | DIR * rcdir; |
1168 | 1180 | struct dirent *d; |
1169 | 1181 | char * token; |
1366 | 1378 | !strncmp(end, "ba", 2) || /* .bak, .backup, ... */ |
1367 | 1379 | !strcmp(end, "old") || |
1368 | 1380 | !strcmp(end, "new") || |
1381 | !strcmp(end, "org") || | |
1382 | !strcmp(end, "orig") || | |
1369 | 1383 | !strncmp(end, "dpkg", 3) || /* .dpkg-old, .dpkg-new ... */ |
1370 | 1384 | !strcmp(end, "save") || |
1371 | 1385 | !strcmp(end, "swp") || /* Used by vi like editors */ |
1548 | 1562 | |
1549 | 1563 | /* Catch `/path/script', `./script', and `path/script' */ |
1550 | 1564 | if (strchr(*argv, '/')) { |
1551 | if ( stat(*argv, &st_script) < 0) | |
1565 | if (stat(*argv, &st_script) < 0) | |
1552 | 1566 | error("%s: %s\n", *argv, strerror(errno)); |
1553 | 1567 | } else { |
1554 | 1568 | pushd(path); |
1558 | 1572 | } |
1559 | 1573 | |
1560 | 1574 | if (S_ISDIR(st_script.st_mode)) { |
1561 | path = *argv; | |
1575 | const size_t l = strlen(*argv); | |
1576 | ||
1577 | path = xstrdup(*argv); | |
1578 | if (path[l-1] == '/') | |
1579 | path[l-1] = '\0'; | |
1580 | ||
1562 | 1581 | if (del) |
1563 | 1582 | error("usage: %s [[-r] init_script|init_directory]\n", myname); |
1564 | 1583 | argv++; |
1569 | 1588 | char * base, * ptr = xstrdup(*argv); |
1570 | 1589 | |
1571 | 1590 | if ((base = strrchr(ptr, '/'))) { |
1572 | *(++base) = '\0'; | |
1573 | path = ptr; | |
1591 | *base = '\0'; | |
1592 | path = ptr; | |
1574 | 1593 | } else |
1575 | 1594 | free(ptr); |
1576 | 1595 | } |
1772 | 1791 | } |
1773 | 1792 | if (!script_inf.default_start || script_inf.default_start == empty) { |
1774 | 1793 | if (guess->lvls) |
1775 | script_inf.default_start = xstrdup(lvl2str(guess->lvls)); | |
1794 | script_inf.default_start = lvl2str(guess->lvls); | |
1776 | 1795 | } |
1777 | 1796 | } else { |
1778 | 1797 | /* |
1794 | 1813 | |
1795 | 1814 | list_for_each(req, &(cur->sort.req)) { |
1796 | 1815 | if (!strcmp(getreq(req)->serv, script_inf.provides)) { |
1797 | script_inf.default_start = xstrdup(lvl2str(getserv(ptr)->lvls)); | |
1816 | script_inf.default_start = lvl2str(getserv(ptr)->lvls); | |
1798 | 1817 | break; |
1799 | 1818 | } |
1800 | 1819 | } |
1868 | 1887 | } |
1869 | 1888 | } |
1870 | 1889 | |
1871 | if (!known && script_inf.required_start && script_inf.required_start != empty) { | |
1872 | rememberreq(service, REQ_MUST, script_inf.required_start); | |
1873 | requiresv(token, script_inf.required_start); | |
1890 | if (!known) { | |
1891 | if (script_inf.required_start && script_inf.required_start != empty) { | |
1892 | rememberreq(service, REQ_MUST, script_inf.required_start); | |
1893 | requiresv(token, script_inf.required_start); | |
1894 | } | |
1895 | if (script_inf.should_start && script_inf.should_start != empty) { | |
1896 | rememberreq(service, REQ_SHLD, script_inf.should_start); | |
1897 | requiresv(token, script_inf.should_start); | |
1898 | } | |
1899 | #ifndef SUSE | |
1900 | /* | |
1901 | * required_stop and should_stop arn't used in SuSE Linux. | |
1902 | * Note: Sorting is done symetrical in stop and start! | |
1903 | * The stop order is given by max order - start order. | |
1904 | */ | |
1905 | if (script_inf.required_stop && script_inf.required_stop != empty) { | |
1906 | rememberreq(service, REQ_MUST, script_inf.required_stop); | |
1907 | requiresv(token, script_inf.required_stop); | |
1908 | } | |
1909 | if (script_inf.should_stop && script_inf.should_stop != empty) { | |
1910 | rememberreq(service, REQ_SHLD, script_inf.should_stop); | |
1911 | requiresv(token, script_inf.should_stop); | |
1912 | } | |
1913 | #endif /* not SUSE */ | |
1874 | 1914 | } |
1875 | if (!known && script_inf.should_start && script_inf.should_start != empty) { | |
1876 | rememberreq(service, REQ_SHLD, script_inf.should_start); | |
1877 | requiresv(token, script_inf.should_start); | |
1878 | } | |
1879 | #ifndef SUSE | |
1880 | /* | |
1881 | * required_stop and should_stop arn't used in SuSE Linux. | |
1882 | * Note: Sorting is done symetrical in stop and start! | |
1883 | * The stop order is given by max order - start order. | |
1884 | */ | |
1885 | if (!known && script_inf.required_stop && script_inf.required_stop != empty) { | |
1886 | rememberreq(service, REQ_MUST, script_inf.required_stop); | |
1887 | requiresv(token, script_inf.required_stop); | |
1888 | } | |
1889 | if (!known && script_inf.should_stop && script_inf.should_stop != empty) { | |
1890 | rememberreq(service, REQ_SHLD, script_inf.should_stop); | |
1891 | requiresv(token, script_inf.should_stop); | |
1892 | } | |
1893 | #endif /* not SUSE */ | |
1894 | 1915 | /* |
1895 | 1916 | * Use information from symbolic link structure to |
1896 | 1917 | * check if all services are around for this script. |
2129 | 2150 | #else |
2130 | 2151 | # ifdef SUSE /* SuSE's SystemV link scheme */ |
2131 | 2152 | pushd(path); |
2132 | for (runlevel = 0; runlevel < 9; runlevel++) { | |
2153 | for (runlevel = 0; runlevel < RUNLEVLES; runlevel++) { | |
2133 | 2154 | int order; |
2134 | 2155 | const char * script; |
2135 | 2156 | char nlink[PATH_MAX+1], olink[PATH_MAX+1]; |
2136 | char * rcd = NULL; | |
2157 | const char * rcd = NULL; | |
2137 | 2158 | DIR * rcdir; |
2138 | 2159 | |
2139 | rcd = map_runlevel_to_location(runlevel); | |
2160 | if ((rcd = map_runlevel_to_location(runlevel)) == NULL) | |
2161 | continue; | |
2140 | 2162 | |
2141 | 2163 | script = NULL; |
2142 | 2164 | rcdir = openrcdir(rcd); /* Creates runlevel directory if necessary */ |
2279 | 2301 | int lvl = 0, seek = 0; |
2280 | 2302 | const char * script; |
2281 | 2303 | char nlink[PATH_MAX+1], olink[PATH_MAX+1]; |
2282 | char * rcd = NULL; | |
2304 | const char * rcd = NULL; | |
2283 | 2305 | DIR * rcdir; |
2284 | 2306 | |
2285 | rcd = map_runlevel_to_location(runlevel); | |
2307 | if ((rcd = map_runlevel_to_location(runlevel)) == NULL) | |
2308 | continue; | |
2286 | 2309 | lvl = map_runlevel_to_lvl(runlevel); |
2287 | 2310 | seek = map_runlevel_to_seek(runlevel); |
2288 | 2311 |
25 | 25 | $syslog syslog |
26 | 26 | |
27 | 27 | # |
28 | # All network daemons are running (this entry is OBSOLETE) | |
29 | # | |
30 | $netdaemons portmap inetd | |
31 | ||
32 | # | |
33 | 28 | # SunRPC portmapper available |
34 | 29 | # |
35 | 30 | $portmap portmap |
42 | 37 | # |
43 | 38 | # Services which need to be interactive |
44 | 39 | # |
45 | <interactive> boot.crypto boot.localfs boot.rootfsck apache apache2 | |
40 | <interactive> boot.crypto boot.localfs boot.rootfsck apache apache2 kdump |
435 | 435 | case 4: lvl = LVL_FOUR; break; |
436 | 436 | case 5: lvl = LVL_FIVE; break; |
437 | 437 | case 6: lvl = LVL_REBOOT; break; |
438 | #ifdef SUSE | |
438 | 439 | case 7: lvl = LVL_SINGLE; break; |
439 | 440 | case 8: lvl = LVL_BOOT; break; |
441 | #else | |
442 | case 7: lvl = LVL_BOOT; break; | |
443 | #endif /* not SUSE */ | |
444 | ||
440 | 445 | default: |
441 | 446 | warn("Wrong runlevel %d\n", runlevel); |
442 | 447 | } |
482 | 487 | case 4: lvl = LVL_FOUR; break; |
483 | 488 | case 5: lvl = LVL_FIVE; break; |
484 | 489 | case 6: lvl = LVL_REBOOT; break; |
490 | #ifdef SUSE | |
485 | 491 | case 7: lvl = LVL_SINGLE; break; |
486 | 492 | case 8: lvl = LVL_BOOT; break; |
493 | #else | |
494 | case 7: lvl = LVL_BOOT; break; | |
495 | #endif /* not SUSE */ | |
487 | 496 | default: |
488 | 497 | warn("Wrong runlevel %d\n", runlevel); |
489 | 498 | } |
576 | 585 | continue; |
577 | 586 | if (!strpbrk(token, "0123456sSbB")) |
578 | 587 | continue; |
588 | ||
579 | 589 | if (*token == 'S' || *token == 's') |
580 | 590 | num = 7; |
581 | 591 | else if (*token == 'B' || *token == 'b') |
582 | 592 | num = 8; |
583 | 593 | else |
584 | 594 | num = atoi(token); |
595 | ||
585 | 596 | switch (num) { |
586 | 597 | case 0: ret |= LVL_HALT; break; |
587 | 598 | case 1: ret |= LVL_ONE; break; |
590 | 601 | case 4: ret |= LVL_FOUR; break; |
591 | 602 | case 5: ret |= LVL_FIVE; break; |
592 | 603 | case 6: ret |= LVL_REBOOT; break; |
604 | #ifdef SUSE | |
593 | 605 | case 7: ret |= LVL_SINGLE; break; |
594 | 606 | case 8: ret |= LVL_BOOT; break; |
607 | #else | |
608 | case 7: ret |= LVL_BOOT; break; | |
609 | #endif /* not SUSE */ | |
595 | 610 | default: |
596 | 611 | warn("Wrong runlevel %d\n", num); |
597 | 612 | } |
609 | 624 | memset(ptr , '\0', sizeof(str)); |
610 | 625 | for (num = 0; num < 9; num++) { |
611 | 626 | if (bit & lvl) { |
612 | if (num < 7) | |
627 | if (LVL_NORM & bit) | |
613 | 628 | *(ptr++) = num + 48; |
614 | else if (num == 7) | |
629 | #ifdef SUSE | |
630 | else if (LVL_SINGLE & bit) | |
615 | 631 | *(ptr++) = 'S'; |
616 | else if (num == 8) | |
632 | else if (LVL_BOOT & bit) | |
617 | 633 | *(ptr++) = 'B'; |
634 | #else | |
635 | else if (LVL_BOOT & bit) | |
636 | *(ptr++) = 'S'; | |
637 | #endif /* not SUSE */ | |
618 | 638 | else |
619 | error("Wrong runlevel %d\n", num + 48); | |
639 | error("Wrong runlevel %d\n", num); | |
620 | 640 | *(ptr++) = ' '; |
621 | 641 | } |
622 | 642 | bit <<= 1; |
678 | 698 | int order = -1; |
679 | 699 | |
680 | 700 | if (dir) |
681 | order = getdir(dir)->order; | |
701 | order = dir->order; | |
682 | 702 | |
683 | 703 | return order; |
684 | 704 | } |
804 | 824 | } |
805 | 825 | |
806 | 826 | /* |
807 | * Return the level bits of a given script | |
827 | * Return the provided service of a given script | |
808 | 828 | */ |
809 | 829 | const char * getprovides(const char * script) |
810 | 830 | { |
7 | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | 8 | * (at your option) any later version. |
9 | 9 | */ |
10 | ||
11 | #include <stddef.h> | |
10 | 12 | |
11 | 13 | typedef struct list_struct { |
12 | 14 | struct list_struct * next, * prev; |
59 | 61 | return head->next == head; |
60 | 62 | } |
61 | 63 | |
62 | #define list_entry(ptr, type, member) \ | |
63 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) | |
64 | #define list_entry(ptr, type, member) ({ \ | |
65 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |
66 | ((type *)( (char *)(__mptr) - offsetof(type,member) )); }) | |
64 | 67 | #define list_for_each(pos, head) \ |
65 | 68 | for (pos = (head)->next; pos != (head); pos = pos->next) |
66 | 69 | #define list_for_each_prev(pos, head) \ |