From 7e9dce0ceb5500fe451170bc39705fe4a67c3095 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 7 Dec 2018 16:53:21 +0100
Subject: [PATCH 01/11] [type/__package_*] Print installed/removed messages

Up-/downgraded packages will send an "installed" message.
---
 cdist/conf/type/__package_emerge/gencode-remote        |  2 ++
 cdist/conf/type/__package_luarocks/gencode-remote      |  2 ++
 cdist/conf/type/__package_opkg/gencode-remote          |  4 +++-
 cdist/conf/type/__package_pacman/gencode-remote        |  2 ++
 cdist/conf/type/__package_pip/gencode-remote           |  2 ++
 cdist/conf/type/__package_pkg_freebsd/gencode-remote   |  5 ++++-
 cdist/conf/type/__package_pkg_openbsd/gencode-remote   | 10 ++++++----
 cdist/conf/type/__package_pkgng_freebsd/gencode-remote |  3 +++
 cdist/conf/type/__package_rubygem/gencode-remote       |  2 ++
 cdist/conf/type/__package_yum/gencode-remote           |  2 ++
 cdist/conf/type/__package_zypper/gencode-remote        |  3 +++
 11 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/cdist/conf/type/__package_emerge/gencode-remote b/cdist/conf/type/__package_emerge/gencode-remote
index 48462bde..c25f2be7 100755
--- a/cdist/conf/type/__package_emerge/gencode-remote
+++ b/cdist/conf/type/__package_emerge/gencode-remote
@@ -64,9 +64,11 @@ fi
 case "$state_should" in
    present)
         echo "emerge '$name' &>/dev/null || exit 1"
+        echo "installed" >> "$__messages_out"
         ;;
    absent)
         echo "emerge -C '$name' &>/dev/null || exit 1"
+        echo "removed" >> "$__messages_out"
         ;;
    *)
         echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_luarocks/gencode-remote b/cdist/conf/type/__package_luarocks/gencode-remote
index 60b9bfea..d83b3c3a 100755
--- a/cdist/conf/type/__package_luarocks/gencode-remote
+++ b/cdist/conf/type/__package_luarocks/gencode-remote
@@ -43,9 +43,11 @@ fi
 case "$state_should" in
     present)
         echo "luarocks install '$name'"
+        echo "installed" >> "$__messages_out"
     ;;
     absent)
         echo "luarocks remove '$name'"
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_opkg/gencode-remote b/cdist/conf/type/__package_opkg/gencode-remote
index e94ff388..269d5f49 100755
--- a/cdist/conf/type/__package_opkg/gencode-remote
+++ b/cdist/conf/type/__package_opkg/gencode-remote
@@ -43,12 +43,14 @@ esac
 case "$state_should" in
     present)
         if [ "$present" = "notpresent" ]; then
-            echo opkg --verbosity=0 update
+            echo "opkg --verbosity=0 update"
         fi
         echo "opkg --verbosity=0 install '$name'"
+        echo "installed" >> "$__messages_out"
     ;;
     absent)
         echo "opkg --verbosity=0 remove '$name'"
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: ${state_should}" >&2
diff --git a/cdist/conf/type/__package_pacman/gencode-remote b/cdist/conf/type/__package_pacman/gencode-remote
index 7ba85479..2e076ec3 100755
--- a/cdist/conf/type/__package_pacman/gencode-remote
+++ b/cdist/conf/type/__package_pacman/gencode-remote
@@ -46,9 +46,11 @@ fi
 case "$state_should" in
    present)
          echo "pacman --needed --noconfirm --noprogressbar -S '$name'"
+         echo "installed" >> "$__messages_out"
    ;;
    absent)
          echo "pacman --noconfirm --noprogressbar -R '$name'"
+         echo "removed" >> "$__messages_out"
    ;;
    *)
       echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_pip/gencode-remote b/cdist/conf/type/__package_pip/gencode-remote
index 33556bec..dcc4fdf9 100755
--- a/cdist/conf/type/__package_pip/gencode-remote
+++ b/cdist/conf/type/__package_pip/gencode-remote
@@ -57,6 +57,7 @@ case "$state_should" in
         else
             echo $pip install -q "$name"
         fi
+        echo "installed" >> "$__messages_out"
     ;;
     absent)
         if [ "$runas" ]
