Téléverser les fichiers vers "workstation-setup/src"
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include "ProvisioningBackend.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QIcon>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Les champs contiennent temporairement des secrets : pas de core dump.
|
||||
rlimit coreLimit { 0, 0 };
|
||||
setrlimit(RLIMIT_CORE, &coreLimit);
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QGuiApplication::setOrganizationName(QStringLiteral("Raspot"));
|
||||
QGuiApplication::setOrganizationDomain(QStringLiteral("raspot.in"));
|
||||
QGuiApplication::setApplicationName(QStringLiteral("NixOS Workstations Setup"));
|
||||
QGuiApplication::setDesktopFileName(QStringLiteral("org.raspot.nixosworkstations.setup"));
|
||||
|
||||
QIcon::setThemeName(QStringLiteral("breeze"));
|
||||
|
||||
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
||||
QQuickStyle::setStyle(QStringLiteral("Basic"));
|
||||
}
|
||||
|
||||
ProvisioningBackend provisioning;
|
||||
|
||||
// Défense en profondeur : le lanceur filtre déjà l'utilisateur, mais
|
||||
// le backend refuse également toute opération pour un autre compte.
|
||||
if (!provisioning.authorizedUser()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Si les deux marqueurs existent, l'assistant n'a plus rien à faire.
|
||||
if (provisioning.complete()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("provisioning"), &provisioning);
|
||||
engine.loadFromModule(QStringLiteral("org.raspot.nixosworkstations.setup"),
|
||||
QStringLiteral("Main"));
|
||||
|
||||
if (engine.rootObjects().isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user