stages/io.weldr.grub2: drop unused functions and options
Since we no longer use grub2-mkconfig, but write static configuration we can drop most of the helpers. The partitin table id was never used in the first place. We use filesystem UUIDs, not partition UUIDs to name our root/boot partitions. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
0dd84e66d4
commit
a428572382
3 changed files with 2 additions and 42 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "base-qcow2",
|
||||
"base": "445c09ba71fd656aadcc2c1e84adb12dcc5fd193fcbdc386b63e2fc02e134e98",
|
||||
"base": "d7f6aca0b9cf09833f70983c20ef3ac6e626152ee99901fc07f26cbf85c2bced",
|
||||
"assembler":
|
||||
{
|
||||
"name": "io.weldr.qcow2",
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@
|
|||
"name": "io.weldr.grub2",
|
||||
"systemResourcesFromEtc": ["/etc/grub.d"],
|
||||
"options": {
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"partition_table_id": "0xdeadbeef"
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,50 +1,11 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import contextlib
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def tree_size(tree):
|
||||
size = 0
|
||||
for root, dirs, files in os.walk(tree):
|
||||
for entry in files + dirs:
|
||||
path = os.path.join(root, entry)
|
||||
size += os.stat(path, follow_symlinks=False).st_size
|
||||
return size
|
||||
|
||||
@contextlib.contextmanager
|
||||
def mount(source, dest, *options):
|
||||
os.makedirs(dest, 0o755, True)
|
||||
subprocess.run(["mount", *options, source, dest], check=True)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
subprocess.run(["umount", "-R", dest], check=True)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def mount_api(dest):
|
||||
with mount("/dev", f"{dest}/dev", "-o", "rbind"), \
|
||||
mount("/proc", f"{dest}/proc", "-o", "rbind"), \
|
||||
mount("/sys", f"{dest}/sys", "-o", "rbind"), \
|
||||
mount("none", f"{dest}/run", "-t", "tmpfs"):
|
||||
yield
|
||||
|
||||
@contextlib.contextmanager
|
||||
def loop_device(image):
|
||||
r = subprocess.run(["losetup", "--show", "--find", image], stdout=subprocess.PIPE, encoding="utf-8", check=True)
|
||||
loop = r.stdout.strip()
|
||||
try:
|
||||
yield loop
|
||||
finally:
|
||||
subprocess.run(["losetup", "-d", loop], check=True)
|
||||
|
||||
def main(tree, options):
|
||||
partition_table_id = options["partition_table_id"]
|
||||
root_fs_uuid = options["root_fs_uuid"]
|
||||
|
||||
# Create the configuration file that determines how grub.cfg is generated.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue