Skip to content

Commit

Permalink
Merge pull request #213 from h3xp/dev
Browse files Browse the repository at this point in the history
Bugfix for unzip with warnings
  • Loading branch information
mrludo001 authored Oct 31, 2023
2 parents 2c6599d + 3e4a9a9 commit c3c2d79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4594,7 +4594,8 @@ def extract_zipfile(zip_file:str, dir_name: str):
total_size = sum([zinfo.file_size for zinfo in zip_ref.filelist])

if os.path.isdir(dir_name):
shutil.rmtree(dir_name)
os.system("sudo rm -rf {} > /tmp/test".format(dir_name))
#shutil.rmtree(dir_name)
os.mkdir(dir_name)
proc = subprocess.Popen(["/usr/bin/unzip", "-q", zip_file, "-d", dir_name])

Expand All @@ -4604,7 +4605,7 @@ def extract_zipfile(zip_file:str, dir_name: str):
status_bar(total_size, current_size, start_time)
time.sleep(.5)

if proc.returncode != 0:
if proc.returncode > 1:
text = f"Error unzipping file: {zip_file}\n\nWould you like to continue processing and skip this fie?"
code = d.yesno(text=text, ok_label="Continue")
if code == d.OK:
Expand Down Expand Up @@ -5052,12 +5053,14 @@ def reboot_dialog(reboot_msg):
def clean_failures():
if os.path.exists("/tmp/improvements"):
if os.path.isdir("/tmp/improvements"):
os.system("sudo chown -R pi:pi /tmp/improvements/")
shutil.rmtree("/tmp/improvements")
#os.system("sudo chown -R pi:pi /tmp/improvements/")
#shutil.rmtree("/tmp/improvements")
os.system("sudo rm -rf /tmp/improvements/")
if os.path.exists("/tmp/extracted"):
if os.path.isdir("/tmp/extracted"):
os.system("sudo chown -R pi:pi /tmp/extracted/")
shutil.rmtree("/tmp/extracted")
#os.system("sudo chown -R pi:pi /tmp/extracted/")
#shutil.rmtree("/tmp/extracted")
os.system("sudo rm -rf /tmp/extracted/")

return

Expand Down
2 changes: 1 addition & 1 deletion update_tool.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[CONFIG_ITEMS]
tool_ver = 2.8.5
tool_ver = 2.8.6
home_dir = /home/pi/.update_tool
home_command = update.py
home_exe = python3
Expand Down

0 comments on commit c3c2d79

Please sign in to comment.