build 1.58 KB
Newer Older
1
#!/usr/bin/env python3
2 3
from src import container
from src import iso
4
import os
Xuetian Weng's avatar
Xuetian Weng committed
5
import sys
6 7
from os.path import join as pjoin

8
datadir = os.path.abspath("./data")
Xuetian Weng's avatar
Xuetian Weng committed
9
configdir = os.path.abspath(sys.argv[1]) if len(sys.argv) > 1 else os.path.abspath("./config")
10
outputdir = os.path.abspath("./iso_build")
11

Xuetian Weng's avatar
Xuetian Weng committed
12
def read_package_list(package_config):
13 14
    """Read the file :package_list and return a list of packages"""
    packages = ""
Xuetian Weng's avatar
Xuetian Weng committed
15
    with open(package_config) as package_list:
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
      # TODO: that can be done with a list comprehension...
      for line in package_list:
        line = line.strip()
        if not line or line.startswith("#"):
          continue
        packages = " ".join((packages, line))
    return packages.strip().split()


if __name__ == "__main__":
  locale_archive = "./locale-archive"  # FIXME
  if not os.path.isfile(locale_archive):
    locale_archive = None
  else:
    locale_archive = os.path.abspath(locale_archive)
  package_list = read_package_list(pjoin(configdir, "packages.conf"))
32
  postinstall_package_list = read_package_list(pjoin(configdir, "postinstall_packages.conf"))
33 34
  pacman_config = pjoin(configdir, "pacman.conf")
  container.create(pacman_config, package_list, rootfolder=pjoin(outputdir, "chakra"))
35 36
  if postinstall_package_list:
      container.add_postinall_packages(pacman_config, postinstall_package_list, rootfolder=pjoin(outputdir, "chakra"))
37 38 39
  iso_builder = iso.IsoBuilder(outputdir, datadir, configdir)
  iso_builder.prepare_overlay(locale_archive)
  iso_builder.prepare_iso()
Xuetian Weng's avatar
Xuetian Weng committed
40
  iso_builder.prepare_efi_img()
41 42 43 44
  iso_builder.make_iso()


# vim: set syntax=python: