summaryrefslogtreecommitdiff
path: root/cloudinit/distros/netbsd.py
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2020-05-04 16:58:35 -0400
committerGitHub <noreply@github.com>2020-05-04 14:58:35 -0600
commitf9b393bb4f15258de230884949e543e0f62f9abb (patch)
tree1993e292c7ebe7f659fe53b6798a7aee603766f5 /cloudinit/distros/netbsd.py
parent59dd290ee7986f76247bfd26d18cbcc586777812 (diff)
downloadvyos-cloud-init-f9b393bb4f15258de230884949e543e0f62f9abb.tar.gz
vyos-cloud-init-f9b393bb4f15258de230884949e543e0f62f9abb.zip
bsd: upgrade support (#305)
Implement the upgrade support: - FreeBSD: using `pkg upgrade` - NetBSD: with `pkgin`
Diffstat (limited to 'cloudinit/distros/netbsd.py')
-rw-r--r--cloudinit/distros/netbsd.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/cloudinit/distros/netbsd.py b/cloudinit/distros/netbsd.py
index 6ae60943..ecc8239a 100644
--- a/cloudinit/distros/netbsd.py
+++ b/cloudinit/distros/netbsd.py
@@ -21,10 +21,18 @@ class NetBSD(cloudinit.distros.bsd.BSD):
"""
ci_sudoers_fn = '/usr/pkg/etc/sudoers.d/90-cloud-init-users'
-
group_add_cmd_prefix = ["groupadd"]
- pkg_cmd_install_prefix = ["pkg_add", "-U"]
- pkg_cmd_remove_prefix = ['pkg_delete']
+
+ def __init__(self, name, cfg, paths):
+ super().__init__(name, cfg, paths)
+ if os.path.exists("/usr/pkg/bin/pkgin"):
+ self.pkg_cmd_install_prefix = ['pkgin', '-y', 'install']
+ self.pkg_cmd_remove_prefix = ['pkgin', '-y', 'remove']
+ self.pkg_cmd_update_prefix = ['pkgin', '-y', 'update']
+ self.pkg_cmd_upgrade_prefix = ['pkgin', '-y', 'full-upgrade']
+ else:
+ self.pkg_cmd_install_prefix = ['pkg_add', '-U']
+ self.pkg_cmd_remove_prefix = ['pkg_delete']
def _get_add_member_to_group_cmd(self, member_name, group_name):
return ['usermod', '-G', group_name, member_name]