debian-forge/mounts/org.osbuild.xfs
Thomas Lavocat 5112f72cbf mounts: use the options object for mountopts
This modification will allow a user to ask to mount the system as read
only for instance. Which would be super useful for image-info who is
progressively using more of OSbuild internals to mount partitions.
2022-11-30 14:21:10 +01:00

53 lines
950 B
Python
Executable file

#!/usr/bin/python3
"""
XFS mount service
Mount a XFS filesystem at the given location.
Host commands used: mount
"""
import sys
from typing import Dict
from osbuild import mounts
SCHEMA_2 = """
"additionalProperties": false,
"required": ["name", "type", "source", "target"],
"properties": {
"name": { "type": "string" },
"type": { "type": "string" },
"source": {
"type": "string"
},
"target": {
"type": "string"
},
"options": {
"type": "object",
"additionalProperties": false,
"properties": {
"readonly": {
"description": "mount the source as a readonly device",
"type": "boolean"
}
}
}
}
"""
class XfsMount(mounts.FileSystemMountService):
def translate_options(self, options: Dict):
return ["-t", "xfs"] + super().translate_options(options)
def main():
service = XfsMount.from_args(sys.argv[1:])
service.main()
if __name__ == '__main__':
main()