1 Purpose: Reduce verbosity level (drop Loading... messages)
3 Status: Not yet submitted upstream.
6 Index: insserv/listing.h
7 ===================================================================
8 --- insserv.orig/listing.h 2009-09-26 22:35:25.000000000 +0200
9 +++ insserv/listing.h 2009-09-26 22:35:39.000000000 +0200
11 extern const char *const delimeter;
12 extern void error(const char *restrict fmt, ...) attribute((noreturn,format(printf,1,2)));
13 extern void warn (const char *restrict fmt, ...) attribute((format(printf,1,2)));
14 -extern void info (const char *restrict fmt, ...) attribute((format(printf,1,2)));
15 +extern void info (int level, const char *restrict fmt, ...) attribute((format(printf,2,3)));
16 extern inline int map_has_runlevels(void) attribute((always_inline));
17 extern inline char map_runlevel_to_key(const int runlevel);
18 extern inline ushort map_key_to_lvl(const char key);
20 (unlinkat(d,x,0) != 0 && (errno != EISDIR || unlinkat(d,x,AT_REMOVEDIR) != 0)))) \
21 warn ("can not remove(%s%s): %s\n", rcd, x, strerror(errno)); \
23 - info("remove service %s/%s%s\n", path, rcd, x); }))
24 + info(1, "remove service %s/%s%s\n", path, rcd, x); }))
26 # define xremove(d,x) (__extension__ ({ if ((dryrun ? 0 : (remove(x) != 0))) \
27 warn ("can not remove(%s%s): %s\n", rcd, x, strerror(errno)); \
29 - info("remove service %s/%s%s\n", path, rcd, x); }))
30 + info(1, "remove service %s/%s%s\n", path, rcd, x); }))
32 #if defined(HAS_symlinkat) && defined(_ATFILE_SOURCE)
33 # define xsymlink(d,x,y) (__extension__ ({ if ((dryrun ? 0 : (symlinkat(x, d, y) != 0))) \
34 warn ("can not symlink(%s, %s%s): %s\n", x, rcd, y, strerror(errno)); \
36 - info("enable service %s -> %s/%s%s\n", x, path, rcd, y); }))
37 + info(1, "enable service %s -> %s/%s%s\n", x, path, rcd, y); }))
39 # define xsymlink(d,x,y) (__extension__ ({ if ((dryrun ? 0 : (symlink(x, y) != 0))) \
40 warn ("can not symlink(%s, %s%s): %s\n", x, rcd, y, strerror(errno)); \
42 - info("enable service %s -> %s/%s%s\n", x, path, rcd, y); }))
43 + info(1, "enable service %s -> %s/%s%s\n", x, path, rcd, y); }))
45 #if defined(HAS_fstatat) && defined(_ATFILE_SOURCE)
46 # define xstat(d,x,s) (__extension__ ({ fstatat(d,x,s, 0); }))
47 Index: insserv/insserv.c
48 ===================================================================
49 --- insserv.orig/insserv.c 2009-09-26 22:35:39.000000000 +0200
50 +++ insserv/insserv.c 2009-09-26 22:35:41.000000000 +0200
52 /* The main line buffer if unique */
53 static char buf[LINE_MAX];
55 -/* When to be verbose */
56 -static boolean verbose = false;
57 +/* When to be verbose, and what level of verbosity */
58 +static int verbose = 0;
60 /* When to be verbose */
61 static boolean dryrun = false;
65 #ifdef USE_KILL_IN_BOOT
66 - info("dryrun, not creating .depend.boot, .depend.start, .depend.halt, and .depend.stop\n");
67 + info(1, "dryrun, not creating .depend.boot, .depend.start, .depend.halt, and .depend.stop\n");
68 #else /* not USE_KILL_IN_BOOT */
69 - info("dryrun, not creating .depend.boot, .depend.start, and .depend.stop\n");
70 + info(1, "dryrun, not creating .depend.boot, .depend.start, and .depend.stop\n");
71 #endif /* not USE_KILL_IN_BOOT */
78 - info("creating .depend.boot\n");
79 - info("creating .depend.start\n");
80 + info(1, "creating .depend.boot\n");
81 + info(1, "creating .depend.start\n");
83 lsort('S'); /* Sort into start order, set new sorder */
89 - info("creating .depend.halt\n");
90 + info(1, "creating .depend.halt\n");
91 #endif /* USE_KILL_IN_BOOT */
92 - info("creating .depend.stop\n");
93 + info(1, "creating .depend.stop\n");
95 lsort('K'); /* Sort into stop order, set new korder */
99 * Print message when verbose is enabled
101 -void info(const char *fmt, ...) {
102 +void info(int level, const char *fmt, ...) {
105 + if (level > verbose)
109 @@ -1062,7 +1062,7 @@
111 if (stat(rcpath, &st) < 0) {
112 if (errno == ENOENT) {
113 - info("creating directory '%s'\n", rcpath);
114 + info(1, "creating directory '%s'\n", rcpath);
116 mkdir(rcpath, (S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH));
118 @@ -1190,7 +1190,7 @@
119 char *basenamestr = basename(path); /* GNU basename */
120 char *retval = is_upstart_job_recursive(path, basenamestr);
122 - info("script '%s' is upstart job\n", basenamestr);
123 + info(2, "script '%s' is upstart job\n", basenamestr);
127 @@ -1225,7 +1225,7 @@
128 #define description script_inf.description
129 #define interactive script_inf.interactive
131 - info("Loading %s\n", path);
132 + info(2, "Loading %s\n", path);
134 if (NULL != (upstart_job = is_upstart_job(path))) {
136 @@ -1882,7 +1882,7 @@
137 regmatch_t subloc[SUBCONFNUM], *val = (regmatch_t*)0;
140 - info("Loading %s\n", file);
141 + info(2, "Loading %s\n", file);
144 const char * fptr = file;
145 @@ -2347,10 +2347,10 @@