]> git.ipfire.org Git - pakfire.git/commitdiff
Check if pakfire is actually running on an IPFire system.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jul 2011 10:07:03 +0000 (12:07 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 20 Jul 2011 10:07:03 +0000 (12:07 +0200)
That won't cause too much damage on the buildsystems.

pakfire/base.py
pakfire/errors.py

index 18b07473ae357ae1d5c35c4415e56ce090fc5f66..05dbbaf2404f9027d5c36fc762463ae32becc2b4 100644 (file)
@@ -43,7 +43,8 @@ class Pakfire(object):
                        self.builder = False
                        self.path = path
 
-                       # XXX check if we are actually running on an ipfire system.
+                       # check if we are actually running on an ipfire system.
+                       self.check_is_ipfire()
 
                # Read configuration file(s)
                self.config = config.Config(type=config_type)
@@ -121,6 +122,12 @@ class Pakfire(object):
 
                raise BuildError, arch
 
+       def check_is_ipfire(self):
+               ret = os.path.exists("/etc/ipfire-release")
+
+               if not ret:
+                       raise NotAnIPFireSystemError, "You can run pakfire only on an IPFire system"
+
        def install(self, requires):
                # Create a new request.
                request = self.create_request()
index 72f1f5041d2a08a1646dd1afb168bbf6d1408e4b..e49de316460dc82106c70eef87ff0ee955a10db1 100644 (file)
@@ -27,6 +27,9 @@ class FileError(Error):
 class FileNotFoundError(Error):
        pass
 
+class NotAnIPFireSystemError(Error):
+       pass
+
 class PakfireError(Error):
        pass