mirror of
https://github.com/andreili/SBC_builder.git
synced 2025-08-23 19:04:06 +02:00
Add a basic rootfs preparation
This commit is contained in:
parent
fe18f2da2a
commit
eadeba42bc
2
build.py
2
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 != ""):
|
||||
|
@ -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
|
||||
|
@ -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}%")
|
||||
|
Loading…
x
Reference in New Issue
Block a user