mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
auto-update fix
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -58,7 +58,7 @@ def check(version, repo, native=True):
|
|||||||
|
|
||||||
|
|
||||||
def make_path_for(name):
|
def make_path_for(name):
|
||||||
path = os.path.join("/opt/", name)
|
path = os.path.join("/home/pi/", name)
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
logging.debug("[update] deleting %s" % path)
|
logging.debug("[update] deleting %s" % path)
|
||||||
shutil.rmtree(path, ignore_errors=True, onerror=None)
|
shutil.rmtree(path, ignore_errors=True, onerror=None)
|
||||||
@ -138,10 +138,20 @@ def install(display, update):
|
|||||||
if not os.path.exists(source_path):
|
if not os.path.exists(source_path):
|
||||||
source_path = "%s-%s" % (source_path, update['available'])
|
source_path = "%s-%s" % (source_path, update['available'])
|
||||||
|
|
||||||
# setup.py is going to install data files for us
|
try:
|
||||||
# first we create a new virtual environment and activate it
|
# Activate the virtual environment and install the package
|
||||||
os.system("cd /home/pi && source .pwn/bin/activate")
|
subprocess.run(
|
||||||
os.system("cd %s && pip3 install ." % source_path)
|
["bash", "-c", f"source /home/pi/.pwn/bin/activate && pip install {source_path}"],
|
||||||
|
check=True
|
||||||
|
)
|
||||||
|
|
||||||
|
# Clean up the source directory
|
||||||
|
shutil.rmtree(source_path, ignore_errors=True)
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
logging.error(f"Installation failed: {e}")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Unexpected error: {e}")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user