@@ -65,6 +66,7 @@ case "$state_should" in
         else
             echo $pip uninstall -q -y "$name"
         fi
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_pkg_freebsd/gencode-remote b/cdist/conf/type/__package_pkg_freebsd/gencode-remote
index fd02d939..3f88f6bc 100755
--- a/cdist/conf/type/__package_pkg_freebsd/gencode-remote
+++ b/cdist/conf/type/__package_pkg_freebsd/gencode-remote
@@ -39,7 +39,7 @@ assert ()                 #  If condition false,
 		# shellcheck disable=SC2039
 		echo "File \"$0\", line $lineno, called by $(caller 0)"
 		exit $E_ASSERT_FAILED
-	fi  
+	fi
 }
 
 # Debug
@@ -89,6 +89,7 @@ if [ -n "$curr_version" ]; then	# PKG *is* installed
 			cmd="${rm_cmd} ${name}-${curr_version}"
 		fi
 		execcmd "remove" "${cmd}"
+		echo "removed" >> "$__messages_out"
 		exit 0
 	else	# Should be installed
 		if [ -n "$version" ]; then	# Want a specific version
@@ -102,6 +103,7 @@ if [ -n "$curr_version" ]; then	# PKG *is* installed
 				execcmd "remove" "${cmd}"
 				cmd="${add_cmd} -r ${name}-${version}"
 				execcmd "add" "${cmd}"
+				echo "installed" >> "$__messages_out"
 			fi
 		else	# Don't care what version to use
 			exit 0
@@ -120,6 +122,7 @@ else	# PKG *isn't* installed
 			cmd="${cmd}-${version}"
 		fi
 		execcmd "add" "${cmd}"
+		echo "installed" >> "$__messages_out"
 		exit 0
 	fi
 fi
diff --git a/cdist/conf/type/__package_pkg_openbsd/gencode-remote b/cdist/conf/type/__package_pkg_openbsd/gencode-remote
index 61383edb..da63626b 100755
--- a/cdist/conf/type/__package_pkg_openbsd/gencode-remote
+++ b/cdist/conf/type/__package_pkg_openbsd/gencode-remote
@@ -62,15 +62,15 @@ state_should="$(cat "$__object/parameter/state")"
 
 pkg_version="$(cat "$__object/explorer/pkg_version")"
 
-if [ -f "$__object/parameter/pkg_path" ]; then                                  
-  pkg_path="$(cat "$__object/parameter/pkg_path")"                              
+if [ -f "$__object/parameter/pkg_path" ]; then
+  pkg_path="$(cat "$__object/parameter/pkg_path")"
 else
   has_installurl=$(cat "${__object}/explorer/has_installurl")
   if [ Xyes != X"${has_installurl}" ]; then
       # there is no default PKG_PATH, try to provide one
       pkg_path="ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/"
   fi
-fi                                                                              
+fi
 
 if [ "$pkg_version" ]; then
     state_is="present"
@@ -99,11 +99,12 @@ if [ \$? -ne 0 ]; then
     echo "Error: \$status"
     exit 1
 fi
+echo "installed" >> "$__messages_out"
 eof
     ;;
 
     absent)
-        # use this because pkg_add doesn't properly handle errors
+        # use this because pkg_delete doesn't properly handle errors
         cat << eof
 status=\$(pkg_delete "$pkgopts" "$pkgid")
 pkg_info | grep "^${name}.*${version}.*${flavor}" > /dev/null 2>&1
@@ -117,6 +118,7 @@ if [ \$? -eq 0 ]; then
     echo "Error: \$status"
     exit 1
 fi
+echo "removed" >> "$__messages_out"
 eof
    ;;
    *)
diff --git a/cdist/conf/type/__package_pkgng_freebsd/gencode-remote b/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
index b72544c1..dd36efda 100755
--- a/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
+++ b/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
@@ -57,12 +57,15 @@ execcmd(){
    case "$1" in
       add)
          _cmd="${add_cmd} $2"
+         echo "installed" >> "$__messages_out"
          ;;
       rm)
          _cmd="${rm_cmd} $2"
+         echo "removed" >> "$__messages_out"
          ;;
       upg)
          _cmd="${upg_cmd} $2"
+         echo "installed" >> "$__messages_out"
          ;;
       *)
          printf "Error. Don't understand command: %s" "$1" >&2
