From 0a549b991db4d40a2e5281e39b77a23745f8d3d6 Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Wed, 10 Mar 2021 16:29:47 +0100
Subject: Do not act if there is nothing to flush or rebuild

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.
---
 bosun | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bosun b/bosun
index d9dc4c7..d8d0168 100755
--- a/bosun
+++ b/bosun
@@ -38,7 +38,7 @@ remove() {
 }
 
 flush() {
-	list | xargs -- stow -D
+	list active | xargs -r -- stow -D
 }
 
 rebuild() {
@@ -46,7 +46,7 @@ rebuild() {
 		need_role "$@"
 		stow -R "$@"
 	else
-		list | xargs -- stow -R
+		list active | xargs -r -- stow -R
 	fi
 }
 
-- 
cgit v1.2.3-2-gb3c3