dbs
This commit is contained in:
parent
5112761af5
commit
e11b92e57b
4 changed files with 22 additions and 29 deletions
|
@ -1,10 +0,0 @@
|
||||||
import cmd
|
|
||||||
import ps
|
|
||||||
|
|
||||||
cmd.need('debootstrap')
|
|
||||||
|
|
||||||
|
|
||||||
def debootstrap(input_mirror: str, output_root: str):
|
|
||||||
ps.run([
|
|
||||||
'debootstrap',
|
|
||||||
])
|
|
17
deb.py
17
deb.py
|
@ -1,17 +0,0 @@
|
||||||
import subprocess
|
|
||||||
|
|
||||||
BOOTSTRAP_ARCHITECTURE = 'amd64'
|
|
||||||
BOOTSTRAP_VARIANT = 'minbase'
|
|
||||||
|
|
||||||
|
|
||||||
def bootstrap(root_path: str, suite: str, mirror_location: str):
|
|
||||||
command = [
|
|
||||||
'debootstrap',
|
|
||||||
'--arch', BOOTSTRAP_ARCHITECTURE,
|
|
||||||
'--variant', BOOTSTRAP_VARIANT,
|
|
||||||
suite,
|
|
||||||
root_path,
|
|
||||||
mirror_location,
|
|
||||||
]
|
|
||||||
completed_process = subprocess.run(command, capture_output=True)
|
|
||||||
return completed_process
|
|
20
deb/__init__.py
Normal file
20
deb/__init__.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import cmd
|
||||||
|
import ps
|
||||||
|
|
||||||
|
cmd.need('debootstrap')
|
||||||
|
|
||||||
|
BOOTSTRAP_ARCHITECTURE = 'amd64'
|
||||||
|
BOOTSTRAP_VARIANT = 'minbase'
|
||||||
|
|
||||||
|
|
||||||
|
def bootstrap(root_path: str, suite: str, mirror_location: str):
|
||||||
|
command = [
|
||||||
|
('debootstrap',),
|
||||||
|
('--arch', BOOTSTRAP_ARCHITECTURE),
|
||||||
|
('--variant', BOOTSTRAP_VARIANT),
|
||||||
|
(suite,),
|
||||||
|
(root_path,),
|
||||||
|
(mirror_location,),
|
||||||
|
]
|
||||||
|
completed_process = ps.run(command)
|
||||||
|
return completed_process
|
|
@ -17,12 +17,12 @@ def run(*tuples) -> subprocess.CompletedProcess:
|
||||||
return subprocess.run(get_tuples_args(tuples), capture_output=False)
|
return subprocess.run(get_tuples_args(tuples), capture_output=False)
|
||||||
|
|
||||||
|
|
||||||
def run_line(*tuples, charset:str = txt.CHARSET) -> str:
|
def run_line(*tuples, charset: str = txt.CHARSET) -> str:
|
||||||
lines = run_lines(*get_tuples_args(tuples), charset=charset)
|
lines = run_lines(*get_tuples_args(tuples), charset=charset)
|
||||||
return lines[0]
|
return lines[0]
|
||||||
|
|
||||||
|
|
||||||
def run_lines(*tuples, charset:str = txt.CHARSET) -> list[str]:
|
def run_lines(*tuples, charset: str = txt.CHARSET) -> list[str]:
|
||||||
process = subprocess.run(get_tuples_args(tuples), capture_output=True)
|
process = subprocess.run(get_tuples_args(tuples), capture_output=True)
|
||||||
string = process.stdout.decode(charset)
|
string = process.stdout.decode(charset)
|
||||||
return string.rstrip().splitlines()
|
return string.rstrip().splitlines()
|
||||||
|
|
Loading…
Reference in a new issue