diff --git a/cdist/conf/type/__package_rubygem/gencode-remote b/cdist/conf/type/__package_rubygem/gencode-remote
index ee563ef8..abb40653 100755
--- a/cdist/conf/type/__package_rubygem/gencode-remote
+++ b/cdist/conf/type/__package_rubygem/gencode-remote
@@ -40,9 +40,11 @@ fi
 case "$state_should" in
     present)
         echo "gem install '$name' --no-ri --no-rdoc"
+        echo "installed" >> "$__messages_out"
     ;;
     absent)
         echo "gem uninstall '$name'"
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote
index 97265827..b52953f6 100755
--- a/cdist/conf/type/__package_yum/gencode-remote
+++ b/cdist/conf/type/__package_yum/gencode-remote
@@ -61,9 +61,11 @@ fi
 case "$state_should" in
     present)
         echo "yum $opts install '$install_name'"
+        echo "installed" >> "$__messages_out"
     ;;
     absent)
         echo "yum $opts remove '$name'"
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_zypper/gencode-remote b/cdist/conf/type/__package_zypper/gencode-remote
index 1f15c531..e45dd9ff 100755
--- a/cdist/conf/type/__package_zypper/gencode-remote
+++ b/cdist/conf/type/__package_zypper/gencode-remote
@@ -62,14 +62,17 @@ case "$state_should" in
         if [ -z "$version_should" ]; then
             [ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything
             echo "zypper $globalopts install --type '$ptype' --auto-agree-with-licenses '$name' >/dev/null"
+            echo "removed" >> "$__messages_out"
         else
             [ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything
             echo "zypper $globalopts install --oldpackage --type '$ptype' --auto-agree-with-licenses '$name' = '$version_should' >/dev/null"
+            echo "installed" >> "$__messages_out"
         fi
     ;;
     absent)
         [ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything
         echo "zypper $globalopts remove --type '$ptype' '$name' >/dev/null"
+        echo "removed" >> "$__messages_out"
     ;;
     *)
         echo "Unknown state: $state_should" >&2

From ccdbf1a31c92681e2f34d7a48acc67f243548520 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 7 Dec 2018 16:55:49 +0100
Subject: [PATCH 02/11] [type/__package_emerge_dependendencies] Send messages
 when a dependency is installed

---
 cdist/conf/type/__package_emerge_dependencies/gencode-remote | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cdist/conf/type/__package_emerge_dependencies/gencode-remote b/cdist/conf/type/__package_emerge_dependencies/gencode-remote
index face898a..f3e6f76e 100755
--- a/cdist/conf/type/__package_emerge_dependencies/gencode-remote
+++ b/cdist/conf/type/__package_emerge_dependencies/gencode-remote
@@ -6,10 +6,11 @@ flaggie_installed="$(cat "$__object/explorer/flaggie_installed")"
 if [ "${gentoolkit_installed}" != "true" ]; then
     # emerge app-portage/gentoolkit
     echo "emerge app-portage/gentoolkit &> /dev/null || exit 1"
+    echo "installed app-portage/gentoolkit" >> "$__messages_out"
 fi
 
 if [ "${flaggie_installed}" != "true" ]; then
     # emerge app-portage/flaggie
     echo "emerge app-portage/flaggie &> /dev/null || exit 1"
+    echo "installed app-portage/flaggie" >> "$__messages_out"
 fi
-

From 183d57d6d2aeb05d37bef3896badd9a20a6c541f Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 12:43:57 +0100
Subject: [PATCH 03/11] [type/__sysctl] Fix spelling of FreeBSD

---
 cdist/conf/type/__sysctl/gencode-remote | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index a7aedb84..888ca117 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -31,7 +31,7 @@ case "$os" in
     redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
         flag='-w'
     ;;
-    frebsd)
+    freebsd)
         flag=''
     ;;
 esac

From b36716ef3619ff9881be98b0fa896ade7456a8e0 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 12:44:41 +0100
Subject: [PATCH 04/11] [type/__sysctl] Add OpenBSD support

---
 cdist/conf/type/__sysctl/gencode-remote | 3 ++-
 cdist/conf/type/__sysctl/manifest       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index 888ca117..76e5f528 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 #
 # 2014 Steven Armstrong (steven-cdist at armstrong.cc)
+# 2018 Takashi Yoshi (takashi at yoshi.email)
 #
 # This file is part of cdist.
 #
