From: Michael Tremer Date: Wed, 20 Jul 2011 10:07:03 +0000 (+0200) Subject: Check if pakfire is actually running on an IPFire system. X-Git-Tag: 0.9.3~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b1e25fd083cb5749157cc39c8346a52d84cbd96;p=pakfire.git Check if pakfire is actually running on an IPFire system. That won't cause too much damage on the buildsystems. --- diff --git a/pakfire/base.py b/pakfire/base.py index 18b07473..05dbbaf2 100644 --- a/pakfire/base.py +++ b/pakfire/base.py @@ -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() diff --git a/pakfire/errors.py b/pakfire/errors.py index 72f1f504..e49de316 100644 --- a/pakfire/errors.py +++ b/pakfire/errors.py @@ -27,6 +27,9 @@ class FileError(Error): class FileNotFoundError(Error): pass +class NotAnIPFireSystemError(Error): + pass + class PakfireError(Error): pass