A package provider using portupgrade, compatible with pkgng
This module contains a modified version of the portupgrade.rb that comes with Puppet. The version that comes with Puppet uses the pkg_* tools, so it is really not that useful with FreeBSD 10 systems (and later) which are using pkgng. Using most of the original code of portupgrade.rb, I crafted portupgrade_pkgng which tries to use pkgng. It basically works the same as the original portupgrade.rb, but under the hood it uses different commands (pkg info, pkg query, pkg delete, etc) than the original.
WARNING: Since this module can invoke dangerous commands such as portinstall, pkg delete, etc, you are hereby warned to use extreme caution when using it. It may install ports, uninstall packages, cause your computer to go critical, etc. Please use very carefully and, if possible, read the code, make fixes and contribute back.
Lastly, unless you want to build a port with some special make options, you really don't need to use this module at all, since what it does is use portinstall to build and install a package. Likewise, it is assumed that you have a working portinstall in your system, an up-to-date ports tree and that you have configured your options to your liking. This module doesn't do any of the above, so please take whatever care you need to take before you use it.
This version works around the absence of /dev/console in FreeBSD Jails by allocating its own pty as input to portinstall/portupgrade commands.
Athanasios Douitsis, 2014
2014-09-19 Athanasios Douitsis email@example.com
- portupgrade_pkgng.rb: The /dev/console device was hitherto used as input for the portinstall and portupgrade commands. However, this device is not generally available when trying to use puppet from within a FreeBSD jail. To fix this, the module now allocates a pseudo-pty just before issuing one of those two commands and then uses it instead of /dev/console.