From afb69c28d18e766b41ccf759ba39d6ad7525fb60 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 4 Oct 2024 10:03:03 -0700 Subject: [PATCH] action_utils: Fix missing parent folder when creating apt hold flag - When freedombox is installed on a Debian system as a package, the folder /var/lib/freedombox does not exist. When the service is run and systemd-resolved is attempted to be installed, we try to hold the freedombox package. We also set a flag to indicate this in /var/lib/freedombox. Since the folder does not exist, it fails. Presumably this will also fail when installing any package. Fix this by creating the parent directory. Tests: - On a fresh Debian system, install the freedombox package with these changes. Wait for setup to run on names app. Install operation fails without this fix and succeed with the fix (this only happens when names app is setup before backups app as backups app creates /var/lib/freedombox directory). Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/action_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index f8104d73b..de1973d2d 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -475,6 +475,7 @@ def apt_hold_freedombox(): yield current_hold else: # Set the flag. + apt_hold_flag.parent.mkdir(mode=0o755, parents=True, exist_ok=True) apt_hold_flag.touch(mode=0o660) yield subprocess.check_call(['apt-mark', 'hold', 'freedombox']) finally: