cmd
This commit is contained in:
parent
07a596711d
commit
ba03b50992
3 changed files with 39 additions and 0 deletions
15
cmd/__init__.py
Normal file
15
cmd/__init__.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
commands: list[str] = []
|
||||||
|
packages: list[str] = []
|
||||||
|
|
||||||
|
|
||||||
|
def need(command: str) -> None:
|
||||||
|
match command:
|
||||||
|
case 'debootstrap':
|
||||||
|
package = 'debootstrap'
|
||||||
|
case 'mksquashfs' | 'unsquashfs':
|
||||||
|
package = 'squashfs-tools'
|
||||||
|
case _:
|
||||||
|
package = None
|
||||||
|
if package:
|
||||||
|
if package not in packages:
|
||||||
|
packages.append(package)
|
10
cmd/debootstrap/__init__.py
Normal file
10
cmd/debootstrap/__init__.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from ... import cmd
|
||||||
|
from ... import ps
|
||||||
|
|
||||||
|
cmd.need('debootstrap')
|
||||||
|
|
||||||
|
|
||||||
|
def debootstrap(input_mirror: str, output_root: str):
|
||||||
|
ps.run([
|
||||||
|
'debootstrap',
|
||||||
|
])
|
14
cmd/squashfs/__init__.py
Normal file
14
cmd/squashfs/__init__.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from ... import cmd
|
||||||
|
from ... import ps
|
||||||
|
|
||||||
|
cmd.need('mksquashfs')
|
||||||
|
|
||||||
|
|
||||||
|
def mksquashfs(input_root: str, output_file: str):
|
||||||
|
ps.run([
|
||||||
|
'mksquashfs',
|
||||||
|
input_root,
|
||||||
|
output_file,
|
||||||
|
'-comp', 'zstd',
|
||||||
|
'-Xcompression-level', str(18),
|
||||||
|
])
|
Loading…
Reference in a new issue