diff --git a/vmupdate/agent/source/apt/apt_api.py b/vmupdate/agent/source/apt/apt_api.py index 2158d3e..5bd38f8 100644 --- a/vmupdate/agent/source/apt/apt_api.py +++ b/vmupdate/agent/source/apt/apt_api.py @@ -84,6 +84,8 @@ def upgrade_internal(self, remove_obsolete: bool) -> ProcessResult: Path(os.path.join( apt_pkg.config.find_dir("Dir::Cache::Archives"), "partial") ).mkdir(parents=True, exist_ok=True) + apt_pkg.config.set('Dpkg::Options::', "--force-confdef") + apt_pkg.config.set('Dpkg::Options::', "--force-confold") self.log.debug("Committing upgrade...") self.apt_cache.commit( self.progress.fetch_progress, diff --git a/vmupdate/agent/source/apt/apt_cli.py b/vmupdate/agent/source/apt/apt_cli.py index 6beb646..5d15015 100644 --- a/vmupdate/agent/source/apt/apt_cli.py +++ b/vmupdate/agent/source/apt/apt_cli.py @@ -91,7 +91,9 @@ def get_action(self, remove_obsolete: bool) -> List[str]: """ Return command `upgrade` or `dist-upgrade` if `remove_obsolete`. """ - result = ["-y"] + result = ["-y", + "-o", 'Dpkg::Options::="--force-confdef"', + "-o", 'Dpkg::Options::="--force-confold"'] result += ["dist-upgrade"] if remove_obsolete else ["upgrade"] return result diff --git a/vmupdate/agent/source/plugins/apt_keep_old_conffiles.py b/vmupdate/agent/source/plugins/apt_keep_old_conffiles.py deleted file mode 100644 index e208fef..0000000 --- a/vmupdate/agent/source/plugins/apt_keep_old_conffiles.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -# The Qubes OS Project, http://www.qubes-os.org -# -# Copyright (C) 2024 Piotr Bartman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -# USA. - -APT_CONF = "/etc/apt/apt.conf.d/01qubes-update" - - -def apt_keep_old_conffiles(os_data, log, **kwargs): - """ - Always chose default behavior for when conflicts in apt conffiles appears. - """ - if os_data["os_family"] != "Debian": - return - - option = '''Dpkg::Options { - "--force-confdef"; - "--force-confold"; -}''' - with open(APT_CONF, "w") as file: - file.write(f'\n{option}\n')