@@ -31,7 +32,7 @@ case "$os" in
     redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
         flag='-w'
     ;;
-    freebsd)
+    freebsd|openbsd)
         flag=''
     ;;
 esac
diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest
index 6e337ccb..43feec04 100755
--- a/cdist/conf/type/__sysctl/manifest
+++ b/cdist/conf/type/__sysctl/manifest
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 #
 # 2014 Steven Armstrong (steven-cdist at armstrong.cc)
+# 2018 Takashi Yoshi (takashi at yoshi.email)
 #
 # This file is part of cdist.
 #
@@ -22,7 +23,7 @@
 os=$(cat "$__global/explorer/os")
 
 case "$os" in
-   redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd)
+   redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd|openbsd)
       :
    ;;
    *)

From 566feba5b16b6eb56371fe0fa669d83c1d929bfc Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 12:55:03 +0100
Subject: [PATCH 05/11] [type/__sysctl] Add NetBSD support

---
 cdist/conf/type/__sysctl/gencode-remote | 2 +-
 cdist/conf/type/__sysctl/manifest       | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index 76e5f528..873932ba 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -29,7 +29,7 @@ fi
 
 os=$(cat "$__global/explorer/os")
 case "$os" in
-    redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
+    redhat|centos|ubuntu|debian|devuan|archlinux|coreos|netbsd)
         flag='-w'
     ;;
     freebsd|openbsd)
diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest
index 43feec04..df3ff13c 100755
--- a/cdist/conf/type/__sysctl/manifest
+++ b/cdist/conf/type/__sysctl/manifest
@@ -23,7 +23,12 @@
 os=$(cat "$__global/explorer/os")
 
 case "$os" in
-   redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd|openbsd)
+   # Linux
+   redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
+      :
+   ;;
+   # BSD
+   freebsd|netbsd|openbsd)
       :
    ;;
    *)

From 45ff67c0f55ece10c4265e8ab187b78ec432f1de Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 13:06:31 +0100
Subject: [PATCH 06/11] [type/__sysctl] Add Mac OS X support

---
 cdist/conf/type/__sysctl/gencode-remote | 8 +++++++-
 cdist/conf/type/__sysctl/manifest       | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index 873932ba..e17e0659 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -31,7 +31,13 @@ os=$(cat "$__global/explorer/os")
 case "$os" in
     redhat|centos|ubuntu|debian|devuan|archlinux|coreos|netbsd)
         flag='-w'
-    ;;
+		;;
+	macosx)
+		# NOTE: Older versions of Mac OS X require the -w option.
+		#       Even though the flag is not mentioned in new man pages anymore,
+		#       it still works.
+		flag='-w'
+		;;
     freebsd|openbsd)
         flag=''
     ;;
diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest
index df3ff13c..b4e2e902 100755
--- a/cdist/conf/type/__sysctl/manifest
+++ b/cdist/conf/type/__sysctl/manifest
@@ -28,7 +28,7 @@ case "$os" in
       :
    ;;
    # BSD
-   freebsd|netbsd|openbsd)
+   freebsd|macosx|netbsd|openbsd)
       :
    ;;
    *)

From 92610fe76c6875ee4aa6b31bf5b2be23e5149305 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 13:45:03 +0100
Subject: [PATCH 07/11] [type/__sysctl] Add support for Alpine Linux, Gentoo
 and OpenWrt

---
 cdist/conf/type/__sysctl/gencode-remote | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index e17e0659..d1da6058 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -29,7 +29,7 @@ fi
 
 os=$(cat "$__global/explorer/os")
 case "$os" in
-    redhat|centos|ubuntu|debian|devuan|archlinux|coreos|netbsd)
+    redhat|centos|ubuntu|debian|devuan|alpine|archlinux|gentoo|openwrt|coreos|netbsd)
         flag='-w'
 		;;
 	macosx)

From 9acb9d1f3aa7ffa9c10f4be1d8eb8c3ed6b3e251 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 14 Dec 2018 14:12:33 +0100
Subject: [PATCH 08/11] [type/__sysctl] Group entries

---
 cdist/conf/type/__sysctl/gencode-remote | 32 +++++++++++++++----------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index d1da6058..711d54e5 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -29,18 +29,26 @@ fi
 
 os=$(cat "$__global/explorer/os")
 case "$os" in
