refactor: parsed to flags, more path
This commit is contained in:
parent
f1d6e154f9
commit
651dbdc5be
|
@ -10,19 +10,19 @@ def install(parsed) -> None:
|
||||||
args = parsed.parse_args()
|
args = parsed.parse_args()
|
||||||
if args.install:
|
if args.install:
|
||||||
projectDir = Path(__file__).resolve().parent.parent
|
projectDir = Path(__file__).resolve().parent.parent
|
||||||
homeDir = os.getenv("HOME")
|
homeDir = Path(os.getenv("HOME"))
|
||||||
serviceDirExist = os.path.isdir(homeDir + "/.config/systemd/user/")
|
serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
|
||||||
delivered = False
|
delivered = False
|
||||||
|
|
||||||
if serviceDirExist:
|
if serviceDirExist:
|
||||||
delivered = filecmp.cmp(
|
delivered = filecmp.cmp(
|
||||||
os.path.join(projectDir, "services/wthrc.service"),
|
os.path.join(projectDir, "services/wthrc.service"),
|
||||||
homeDir + "/.config/systemd/user/wthrc.service",
|
os.path.join(homeDir, ".config/systemd/user/wthrc.service"),
|
||||||
shallow=True,
|
shallow=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not delivered or not serviceDirExist:
|
if not delivered or not serviceDirExist:
|
||||||
os.environ["DIR"] = projectDir
|
os.environ["DIR"] = str(projectDir)
|
||||||
subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")])
|
subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")])
|
||||||
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
|
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from installer import install
|
from installer import install
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
parsed = argparse.ArgumentParser()
|
flags = argparse.ArgumentParser()
|
||||||
parsed.add_argument("--install", "-i", action="store_true")
|
flags.add_argument("--install", "-i", action="store_true")
|
||||||
|
|
||||||
install(parsed)
|
install(flags)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user