prop: write prop to /var/lib/waydroid/waydroid.cfg
This commit is contained in:
parent
6c78b793c8
commit
1caafe57e6
1 changed files with 9 additions and 10 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import configparser
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
@ -54,16 +55,14 @@ class General:
|
||||||
z.extractall(self.extract_to)
|
z.extractall(self.extract_to)
|
||||||
|
|
||||||
def add_props(self):
|
def add_props(self):
|
||||||
with open(os.path.join("/var/lib/waydroid/waydroid_base.prop"), "r") as propfile:
|
cfg = configparser.ConfigParser()
|
||||||
prop_content = propfile.read()
|
cfg.read("/var/lib/waydroid/waydroid.cfg")
|
||||||
for key in self.apply_props:
|
|
||||||
if key not in prop_content:
|
for key in self.apply_props.keys():
|
||||||
prop_content = prop_content+"\n{key}={value}".format(key=key, value=self.apply_props[key])
|
cfg.set('properties', key, self.apply_props[key])
|
||||||
else:
|
|
||||||
p = re.compile(r"^{key}=.*$".format(key=key), re.M)
|
with open("/var/lib/waydroid/waydroid.cfg", "w") as f:
|
||||||
prop_content = re.sub(p, "{key}={value}".format(key=key, value=self.apply_props[key]), prop_content)
|
cfg.write(f)
|
||||||
with open(os.path.join("/var/lib/waydroid/waydroid_base.prop"), "w") as propfile:
|
|
||||||
propfile.write(prop_content)
|
|
||||||
|
|
||||||
def mount(self):
|
def mount(self):
|
||||||
img = os.path.join(images.get_image_dir(), self.partition+".img")
|
img = os.path.join(images.get_image_dir(), self.partition+".img")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue