Quote aptget command and params, simplify explorer

remotes/origin/shellcheck
Jonas Weber 6 years ago
parent 346f1f8af3
commit b3f3b907a4
  1. 2
      cdist/conf/type/__package_apt/explorer/state
  2. 4
      cdist/conf/type/__package_apt/gencode-remote

@ -30,7 +30,7 @@ fi
# Except dpkg failing, if package is not known / installed
packages="$(apt-cache showpkg "$name" | sed -e "1,/Reverse Provides:/d" | cut -d ' ' -f 1) $name"
for p in $packages; do
if [ -n "$(dpkg -s "$p" 2>/dev/null | grep "^Status: install ok installed$")" ]; then
if dpkg -s "$p" 2>/dev/null | grep --quiet "^Status: install ok installed$" ; then
version=$(dpkg -s "$p" 2>/dev/null | grep "^Version:" | cut -d ' ' -f 2)
echo "present $p $version"
exit 0

@ -77,11 +77,11 @@ case "$state_should" in
if [ -n "$version" ]; then
name="${name}=${version}"
fi
echo $aptget install $target_release \"$name\"
echo "$aptget install $target_release \"$name\""
echo "installed" >> "$__messages_out"
;;
absent)
echo $aptget remove $purgeparam \"$name\"
echo "$aptget remove $purgeparam \"$name\""
echo "removed" >> "$__messages_out"
;;
*)

Loading…
Cancel
Save