[pkgselectprocess] Fix usage of checkpackage-backend

If checkpackage-backend does not exist in the target system, likely due to the
use of stacked squashfses, ensure it temporarily exists so it can be used in
the install process. This fixes installation of the Virtual Machine Manager
when selected on the Customize menu (LP: #2104243).
This commit is contained in:
Simon Quigley 2025-04-01 23:55:58 -05:00
parent 0c540f933a
commit 68b993050c
2 changed files with 30 additions and 8 deletions

View File

@ -6,6 +6,7 @@
#include <QDir>
#include <QCoreApplication>
#include <QRegularExpression>
#include <QFile>
CALAMARES_PLUGIN_FACTORY_DEFINITION(PackageSelectProcessFactory, registerPlugin<PackageSelectProcess>();)
@ -359,15 +360,31 @@ Calamares::JobResult PackageSelectProcess::exec()
qDebug() << "Progress range: installStart:" << installStart << "installEnd:" << installEnd;
if (!debPackages.isEmpty()) {
const QString packageList = debPackages.join(" ");
const QString installCommand = QString("DEBIAN_FRONTEND=noninteractive apt-get -y install $(/usr/libexec/checkpackage-backend %1);").arg(packageList);
const QString checkpackage_path = "/usr/libexec/checkpackage-backend";
const QString chroot_checkpackage_path = rootMountPoint + checkpackage_path;
Calamares::JobResult installResult = runAptCommand(installCommand,
rootMountPoint,
installStart,
installEnd,
true);
if (!installResult) return std::move(installResult);
// checkpackage-backend needs to be explicitly copied to the chroot
// and removed later for systems with stacked squashfses, or the
// install command will fail. LP: #2104243
QFile* cpbe = new QFile(chroot_checkpackage_path);
if (!cpbe->exists()) {
QFile* parent_cpbe = new QFile(checkpackage_path);
if (!parent_cpbe->copy(chroot_checkpackage_path)) {
return Calamares::JobResult::error(tr("Internal Error"),
tr("Permission denied when copying checkpackage-backend, are you running Calamares correctly?"));
}
const QString packageList = debPackages.join(" ");
const QString installCommand = QString("DEBIAN_FRONTEND=noninteractive apt-get -y install $(/usr/libexec/checkpackage-backend %1);").arg(packageList);
Calamares::JobResult installResult = runAptCommand(installCommand,
rootMountPoint,
installStart,
installEnd,
true);
if (!cpbe->remove()) qDebug() << "Warning: failed to clean up /usr/libexec/checkpackage-backend";
if (!installResult) return std::move(installResult);
}
}
else qDebug() << "No packages to install.";

5
debian/changelog vendored
View File

@ -1,6 +1,11 @@
calamares-settings-ubuntu (1:25.04.24) UNRELEASED; urgency=medium
* Bump Standards-Version to 4.7.2, no changes needed.
* [pkgselectprocess] If checkpackage-backend does not exist in the target
system, likely due to the use of stacked squashfses, ensure it temporarily
exists so it can be used in the install process. This fixes installation
of the Virtual Machine Manager when selected on the Customize menu
(LP: #2104243).
-- Simon Quigley <tsimonq2@ubuntu.com> Wed, 09 Apr 2025 01:55:07 -0500