Added a clear iso feature for the ISO clean

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2023-09-06 19:27:28 +09:00
parent 1d414e75fa
commit 7d23b76d47
1 changed files with 20 additions and 12 deletions

View File

@ -11,6 +11,7 @@ import shutil
from pathlib import Path
from datetime import date
# Set the home path used regardless the user logged in
BSTRING_ISO_CONFIGS = '~/bubbles/iso_configs'
HOME_FOLDER = str(Path(BSTRING_ISO_CONFIGS).expanduser())
@ -440,15 +441,22 @@ def copy_devuan_opb_based():
def kill_old_iso():
""" Delete older ISOs"""
for p in paths.nightly_paths:
N = 1
os.chdir(os.path.join(os.getcwd(), p))
list_of_files = os.listdir()
current_time = time.time()
day = 86400
for fls in list_of_files:
file_location = os.path.join(os.getcwd(), fls)
file_time = os.stat(file_location).st_mtime
if file_time < current_time - day*N:
print(f" Delete : {fls}")
os.remove(file_location)
base_path = '/var/www/html/nightly/'
arch_list = ['deb32/', 'deb64/', 'debarm/', 'dev32/', 'dev64/', 'devarm/']
de_list = ['gnome-flashback', 'openbox', 'xfce']
for archs in arch_list:
for desktops in de_list:
full_path = []
full_path.append(base_path + archs + desktops)
for working_paths in full_path:
N = 1
os.chdir(os.path.join(os.getcwd(), working_paths))
list_of_files = os.listdir()
current_time = time.time()
day = 86400
for fls in list_of_files:
file_location = os.path.join(os.getcwd(), fls)
file_time = os.stat(file_location).st_mtime
if file_time < current_time - day*N:
print(f" Delete : {fls}")
os.remove(file_location)