author | Olivier Brunel
<jjk@jjacky.com> 2015-11-06 19:00:08 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2015-11-12 17:04:19 UTC |
parent | c015686e6f2bd68ff29cde17bc4d6380cb1b42a7 |
doc/aa-enable.pod | +5 | -1 |
src/anopa/aa-enable.c | +26 | -1 |
src/scripts/aa-stage1 | +1 | -1 |
diff --git a/doc/aa-enable.pod b/doc/aa-enable.pod index 9630277..535adb3 100644 --- a/doc/aa-enable.pod +++ b/doc/aa-enable.pod @@ -6,7 +6,7 @@ aa-enable - Enable services, i.e. copy servicedirs to repodir B<aa-enable> [B<-D>] [B<-r> I<REPODIR>] [B<-c> I<CRASH>] [B<-f> I<FINISH>] [B<-k> I<SERVICE>] [B<-S> I<SOURCEDIR>] [B<-s> I<SOURCEDIR>] [B<-l> I<LISTDIR>] -[B<-N>] [B<-W>] [B<-u>] [B<--no-supervise>] [I<SERVICE...>] +[B<-N>] [B<-W>] [B<-u>] [B<--no-supervise>] [B<-q>] [I<SERVICE...>] =head1 OPTIONS @@ -58,6 +58,10 @@ I</etc/anopa/listdirs/> Don't auto-enable any services listed under directory I<needs> of a service being (auto-)enabled. +=item B<-q, --quiet> + +Don't print enabled service names. + =item B<-r, --repodir> I<REPODIR> Use I<REPODIR> as repository directory. This is where all servicedirs will be diff --git a/src/anopa/aa-enable.c b/src/anopa/aa-enable.c index 4eb33b6..96bd313 100644 --- a/src/anopa/aa-enable.c +++ b/src/anopa/aa-enable.c @@ -65,6 +65,7 @@ static int nb_enabled = 0; static genalloc ga_failed = GENALLOC_ZERO; static genalloc ga_next = GENALLOC_ZERO; static const char *skip = NULL; +static int quiet = 0; static void warn_cb (const char *name, int err) @@ -146,6 +147,24 @@ process: return -1; } + if (!quiet) + { + aa_bs_noflush (AA_OUT, "Enabled: "); + aa_bs_noflush (AA_OUT, cur_name); + aa_bs_flush (AA_OUT, "\n"); + } + + if (r > 0) + { + if (!quiet) + { + aa_bs_noflush (AA_OUT, "Enabled: "); + aa_bs_noflush (AA_OUT, cur_name); + aa_bs_flush (AA_OUT, "/log\n"); + } + ++nb_enabled; + } + ++nb_enabled; cur_name = NULL; return 0; @@ -188,6 +207,7 @@ dieusage (int rc) " -N, --no-needs Don't auto-enable services from 'needs'\n" " -W, --no-wants Don't auto-enable services from 'wants'\n" " --no-supervise Don't create supervise folders for longruns\n" + " -q, --quiet Don't print enabled services\n" " -h, --help Show this help screen and exit\n" " -V, --version Show version information and exit\n" ); @@ -220,6 +240,7 @@ main (int argc, char * const argv[]) { "skip-down", required_argument, NULL, 'k' }, { "listdir", required_argument, NULL, 'l' }, { "no-needs", no_argument, NULL, 'N' }, + { "quiet", no_argument, NULL, 'q' }, { "repodir", required_argument, NULL, 'r' }, { "reset-source", required_argument, NULL, 'S' }, { "source", required_argument, NULL, 's' }, @@ -231,7 +252,7 @@ main (int argc, char * const argv[]) }; int c; - c = getopt_long (argc, argv, "c:Df:hk:l:Nr:S:s:uVW", longopts, NULL); + c = getopt_long (argc, argv, "c:Df:hk:l:Nqr:S:s:uVW", longopts, NULL); if (c == -1) break; switch (c) @@ -264,6 +285,10 @@ main (int argc, char * const argv[]) flags &= ~AA_FLAG_AUTO_ENABLE_NEEDS; break; + case 'q': + quiet = 1; + break; + case 'r': unslash (optarg); path_repo = optarg; diff --git a/src/scripts/aa-stage1 b/src/scripts/aa-stage1 index d8f4170..1ab5eb5 100755 --- a/src/scripts/aa-stage1 +++ b/src/scripts/aa-stage1 @@ -44,7 +44,7 @@ umask 022 # Create the repository foreground { emptyenv -c -aa-enable -Dl /etc/anopa/enabled -k uncaught-logs -f @LIBEXECDIR@/aa-stage3 } +aa-enable -Dql /etc/anopa/enabled -k uncaught-logs -f @LIBEXECDIR@/aa-stage3 } # Make sure the FIFO needed for the switch to stage 2 is there ifelse -X -n { aa-test -Dp /run/services/.scandir/uncaught-logs/fifo }