Hack.
authorCarl Hetherington <cth@carlh.net>
Tue, 29 Sep 2015 18:43:23 +0000 (19:43 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 29 Sep 2015 18:43:23 +0000 (19:43 +0100)
cdist

diff --git a/cdist b/cdist
index b2176fdbff8d655375b440a68dae28423105ccc0..21f363e1e5215b2941a60612f40833152886f0d0 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -542,11 +542,17 @@ def target_factory(s, debug, work):
         target = ChrootTarget(p[0], p[1], int(p[2]), work)
     elif s == 'raspbian':
         target = ChrootTarget(s, None, None, work)
-    elif s.startswith('fedora-'):
-        p = s.split('-')
-        if len(p) != 3:
-            raise Error("Bad Linux target name `%s'; must be something like fedora-22-64 (i.e. distro-version-bits)" % s)
-        target = HostTarget(p[0], p[1], int(p[2]), work)
+    elif s == 'host':
+        try:
+            f = open('/etc/fedora-release', 'r')
+            l = f.readline().strip().split()
+            if command_and_read('uname -m') == 'x86_64':
+                bits = 64
+            else:
+                bits = 32
+            target = HostTarget("fedora", l[2], bits, work)
+        except:
+            raise Error("could not identify distribution for `host' target")
     elif s.startswith('osx-'):
         target = OSXSingleTarget(int(s.split('-')[1]), work)
     elif s == 'osx':