summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Lefebvre <fred.lefebvre@gmail.com>2019-12-04 09:27:06 -0800
committerRyan Harper <ryan.harper@canonical.com>2019-12-04 11:27:06 -0600
commit90535673f580b8819dbb7ea97eb216d0620b86c7 (patch)
treef5f646c337d524cf5e83769b18a0681d901496c2
parent7ef655c183b8e1490722053eae9b0f216916c686 (diff)
downloadvyos-cloud-init-90535673f580b8819dbb7ea97eb216d0620b86c7.tar.gz
vyos-cloud-init-90535673f580b8819dbb7ea97eb216d0620b86c7.zip
setup.py: Amazon Linux sets libexec to /usr/libexec (#52)
Parse /etc/system-release-cpe to detect Amazon Linux and set the proper value.
-rwxr-xr-xsetup.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index fcaf26ff..01a67b95 100755
--- a/setup.py
+++ b/setup.py
@@ -174,6 +174,19 @@ if os.uname()[0] == 'FreeBSD':
USR_LIB_EXEC = "usr/local/lib"
elif os.path.isfile('/etc/redhat-release'):
USR_LIB_EXEC = "usr/libexec"
+elif os.path.isfile('/etc/system-release-cpe'):
+ with open('/etc/system-release-cpe') as f:
+ cpe_data = f.read().rstrip().split(':')
+
+ if cpe_data[1] == "\o":
+ # URI formated CPE
+ inc = 0
+ else:
+ # String formated CPE
+ inc = 1
+ (cpe_vendor, cpe_product, cpe_version) = cpe_data[2+inc:5+inc]
+ if cpe_vendor == "amazon":
+ USR_LIB_EXEC = "usr/libexec"
class MyEggInfo(egg_info):