diff --git a/nextcloud/install.py b/nextcloud/install.py index 6b808e0..d48e7f7 100755 --- a/nextcloud/install.py +++ b/nextcloud/install.py @@ -10,8 +10,8 @@ import random def main(): INSENV = ".env-nextc" - DOCOMP = "docker-compose" - USRCMP = ("sudo", DOCOMP, "exec", "-u", "1000") + DOCOMP = ("docker", "compose") + USRCMP = ("sudo",) + DOCOMP + ("exec", "-u", "1000") if not os.path.exists("docker-compose.yml"): raise ProgramError("Needs to be run from compose directory\n") @@ -53,12 +53,10 @@ def main(): ROOTPASS = "".join(random.choices(string.ascii_uppercase + string.digits, k=10)) print ("...setting") cmd = USRCMP + ("nextc-db", "mysqladmin", "-u", "root", "password", ROOTPASS) - print (cmd) try: out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True) except subprocess.CalledProcessError as err: print (err.stderr) - print (err.stdout) raise ProgramError("Failure to create DB password") with open (INSENV, 'a') as out: print("ROOTPASS=" + ROOTPASS, file=out) @@ -85,8 +83,8 @@ def main(): cmd = USRCMP + ("-w", "/config/www/nextcloud", "nextc", "php", "occ", "status") try: out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True) - except subprocess.CalledProcessError: - print(out.stderr) + except subprocess.CalledProcessError as err: + print(err.stderr) raise ProgramError("Failure to check install status (" + out.stderr + ")") if "installed:" not in out.stdout: raise ProgramError("No result from install status test") @@ -104,7 +102,6 @@ def main(): out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True) except subprocess.CalledProcessError as err: print(err.stderr) - print(err.stdout) raise ProgramError("Failure to install") print("...success")