Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# to update i18n .mo files (and merge .pot file into .po files) run on Linux:
# python setup.py build_i18n -m''

__VERSION__ = '6.2'
__VERSION__ = '6.3'

PROGRAM_VERSION = __VERSION__
prefix = sys.prefix
Expand Down
34 changes: 33 additions & 1 deletion update_station/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,38 @@ def __init__(self):
self.thr = threading.Thread(target=self.read_output, args=[self.pbar], daemon=True)
self.thr.start()

@classmethod
def should_destroy_be(cls, be_line: str, today_str: str) -> bool:
"""
Determines if a Boot Environment should be destroyed based on criteria.
Returns False if the BE is protected (active and mounted at root).
:param be_line: The BE line to check.
:param today_str: The string representation of today's date.
:return: True if the BE should be destroyed, False otherwise.
"""
# Split the line into columns, handling multiple spaces
columns = be_line.split()
if len(columns) < 4:
return False

be_name = columns[0]
active_status = columns[1]
mount_point = columns[2]

# Protect BE if it's active (N) AND mounted at root (/)
if 'N' in active_status and mount_point == '/':
return False

if 'R' in active_status:
return False

# Apply your original deletion criteria
return (
'backup' in be_name and
today_str not in be_name and
'NR' not in active_status
)


def read_output(self, progress):
"""
Expand Down Expand Up @@ -280,7 +312,7 @@ def read_output(self, progress):
txt = _("Cleaning old boot environment")
GLib.idle_add(update_progress, progress, fraction, txt)
for be in bectl.get_be_list():
if 'backup' in be and today not in be and 'NR' not in be:
if self.should_destroy_be(be, today):
bectl.destroy_be(be.split()[0])
backup_name = datetime.datetime.now().strftime(f"{distro.version()}-backup-%Y-%m-%d-%H-%M")
txt = _("Creating boot environment")
Expand Down