Add scripts/patch-weboffice-collabora-yaml.py
This commit is contained in:
32
scripts/patch-weboffice-collabora-yaml.py
Normal file
32
scripts/patch-weboffice-collabora-yaml.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
from ruamel.yaml import YAML
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
yaml = YAML()
|
||||
yaml.preserve_quotes = True
|
||||
|
||||
path = Path(sys.argv[1])
|
||||
|
||||
with path.open("r") as f:
|
||||
data = yaml.load(f)
|
||||
|
||||
extra = data["services"]["collabora"]["environment"]["extra_params"]
|
||||
|
||||
# normalize to string
|
||||
extra_str = str(extra)
|
||||
|
||||
if "--o:hexify_embedded_urls=true" in extra_str:
|
||||
print("[patch-weboffice-collabora-yaml] already patched")
|
||||
sys.exit(0)
|
||||
|
||||
lines = extra_str.splitlines()
|
||||
|
||||
lines.append(" --o:hexify_embedded_urls=true")
|
||||
|
||||
data["services"]["collabora"]["environment"]["extra_params"] = "\n".join(lines)
|
||||
|
||||
with path.open("w") as f:
|
||||
yaml.dump(data, f)
|
||||
|
||||
print("[patch-weboffice-collabora-yaml] patched successfully")
|
||||
Reference in New Issue
Block a user