From 0f3284a7e3c9c8095777cca293a89f250fc10f28 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 7 Mar 2013 20:06:05 +0100 Subject: [PATCH] Support for detecting Alpine Linux --- setup | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/setup b/setup index 141e635732f..052461dc4e4 100644 --- a/setup +++ b/setup @@ -99,7 +99,8 @@ class Facts(object): OSDIST_DICT = { '/etc/redhat-release': 'RedHat', '/etc/vmware-release': 'VMwareESX', '/etc/openwrt_release': 'OpenWrt', - '/etc/system-release': 'OtherLinux' } + '/etc/system-release': 'OtherLinux', + '/etc/alpine-release': 'Alpine' } SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' } # A list of dicts. If there is a platform with more than one @@ -110,7 +111,8 @@ class Facts(object): { 'path' : '/usr/bin/zypper', 'name' : 'zypper' }, { 'path' : '/usr/bin/pacman', 'name' : 'pacman' }, { 'path' : '/bin/opkg', 'name' : 'opkg' }, - { 'path' : '/opt/local/bin/pkgin', 'name' : 'pkgin' } ] + { 'path' : '/opt/local/bin/pkgin', 'name' : 'pkgin' }, + { 'path' : '/sbin/apk', 'name' : 'apk' } ] def __init__(self): self.facts = {} @@ -164,7 +166,7 @@ class Facts(object): SLED = 'Suse', OpenSuSE = 'Suse', SuSE = 'Suse', Gentoo = 'Gentoo', Archlinux = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris', - SmartOS = 'Solaris', AIX = 'AIX' + SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine' ) if self.facts['system'] == 'AIX': @@ -204,6 +206,10 @@ class Facts(object): release = re.search('DISTRIB_CODENAME="(.*)"', data) if release: self.facts['distribution_release'] = release.groups()[0] + elif name == 'Alpine': + data = get_file_content(path) + self.facts['distribution'] = 'Alpine' + self.facts['distribution_version'] = data else: self.facts['distribution'] = name