From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: Roland Hieber Date: Tue, 12 Nov 2019 16:38:34 +0100 Message-Id: <20191112153834.21653-1-rhi@pengutronix.de> MIME-Version: 1.0 Subject: [ptxdist] [PATCH] ptxdist: make 'drop' idempotent with enough --force List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de Cc: Roland Hieber This should make 'drop' suitable for use in a scripting environment, e.g. equivalent to 'rm --force'. In this case, the following rm is actually a no-op, but the message after that is useful nevertheless. Signed-off-by: Roland Hieber --- bin/ptxdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ptxdist b/bin/ptxdist index 25339e1cec19..9394b1739190 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -1217,7 +1217,7 @@ drop() { fi echo - if [ -e "${STATEDIR}/${statefile}" ]; then + if [ -e "${STATEDIR}/${statefile}" -o -n "${PTXDIST_FORCE}" ] ; then rm -f -- "${STATEDIR}/${statefile}" echo "dropping ${statefile}" echo -- 2.24.0.rc1 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de