| Commit message (Collapse) | Author | Age | Lines |
|
|
|
|
|
|
| |
bosun manages role names that are user-defined and may be hard to
remember or annoying to type out. Supporting auto-complete frameworks in
modern shells is an obvious improvement. For now only support the fish
shell since we use that on all our systems.
|
|
|
|
|
|
|
| |
The introduction of a test suite makes future changes easier to
troubleshoot and verify. Whilst this is only a first draft, it should be
stable enough to be used in normal development and should cover the
entirety of bosun's functionality.
|
|
|
|
|
|
| |
This will squash shellcheck's SC2184 [1].
[1] https://github.com/koalaman/shellcheck/wiki/SC2185
|
|
|
|
|
|
|
| |
The upcoming test suite needs a way to operate on roles without
referencing the system's default store in /etc/portage/stow. Have bosun
respect the 'BOSUN_DIR' environment variable that overrides the role
directory bosun operates on.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An upcoming commit will introduce support for the BOSUN_DIR environment
variable that allows users (and, crucially, the upcoming test suite) to
override the default role directory. Since we have previously assumed
that we are in full control of STOW_DIR, we now have to be more careful.
Revamp list_active such that the sed invocation no longer gets any user
input. This should protect against any nefarious contents in BOSUN_DIR.
The new approach used by list_active relies on 'realpath', a GNU-only
coreutils program, and its '--relative-base' option which prints
absolute paths unless they are below a given directory. This allows us
to filter symbolic links that do not point to a path within BOSUN_DIR.
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default, xargs runs the given command once even if there is no input.
This does not make sense for these two invocations, so make sure that
xargs only runs if active roles were found. Furthermore, state
explicitly which command to run and do not rely on the default action of
'list'.
Note: This change makes use of the '-r' flag, which is a GNU extension.
We assume that bosun is only ever going to be used on Gentoo systems, so
this should be fine.
|
|
|
|
|
|
|
| |
As bosun may run in environments that do not require superuser access,
do away with this check and rely on stow itself for any relevant error
reporting. This will also enable an upcoming test suite to work
correctly.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Even if the user is familiar with bosun(1), they might try to remove a
role by invoking it with `delete` or `del` instead of `remove`. As these
are very common synonyms, add a simple DWIM mechanic to enhance the user
experience.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces several improvements to the way bosun reacts to
and reports errors.
Instead of doing nothing and exiting silently, alert the user and print
a short usage synopsis if bosun does not understand a command it was
passed. Also, alert the user and print available list types if the
`list` command was invoked with a type it does not understand. Lastly,
check for the existence of a role before trying to `add`, `remove`, or
`rebuild` it.
|
| |
|
|
|
|
|
|
|
| |
Instead of using a catchall pattern for `case`, assign a default value
to the variable in question. This helps reduce the amount of special
cases - especially considering the addition of better error reporting in
an upcoming commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bash 5.0 now enables its 'shift_verbose' option in POSIX mode by
default, printing an error message if there's not enough positional
arguments for the `shift` builtin.
We rely on the previous (silent) behaviour in two places. For main
command parsing, introduce an explicit check before invoking `shift` to
make sure it is only called if there are enough positional arguments.
The call to `shift` in the list() method is actually superfluous, as no
more than one positional argument is ever referenced; we drop it fully
there.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A couple of small changes to this function should make it more robust in
the long run:
1) We no longer filter the symlinks with find(1), instead combining
filtering and substituting in sed(1)
2) We use the absolute path (as given by readlink -f) such that we can
anchor the regular expression pattern to avoid unwanted substitution.
3) Instead of hard-coding paths we now use STOW_DIR (and STOW_DIR/.. for
the target directory)
4) To avoid unnecessary complexity, we no longer let the user override
STOW_DIR. This tool is supposed to be used with the canonical
/etc/portage/stow location
|
|
|
|
|
| |
I am unsure whether this is consistent across distributions, but for me
stow appears in Section 8 - User Contributed Perl Documentation.
|
|
|
|
|
| |
This lets the user rebuild (or restow) specific roles and will fix a
certain issue with stow refusing to unstow everything.
|
|
|
|
|
| |
I would not expect this to ever fail, but quoting the specific
invocation of id -u here silences the only shellcheck warning.
|
|
|
|
|
|
|
| |
Instead of hard-coding the stow invocation (which also had a quoting
issue), just export the STOW_DIR environment variable which stow uses
already. TARGET can be dropped because it is implicitly defined to be
the parent directory of STOW_DIR.
|
| |
|
|
|
|
|
| |
It has always been possible to add or remove multiple roles at once, and
this is now reflected in the manual.
|
| |
|
| |
|
| |
|
|
|