]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blobdiff - webapp/backend/releases.py
netboot: Allow booting multiple architectures
[people/shoehn/ipfire.org.git] / webapp / backend / releases.py
index ff482c0221fe4e347ba660ec41834d2fb9d52a9e..48f7b5d25c7645a40a54dfb0037e67fb883c8b80 100644 (file)
@@ -365,17 +365,49 @@ class Release(Object):
                        if f:
                                f.close()
 
+       def supports_arch(self, arch):
+               # Currently there is nothing else than i586 supported
+               if arch == "i586":
+                       return True
+
+               return False
+
+       def supports_platform(self, platform):
+               # Currently there is nothing else than pcbios supported
+               if platform == "pcbios":
+                       return True
+
+               return False
+
        def is_netboot_capable(self):
                return self.path and "ipfire-2.x" in self.path
 
-       @property
-       def netboot_kernel(self):
+       def netboot_kernel_url(self, arch, platform):
+               assert self.supports_arch(arch)
+               assert self.supports_platform(platform)
+
                return "http://downloads.ipfire.org/%s/images/vmlinuz" % self.path
 
-       @property
-       def netboot_initrd(self):
+       def netboot_initrd_url(self, arch, platform):
+               assert self.supports_arch(arch)
+               assert self.supports_platform(platform)
+
                return "http://downloads.ipfire.org/%s/images/instroot" % self.path
 
+       def netboot_args(self, arch, platform):
+               return ""
+
+       @property
+       def news_id(self):
+               return self.__data.news_id
+
+       @property
+       def news(self):
+               if not hasattr(self, "_news"):
+                       self._news = self.backend.news.get(self.news_id)
+
+               return self._news
+
 
 class Releases(Object):
        def get_by_id(self, id):
@@ -390,6 +422,12 @@ class Releases(Object):
                if ret:
                        return Release(self.backend, ret.id, data=ret)
 
+       def get_by_news_id(self, news_id):
+               ret = self.db.get("SELECT * FROM releases WHERE news_id = %s", news_id)
+
+               if ret:
+                       return Release(self.backend, ret.id, data=ret)
+
        def get_latest(self, stable=True):
                ret = self.db.get("SELECT * FROM releases WHERE published IS NOT NULL AND published <= NOW() \
                        AND stable = %s ORDER BY published DESC LIMIT 1", stable)