prop: run 'waydroid upgrade -o' to regenerate base prop
This commit is contained in:
parent
1caafe57e6
commit
abdc3b015d
2 changed files with 23 additions and 8 deletions
|
|
@ -4,7 +4,7 @@ import re
|
||||||
import zipfile
|
import zipfile
|
||||||
import hashlib
|
import hashlib
|
||||||
from tools import images
|
from tools import images
|
||||||
from tools.helper import download_file, get_download_dir, run
|
from tools.helper import download_file, get_download_dir, run, upgrade
|
||||||
from tools.container import DBusContainerService
|
from tools.container import DBusContainerService
|
||||||
from tools.logger import Logger
|
from tools.logger import Logger
|
||||||
|
|
||||||
|
|
@ -103,10 +103,12 @@ class General:
|
||||||
DBusContainerService().Start(self.session)
|
DBusContainerService().Start(self.session)
|
||||||
else:
|
else:
|
||||||
run(["systemctl", "restart", "waydroid-container.service"])
|
run(["systemctl", "restart", "waydroid-container.service"])
|
||||||
|
upgrade()
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
self.stop()
|
self.stop()
|
||||||
self.start()
|
self.start()
|
||||||
|
upgrade()
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
|
@ -17,16 +18,25 @@ def get_download_dir():
|
||||||
os.makedirs(download_loc)
|
os.makedirs(download_loc)
|
||||||
return download_loc
|
return download_loc
|
||||||
|
|
||||||
def run(args):
|
def run(args: list, env = None, ignore = None):
|
||||||
result = subprocess.run(args=args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result = subprocess.run(
|
||||||
|
args=args,
|
||||||
|
env=env,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
|
||||||
# print(result.stdout.decode())
|
# print(result.stdout.decode())
|
||||||
if result.stderr:
|
if result.stderr:
|
||||||
Logger.error(result.stderr.decode("utf-8"))
|
error = result.stderr.decode("utf-8")
|
||||||
|
if ignore and re.match(ignore, error):
|
||||||
|
return result
|
||||||
|
Logger.error(error)
|
||||||
raise subprocess.CalledProcessError(
|
raise subprocess.CalledProcessError(
|
||||||
returncode = result.returncode,
|
returncode=result.returncode,
|
||||||
cmd = result.args,
|
cmd=result.args,
|
||||||
stderr = result.stderr
|
stderr=result.stderr
|
||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def download_file(url, f_name):
|
def download_file(url, f_name):
|
||||||
|
|
@ -72,3 +82,6 @@ def check_root():
|
||||||
if os.geteuid() != 0:
|
if os.geteuid() != 0:
|
||||||
Logger.error("This script must be run as root. Aborting.")
|
Logger.error("This script must be run as root. Aborting.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
run(["waydroid", "upgrade", "-o"], ignore=r"\[.*\] Stopping container\n\[.*\] Starting container")
|
||||||
Loading…
Reference in a new issue