From c052e507eb4103c6a82a80db0b5e7b4837dc5562 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Sun, 2 Jul 2017 11:50:22 +0300 Subject: [PATCH 1/4] shellcheck __apt_mark --- cdist/conf/type/__apt_mark/explorer/apt_version | 2 +- cdist/conf/type/__apt_mark/explorer/package_installed | 2 +- cdist/conf/type/__apt_mark/explorer/state | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__apt_mark/explorer/apt_version b/cdist/conf/type/__apt_mark/explorer/apt_version index 32a0a58f..827d9db2 100644 --- a/cdist/conf/type/__apt_mark/explorer/apt_version +++ b/cdist/conf/type/__apt_mark/explorer/apt_version @@ -26,6 +26,6 @@ apt_version_is=$(dpkg-query --show --showformat '${Version}' apt) apt_version_should=0.8.14.2 -dpkg --compare-versions $apt_version_should le $apt_version_is \ +dpkg --compare-versions "$apt_version_should" le "$apt_version_is" \ && echo 0 \ || echo 1 diff --git a/cdist/conf/type/__apt_mark/explorer/package_installed b/cdist/conf/type/__apt_mark/explorer/package_installed index c78ac3a9..c37c5e76 100644 --- a/cdist/conf/type/__apt_mark/explorer/package_installed +++ b/cdist/conf/type/__apt_mark/explorer/package_installed @@ -24,7 +24,7 @@ else name="$__object_id" fi -dpkg-query --show --showformat '${Status}' $name 2>/dev/null \ +dpkg-query --show --showformat '${Status}' "$name" 2>/dev/null \ | grep -q 'ok installed' \ && echo 0 \ || echo 1 diff --git a/cdist/conf/type/__apt_mark/explorer/state b/cdist/conf/type/__apt_mark/explorer/state index 3b70003a..565ad70f 100644 --- a/cdist/conf/type/__apt_mark/explorer/state +++ b/cdist/conf/type/__apt_mark/explorer/state @@ -24,4 +24,4 @@ else name="$__object_id" fi -apt-mark showhold | grep -q $name && echo hold || echo unhold +apt-mark showhold | grep -q "$name" && echo hold || echo unhold From e4d9f78349550a591c2e17676661312b519da07e Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Sun, 2 Jul 2017 11:51:59 +0300 Subject: [PATCH 2/4] grep fixed string --- cdist/conf/type/__apt_mark/explorer/package_installed | 2 +- cdist/conf/type/__apt_mark/explorer/state | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__apt_mark/explorer/package_installed b/cdist/conf/type/__apt_mark/explorer/package_installed index c37c5e76..059e44f4 100644 --- a/cdist/conf/type/__apt_mark/explorer/package_installed +++ b/cdist/conf/type/__apt_mark/explorer/package_installed @@ -25,6 +25,6 @@ else fi dpkg-query --show --showformat '${Status}' "$name" 2>/dev/null \ - | grep -q 'ok installed' \ + | grep -Fq 'ok installed' \ && echo 0 \ || echo 1 diff --git a/cdist/conf/type/__apt_mark/explorer/state b/cdist/conf/type/__apt_mark/explorer/state index 565ad70f..1dfdc911 100644 --- a/cdist/conf/type/__apt_mark/explorer/state +++ b/cdist/conf/type/__apt_mark/explorer/state @@ -24,4 +24,4 @@ else name="$__object_id" fi -apt-mark showhold | grep -q "$name" && echo hold || echo unhold +apt-mark showhold | grep -Fq "$name" && echo hold || echo unhold From df437851f0f756fa9aee6f379e3ce33337c5fc73 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Sun, 2 Jul 2017 12:19:40 +0300 Subject: [PATCH 3/4] add -e --- cdist/conf/type/__apt_mark/explorer/apt_version | 2 +- cdist/conf/type/__apt_mark/explorer/package_installed | 2 +- cdist/conf/type/__apt_mark/explorer/state | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__apt_mark/explorer/apt_version b/cdist/conf/type/__apt_mark/explorer/apt_version index 827d9db2..7bb90cc2 100644 --- a/cdist/conf/type/__apt_mark/explorer/apt_version +++ b/cdist/conf/type/__apt_mark/explorer/apt_version @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # # 2016 Ander Punnar (cdist at kvlt.ee) # diff --git a/cdist/conf/type/__apt_mark/explorer/package_installed b/cdist/conf/type/__apt_mark/explorer/package_installed index 059e44f4..0b072cbc 100644 --- a/cdist/conf/type/__apt_mark/explorer/package_installed +++ b/cdist/conf/type/__apt_mark/explorer/package_installed @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # # 2016 Ander Punnar (cdist at kvlt.ee) # diff --git a/cdist/conf/type/__apt_mark/explorer/state b/cdist/conf/type/__apt_mark/explorer/state index 1dfdc911..b7fe08fa 100644 --- a/cdist/conf/type/__apt_mark/explorer/state +++ b/cdist/conf/type/__apt_mark/explorer/state @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e # # 2016 Ander Punnar (cdist at kvlt.ee) # From 49f9760eacfd9eecdd3bee325efffb0bc92c66cd Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Mon, 3 Jul 2017 15:18:27 +0300 Subject: [PATCH 4/4] +x --- cdist/conf/type/__apt_mark/explorer/apt_version | 0 cdist/conf/type/__apt_mark/explorer/package_installed | 0 cdist/conf/type/__apt_mark/explorer/state | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 cdist/conf/type/__apt_mark/explorer/apt_version mode change 100644 => 100755 cdist/conf/type/__apt_mark/explorer/package_installed mode change 100644 => 100755 cdist/conf/type/__apt_mark/explorer/state diff --git a/cdist/conf/type/__apt_mark/explorer/apt_version b/cdist/conf/type/__apt_mark/explorer/apt_version old mode 100644 new mode 100755 diff --git a/cdist/conf/type/__apt_mark/explorer/package_installed b/cdist/conf/type/__apt_mark/explorer/package_installed old mode 100644 new mode 100755 diff --git a/cdist/conf/type/__apt_mark/explorer/state b/cdist/conf/type/__apt_mark/explorer/state old mode 100644 new mode 100755