author | Olivier Brunel
<jjk@jjacky.com> 2018-01-20 17:45:49 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2018-01-21 19:49:08 UTC |
parent | aa987fa717e4fb8997068be47f3c389e1b1feb07 |
doc/aa-command.pod | +0 | -57 |
package/modes | +0 | -1 |
package/targets.mak | +0 | -2 |
src/scripts/aa-command | +0 | -50 |
diff --git a/doc/aa-command.pod b/doc/aa-command.pod deleted file mode 100644 index 53363dc..0000000 --- a/doc/aa-command.pod +++ /dev/null @@ -1,57 +0,0 @@ -=head1 NAME - -aa-command - Helper to trigger one of anopa's commands - -=head1 SYNOPSIS - -B<aa-command> I<COMMAND> [I<ARG..>] - -=head1 DEPRECATED - -B<aa-command>(1) has been deprecated and will be removed in the next version of -B<anopa>. A better way to achieve similar results is via a longrun service, thus -guaranteeing same environment, proper logging, etc - -For example, such longrun could be named aa-command and have the following -I<run> file : - - #!/usr/bin/execlineb -P - fdmove -c 2 1 - fdmove -c 4 1 - fdmove 1 3 - s6-ipcserver -1 -- socket - s6-ipcserver-access -i rules -- - fdmove 2 4 - s6-sudod -2 - ./aa-command - -With the following I<aa-command> file : - - #!/usr/bin/execlineb -s1 - ifelse -n { test $1 = start -o $1 = stop -o =1 = reset } - { if { aa-echo -De "Invalid command: $1" } exit 1 } - if { aa-echo -Dn +w "Running: " +b "aa-${1} $@" } - exec aa-${1} -D $@ - -And to e.g. start service foobar, one would simply do something like : - - s6-sudo /run/services/aa-command/socket start foobar - -=head1 DESCRIPTION - -B<aa-command>(1) is a simple B<execline> script that can be used to run one of -anopa's command, ensuring proper environment and logging the output. - -That is, instead of running e.g. `aa-start -W foo bar` to start those two -services (but not auto-start any "wants"), one could do: - - aa-command start -W foo bar - -This would simply reset the environment to load it from I</etc/anopa/env> (much -like what happens on boot, i.e. in the B<aa-stage*> scripts), set up a pipe on -stderr to log things (timestamped via B<s6-tai64n>) by appending into -I</var/log/boot/current>; then execute `B<aa-I<COMMAND>> -D I<ARG..>` - -As a result, the command runs with a clean/predictable environment, and in -addition to the output showing on the terminal, it gets added to the log of the -current boot (again, as per the B<aa-stage*> scripts). diff --git a/package/modes b/package/modes index f972d27..b98016e 100644 --- a/package/modes +++ b/package/modes @@ -1,5 +1,4 @@ aa-chroot 0755 -aa-command 0755 aa-ctty 0755 aa-echo 0755 aa-enable 0755 diff --git a/package/targets.mak b/package/targets.mak index ad1bcda..20a1e7a 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -22,7 +22,6 @@ aa-tty \ aa-umount BIN_SCRIPTS_TARGET := \ -aa-command \ aa-shutdown LIBEXEC_SCRIPTS_TARGET := \ @@ -35,7 +34,6 @@ aa-stage4 DOC_TARGETS := \ anopa.1 \ aa-chroot.1 \ -aa-command.1 \ aa-ctty.1 \ aa-echo.1 \ aa-enable.1 \ diff --git a/src/scripts/aa-command b/src/scripts/aa-command deleted file mode 100644 index 49e3cb6..0000000 --- a/src/scripts/aa-command +++ /dev/null @@ -1,50 +0,0 @@ -#!@BINDIR@/execlineb -# -# anopa - Copyright (C) 2015-2017 Olivier Brunel -# -# aa-command -# Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com> -# -# This file is part of anopa. -# -# anopa is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# anopa is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# anopa. If not, see http://www.gnu.org/licenses/ -# - -importas CMD 1 -shift -elgetpositionals - -emptyenv s6-envdir /etc/anopa/env exec - -# Set up a pipe to log messages -piperw 3 4 -background -{ - fdclose 4 fdmove 0 3 - redirfd -a 1 /var/log/boot/current - fdmove -c 2 1 - s6-tai64n -} -fdclose 3 -fdmove 2 4 - -# log what we do -foreground -{ - fdmove -c 1 2 - aa-echo -B -- "Running: aa-${CMD}" " ${@}" -} - -foreground { aa-echo -w "aa-command has been deprecated, see aa-command(1) for more" } -aa-${CMD} -D ${@}