stages: add org.osbuild.discinfo
Add a new simple stage to create a .discinfo file, used by the anaconda installer.
This commit is contained in:
parent
6e74c7f52c
commit
f0f4751ca4
1 changed files with 49 additions and 0 deletions
49
stages/org.osbuild.discinfo
Executable file
49
stages/org.osbuild.discinfo
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/python3
|
||||
"""
|
||||
Create a `.discinfo` file describing disk
|
||||
|
||||
This will create a `.discinfo` file with the specified parameters.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": true,
|
||||
"required": ["basearch", "release"],
|
||||
"properties": {
|
||||
"basearch": {
|
||||
"description": "Build architecture.",
|
||||
"type": "string"
|
||||
},
|
||||
"release": {
|
||||
"description": "The product name.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def main(tree, options):
|
||||
basearch = options["basearch"]
|
||||
release = options["release"]
|
||||
|
||||
# Based on `pylorax/discinfo.py`
|
||||
|
||||
timestamp = time.time()
|
||||
with open(os.path.join(tree, ".discinfo"), "w") as f:
|
||||
f.write(f"{timestamp}\n")
|
||||
f.write(f"{release}\n")
|
||||
f.write(f"{basearch}\n")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"], args["options"])
|
||||
sys.exit(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue