diff --git a/build.py b/build.py index 2940523..f1ad92c 100755 --- a/build.py +++ b/build.py @@ -23,6 +23,8 @@ targets_meta = Target.load_meta(f"config/target_meta.json") target_board = Board(args.board, f"config/board/{args.board}.json", targets_meta) os.set_board(target_board) +os.check_rootfs() + if (args.sync): target_board.sync() elif (args.target != ""): diff --git a/files/backups/excl_min.lst b/files/backups/excl_min.lst index feca53a..202cf4f 100644 --- a/files/backups/excl_min.lst +++ b/files/backups/excl_min.lst @@ -3,9 +3,9 @@ boot/* media/* usr/lib/python3.13/test* usr/lib64/perl5* -usr/src/* +#usr/src/* var/cache/binpkgs/* var/cache/distfiles/* -vvar/cache/edb/* +var/cache/edb/* var/cache/eix/* var/log/*.log diff --git a/scripts/os.py b/scripts/os.py index 0434dd6..67bc5ea 100644 --- a/scripts/os.py +++ b/scripts/os.py @@ -1,4 +1,4 @@ -import subprocess, os, sys, datetime, getpass, shutil +import subprocess, os, sys, datetime, getpass, shutil, requests from pathlib import Path if __name__ != '__main__': from . import * @@ -21,6 +21,23 @@ class OS: lst.append(act[0]) return lst + def check_rootfs(self): + root_marker = Path(self.root_dir) + if (not root_marker.is_dir()): + Logger.os(f"Download base OS rootfs archive...") + temp_dir = f"{ROOT_DIR}/build/tmp" + os.makedirs(temp_dir, exist_ok=True) + r = requests.get("https://cloud.andreil.by/public.php/dav/files/sbc-rootfs-archive", stream=True) + arch_fn = f"{temp_dir}/sbc_rootfs_archive.tar.xz" + with open(arch_fn, 'wb') as f: + total_length = int(r.headers.get('content-length')) + for chunk in r.iter_content(chunk_size=1024): + f.write(chunk) + os.makedirs(self.root_dir, exist_ok=True) + self.__extract_tar(arch_fn, self.root_dir) + self.__tmp_clean(temp_dir) + self.__chroot("eix-sync -v") + def set_board(self, board): self.board = board self.arch = board.parse_variables("%{ARCH}%")