-    redhat|centos|ubuntu|debian|devuan|alpine|archlinux|gentoo|openwrt|coreos|netbsd)
-        flag='-w'
-		;;
-	macosx)
-		# NOTE: Older versions of Mac OS X require the -w option.
-		#       Even though the flag is not mentioned in new man pages anymore,
-		#       it still works.
-		flag='-w'
-		;;
-    freebsd|openbsd)
-        flag=''
-    ;;
+   # Linux
+   redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos)
+      flag='-w'
+      ;;
+   # BusyBox
+   alpine|openwrt)
+      flag='-w'
+      ;;
+   macosx)
+      # NOTE: Older versions of Mac OS X require the -w option.
+      #       Even though the flag is not mentioned in new man pages anymore,
+      #       it still works.
+      flag='-w'
+      ;;
+   netbsd)
+      flag='-w'
+      ;;
+   freebsd|openbsd)
+      flag=''
+   ;;
 esac
 
 # set the current runtime value

From e3b0cbe8ac4b75e5268d9c6ff1538ca4e809d8fd Mon Sep 17 00:00:00 2001
From: Darko Poljak <foss@ungleich.com>
Date: Fri, 14 Dec 2018 15:20:17 +0100
Subject: [PATCH 09/11] ++changelog

---
 docs/changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/changelog b/docs/changelog
index a662eb38..e1e3fdb6 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -8,6 +8,7 @@ next:
 	* Type __consul_agent: Add Debian 9 support (Jin-Guk Kwon)
 	* Documentation: Fix broken links (Rage <OxR463>)
 	* Type __docker: Add version parameter (Jonas Weber)
+	* Type __sysctl: Refactor for better OS support (Takashi Yoshi)
 
 4.10.4: 2018-11-03
 	* Core: Transfer all files of a directory at once instead of calling copy once per file (myeisha)

From a7f1eda3280d4919c8da977674d4881ddf883929 Mon Sep 17 00:00:00 2001
From: Takashi Yoshi <takashi@yoshi.email>
Date: Fri, 7 Dec 2018 16:56:36 +0100
Subject: [PATCH 10/11] [type/__package_emerge] Send error messages to stderr

---
 cdist/conf/type/__package_emerge/gencode-remote | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cdist/conf/type/__package_emerge/gencode-remote b/cdist/conf/type/__package_emerge/gencode-remote
index c25f2be7..b144ede4 100755
--- a/cdist/conf/type/__package_emerge/gencode-remote
+++ b/cdist/conf/type/__package_emerge/gencode-remote
@@ -39,12 +39,12 @@ pkg_version="$(cat "$__object/explorer/pkg_version")"
 if [ -z "$pkg_version" ]; then
     state_is="absent"
 elif [ -z "$version" ] && [ "$(echo "$pkg_version" | wc -l)" -gt 1 ]; then
-    echo "Package name is not unique! The following packages are installed:"
-    echo "$pkg_version"
+    echo "Package name is not unique! The following packages are installed:" >&2
+    echo "$pkg_version" >&2
     exit 1
 elif [ -n "$version" ] && [ "$(echo "$pkg_version" | cut -d " " -f 1 | sort | uniq | wc -l)" -gt 1 ]; then
-    echo "Package name is not unique! The following packages are installed:"
-    echo "$pkg_version"
+    echo "Package name is not unique! The following packages are installed:" >&2
+    echo "$pkg_version" >&2
     exit 1
 else
     state_is="present"

From 93b0727c3b1eb326edfa7db71926a16f482dabee Mon Sep 17 00:00:00 2001
From: Darko Poljak <foss@ungleich.com>
Date: Fri, 14 Dec 2018 16:19:30 +0100
Subject: [PATCH 11/11] ++changelog

---
 docs/changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/changelog b/docs/changelog
index e1e3fdb6..1c5e6a05 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -9,6 +9,7 @@ next:
 	* Documentation: Fix broken links (Rage <OxR463>)
 	* Type __docker: Add version parameter (Jonas Weber)
 	* Type __sysctl: Refactor for better OS support (Takashi Yoshi)
+	* Types __package_*: Add messaging upon installation/removal (Takashi Yoshi)
 
 4.10.4: 2018-11-03
 	* Core: Transfer all files of a directory at once instead of calling copy once per file (myeisha)