To avoid kernel panics if the kernel attempts to recover the filesystem when it's mounted as readonly. Offer the possiblity to use the norecovery option for journaling file systems (Xfs, Ext4, Btrfs).
59 lines
1.1 KiB
Python
Executable file
59 lines
1.1 KiB
Python
Executable file
#!/usr/bin/python3
|
|
"""
|
|
btrfs mount service
|
|
|
|
Mount a btrfs 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",
|
|
"default": false
|
|
},
|
|
"norecovery": {
|
|
"description": "Don't load the journal on mounting",
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
|
|
|
|
class BtrfsMount(mounts.FileSystemMountService):
|
|
|
|
def translate_options(self, options: Dict):
|
|
return ["-t", "btrfs"] + super().translate_options(options)
|
|
|
|
|
|
def main():
|
|
service = BtrfsMount.from_args(sys.argv[1:])
|
|
service.main()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|