install: update reinstall to account for local installs as well
This commit is contained in:
parent
7790d4aa00
commit
06e9a04357
1 changed files with 19 additions and 13 deletions
12
tasks.py
12
tasks.py
|
@ -397,10 +397,11 @@ def install_emane(c, verbose=False, local=False):
|
||||||
help={
|
help={
|
||||||
"dev": "uninstall development mode",
|
"dev": "uninstall development mode",
|
||||||
"verbose": "enable verbose",
|
"verbose": "enable verbose",
|
||||||
|
"local": "determines if core was installed local to system, default is False",
|
||||||
"prefix": f"prefix where scripts are installed, default is {DEFAULT_PREFIX}"
|
"prefix": f"prefix where scripts are installed, default is {DEFAULT_PREFIX}"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
def uninstall(c, dev=False, verbose=False, prefix=DEFAULT_PREFIX):
|
def uninstall(c, dev=False, verbose=False, local=False, prefix=DEFAULT_PREFIX):
|
||||||
"""
|
"""
|
||||||
uninstall core, scripts, service, virtual environment, and clean build directory
|
uninstall core, scripts, service, virtual environment, and clean build directory
|
||||||
"""
|
"""
|
||||||
|
@ -415,6 +416,10 @@ def uninstall(c, dev=False, verbose=False, prefix=DEFAULT_PREFIX):
|
||||||
c.run("make clean", hide=hide)
|
c.run("make clean", hide=hide)
|
||||||
c.run("./bootstrap.sh clean", hide=hide)
|
c.run("./bootstrap.sh clean", hide=hide)
|
||||||
|
|
||||||
|
if local:
|
||||||
|
with p.start("uninstalling core"):
|
||||||
|
c.run("sudo python3 -m pip uninstall -y core")
|
||||||
|
else:
|
||||||
python = get_python(c, warn=True)
|
python = get_python(c, warn=True)
|
||||||
if python:
|
if python:
|
||||||
with c.cd(DAEMON_DIR):
|
with c.cd(DAEMON_DIR):
|
||||||
|
@ -432,10 +437,11 @@ def uninstall(c, dev=False, verbose=False, prefix=DEFAULT_PREFIX):
|
||||||
c.run(f"sudo rm -f {dest}", hide=hide)
|
c.run(f"sudo rm -f {dest}", hide=hide)
|
||||||
|
|
||||||
# remove core-python symlink
|
# remove core-python symlink
|
||||||
|
if not local:
|
||||||
core_python = bin_dir.joinpath("core-python")
|
core_python = bin_dir.joinpath("core-python")
|
||||||
c.run(f"sudo rm -f {core_python}", hide=hide)
|
c.run(f"sudo rm -f {core_python}", hide=hide)
|
||||||
|
|
||||||
# install service
|
# remove service
|
||||||
systemd_dir = Path("/lib/systemd/system/")
|
systemd_dir = Path("/lib/systemd/system/")
|
||||||
service_name = "core-daemon.service"
|
service_name = "core-daemon.service"
|
||||||
service_file = systemd_dir.joinpath(service_name)
|
service_file = systemd_dir.joinpath(service_name)
|
||||||
|
@ -460,7 +466,7 @@ def reinstall(
|
||||||
"""
|
"""
|
||||||
run the uninstall task, get latest from specified branch, and run install task
|
run the uninstall task, get latest from specified branch, and run install task
|
||||||
"""
|
"""
|
||||||
uninstall(c, dev, verbose, prefix)
|
uninstall(c, dev, verbose, local, prefix)
|
||||||
hide = not verbose
|
hide = not verbose
|
||||||
p = Progress(verbose)
|
p = Progress(verbose)
|
||||||
with p.start("pulling latest code"):
|
with p.start("pulling latest code"):
|
||||||
|
|
Loading…
Reference in a new issue