diff options
Diffstat (limited to 'raveos-calamares-module')
| -rw-r--r-- | raveos-calamares-module/PKGBUILD | 4 | ||||
| -rw-r--r-- | raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp | 1 | ||||
| -rw-r--r-- | raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp | 20 | ||||
| -rw-r--r-- | raveos-calamares-module/wifi/NetworkManager.cpp | 54 | ||||
| -rw-r--r-- | raveos-calamares-module/wifi/NetworkManager.h | 2 | ||||
| -rw-r--r-- | raveos-calamares-module/wifi/WifiViewStep.cpp | 20 |
6 files changed, 2 insertions, 99 deletions
diff --git a/raveos-calamares-module/PKGBUILD b/raveos-calamares-module/PKGBUILD index 6a128e9..2b0aedd 100644 --- a/raveos-calamares-module/PKGBUILD +++ b/raveos-calamares-module/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: nippy <nippy@tuta.io> pkgname=raveos-calamares-module pkgver=2.0.0 -pkgrel=34 +pkgrel=35 pkgdesc="RaveOS Calamares modules: Wi-Fi, Welcome, Desktop Selector, Users" arch=('x86_64') options=('!debug') @@ -9,7 +9,7 @@ url="https://git.rp1.hu/RaveOS" license=('GPL') makedepends=('cmake' 'qt6-tools' 'kcoreaddons' 'calamares' 'libxcrypt') -depends=('qt6-base' 'qt6-declarative' 'networkmanager' 'xorg-setxkbmap') +depends=('qt6-base' 'qt6-declarative' 'networkmanager' 'xorg-setxkbmap' 'calamares') source=() sha256sums=() diff --git a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp index 2c2691f..b856a90 100644 --- a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp +++ b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp @@ -114,7 +114,6 @@ void DesktopSelectViewStep::onLeave() if (!m_backend || m_backend->selectedIndex() < 0) return; - // Merge mandatory + selected desktop packages, deduplicated QStringList combined = m_mandatoryPackages + m_backend->selectedPackages(); QStringList unique; QSet<QString> seen; diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp index 86ab549..c2d58c7 100644 --- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp +++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp @@ -20,7 +20,6 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION(RaveWelcomeViewStepFactory, registerPlugin<RaveWelcomeViewStep>();) -// Widget that paints the background image scaled to fill (like Image.Stretch) class BgWidget : public QWidget { public: @@ -43,7 +42,6 @@ private: RaveWelcomeViewStep::RaveWelcomeViewStep(QObject* parent) : Calamares::ViewStep(parent) { - // Default languages if not set via config m_localeIds = { "de", "en", "en_GB", "hu" }; } @@ -98,7 +96,6 @@ void RaveWelcomeViewStep::buildWidget() auto* bg = new BgWidget(); bg->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // Load welcome image from branding QString imgPath; if (Calamares::Branding::instance()) imgPath = Calamares::Branding::instance()->imagePath(Calamares::Branding::ProductWelcome); @@ -106,7 +103,6 @@ void RaveWelcomeViewStep::buildWidget() if (!imgPath.isEmpty()) bg->setPixmap(QPixmap(imgPath)); - // Bottom language bar auto* bar = new QFrame(); bar->setObjectName("ravewelcomeBar"); bar->setFixedHeight(58); @@ -116,11 +112,9 @@ void RaveWelcomeViewStep::buildWidget() m_langCombo->setFixedHeight(40); m_langCombo->setMinimumWidth(300); - // Populate language model auto* model = new Calamares::Locale::TranslationsModel(m_localeIds, m_langCombo); m_langCombo->setModel(model); - // Select current locale QLocale sys = QLocale::system(); QString sysName = sys.name(); m_currentLocaleIndex = 0; @@ -132,15 +126,12 @@ void RaveWelcomeViewStep::buildWidget() break; } } - // Default to "en" int enIdx = m_localeIds.indexOf("en"); if (enIdx >= 0 && m_currentLocaleIndex == 0 && m_localeIds[0] != "en") m_currentLocaleIndex = enIdx; m_langCombo->setCurrentIndex(m_currentLocaleIndex); - // Make the live keyboard layout match the initial language right away, - // so the WiFi password input is not stuck on the boot default (US). applyLiveKeyboardLayout(m_localeIds.value(m_currentLocaleIndex)); connect(m_langCombo, QOverload<int>::of(&QComboBox::activated), @@ -176,9 +167,6 @@ void RaveWelcomeViewStep::onLanguageChanged(int index) m_currentLocaleIndex = index; QString localeId = m_localeIds[index]; - // Store locale in GlobalStorage for the installed system. - // A localecfg a teljes localeConf-ot olvassa, ezért minden LC_* kulcsot - // beírunk, ne csak a LANG-ot. if (Calamares::JobQueue::instance()) { Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); @@ -199,18 +187,13 @@ void RaveWelcomeViewStep::onLanguageChanged(int index) localeConf.insert(QLatin1String(k), fullLocale); gs->insert("localeConf", localeConf); - // A 'locale' kulcs is kell (nyelv, kódolás nélkül), ha a standard - // locale modul mégis olvasná. gs->insert("locale", lang); } } - // Install new translator - this changes the entire Calamares UI language Calamares::Locale::Translation::Id tid { localeId }; Calamares::installTranslator(tid, brandingTranslationsPrefix()); - // Apply the matching live keyboard layout immediately, so the WiFi - // password input follows the selected language (before the keyboard page). applyLiveKeyboardLayout(localeId); } @@ -237,9 +220,6 @@ void RaveWelcomeViewStep::applyLiveKeyboardLayout(const QString& localeId) layout = QStringLiteral("gb"); } - // Best effort: apply the layout to the running X11 session so the WiFi - // password input matches the selected language immediately. A missing - // setxkbmap or non-X11 session must not break the installer. const QStringList args { QStringLiteral("-layout"), layout }; QProcess::startDetached(QStringLiteral("setxkbmap"), args); } diff --git a/raveos-calamares-module/wifi/NetworkManager.cpp b/raveos-calamares-module/wifi/NetworkManager.cpp index 8274e1a..cb88698 100644 --- a/raveos-calamares-module/wifi/NetworkManager.cpp +++ b/raveos-calamares-module/wifi/NetworkManager.cpp @@ -13,10 +13,8 @@ #include <QTextStream> #include <QDateTime> -// NetworkManager expects a{sa{sv}} type for connection settings typedef QMap<QString, QVariantMap> NMConnectionSettings; -// Log file path static const QString LOG_FILE = "/tmp/calamares-wifi.log"; static void wifiLog(const QString& message) @@ -24,7 +22,6 @@ static void wifiLog(const QString& message) QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"); QString logLine = QString("[%1] %2\n").arg(timestamp, message); - // Write to file QFile file(LOG_FILE); if (file.open(QIODevice::Append | QIODevice::Text)) { @@ -33,17 +30,14 @@ static void wifiLog(const QString& message) file.close(); } - // Also print to debug output qDebug().noquote() << "[WiFi Module]" << message; } NetworkManager::NetworkManager(QObject* parent) : QObject(parent) { - // Register the custom DBus type qDBusRegisterMetaType<NMConnectionSettings>(); - // Clear log file on start QFile file(LOG_FILE); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -56,7 +50,6 @@ NetworkManager::NetworkManager(QObject* parent) scan(); updateConnectionState(); - // Periodic connection state update QTimer* timer = new QTimer(this); connect(timer, &QTimer::timeout, this, &NetworkManager::updateConnectionState); timer->start(3000); @@ -88,7 +81,6 @@ void NetworkManager::updateConnectionState() bool newState = false; - // Method 1: Check PrimaryConnection QDBusObjectPath primary = nm.property("PrimaryConnection").value<QDBusObjectPath>(); @@ -97,7 +89,6 @@ void NetworkManager::updateConnectionState() newState = true; } - // Method 2: Check if any WiFi device is in activated state (100) if (!newState) { QDBusReply<QList<QDBusObjectPath>> devices = nm.call("GetDevices"); @@ -118,7 +109,6 @@ void NetworkManager::updateConnectionState() "DeviceType" ); - // DeviceType 2 = WiFi if (typeReply.isValid() && typeReply.value().toUInt() == 2) { QDBusReply<QVariant> stateReply = devProps.call( @@ -127,7 +117,6 @@ void NetworkManager::updateConnectionState() "State" ); - // State 100 = NM_DEVICE_STATE_ACTIVATED if (stateReply.isValid()) { uint state = stateReply.value().toUInt(); @@ -184,7 +173,6 @@ void NetworkManager::scan() bool foundWireless = false; for (const auto& dev : devices.value()) { - // Check DeviceType first - type 2 = WiFi QDBusInterface devProps( "org.freedesktop.NetworkManager", dev.path(), @@ -207,7 +195,6 @@ void NetworkManager::scan() foundWireless = true; wifiLog(QString("Found wireless device: %1").arg(dev.path())); - // Now use the Wireless interface for scanning QDBusInterface wirelessIf( "org.freedesktop.NetworkManager", dev.path(), @@ -215,7 +202,6 @@ void NetworkManager::scan() QDBusConnection::systemBus() ); - // Request a new scan - this is async QDBusMessage reply = wirelessIf.call("RequestScan", QVariantMap()); if (reply.type() == QDBusMessage::ErrorMessage) { wifiLog(QString("Scan request failed: %1").arg(reply.errorMessage())); @@ -228,7 +214,6 @@ void NetworkManager::scan() wifiLog("No wireless devices found!"); } - // Wait for scan to complete, then fetch results QTimer::singleShot(2000, this, &NetworkManager::fetchAccessPoints); } @@ -262,7 +247,6 @@ void NetworkManager::fetchAccessPoints() for (const auto& dev : devices.value()) { - // Check DeviceType first - type 2 = WiFi QDBusInterface devProps( "org.freedesktop.NetworkManager", dev.path(), @@ -308,7 +292,6 @@ void NetworkManager::fetchAccessPoints() QByteArray ssidRaw = apIf.property("Ssid").toByteArray(); QString ssid = QString::fromUtf8(ssidRaw); - // Get frequency to show 2.4G vs 5G uint frequency = apIf.property("Frequency").toUInt(); QString band = (frequency > 4000) ? "5GHz" : "2.4GHz"; @@ -319,7 +302,6 @@ void NetworkManager::fetchAccessPoints() } } - // Sort networks alphabetically m_networks.sort(Qt::CaseInsensitive); wifiLog(QString("Total networks found: %1").arg(m_networks.size())); @@ -343,7 +325,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) return; } - // Find the wireless device QDBusReply<QList<QDBusObjectPath>> devices = nm.call("GetDevices"); if (!devices.isValid()) { @@ -372,13 +353,11 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) "DeviceType" ); - // DeviceType 2 = WiFi if (typeReply.isValid() && typeReply.value().toUInt() == 2) { wirelessDevice = dev; wifiLog(QString("Using wireless device: %1").arg(dev.path())); - // Find the access point for this SSID QDBusInterface wirelessIf( "org.freedesktop.NetworkManager", dev.path(), @@ -402,7 +381,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) if (QString::fromUtf8(apSsid) == ssid) { accessPoint = ap; - // Get security flags from AP apFlags = apIf.property("Flags").toUInt(); apWpaFlags = apIf.property("WpaFlags").toUInt(); apRsnFlags = apIf.property("RsnFlags").toUInt(); @@ -423,25 +401,17 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) return; } - // Determine security type from AP flags - // NM_802_11_AP_SEC flags: - // 0x100 = KEY_MGMT_PSK (WPA/WPA2 Personal) - // 0x200 = KEY_MGMT_802_1X (WPA/WPA2 Enterprise) - // 0x400 = KEY_MGMT_SAE (WPA3) - // 0x800 = KEY_MGMT_OWE (Enhanced Open) bool apSupportsPsk = ((apWpaFlags & 0x100) != 0) || ((apRsnFlags & 0x100) != 0); bool apSupportsSae = (apRsnFlags & 0x400) != 0; // WPA3 bool apSupportsEnterprise = ((apWpaFlags & 0x200) != 0) || ((apRsnFlags & 0x200) != 0); bool apIsOpen = (apFlags == 0) && (apWpaFlags == 0) && (apRsnFlags == 0); - // Privacy flag (0x1) means network is secured (WEP or better) bool apHasPrivacy = (apFlags & 0x1) != 0; wifiLog(QString("Security detection: PSK=%1, SAE=%2, Enterprise=%3, Open=%4, Privacy=%5") .arg(apSupportsPsk).arg(apSupportsSae).arg(apSupportsEnterprise).arg(apIsOpen).arg(apHasPrivacy)); - // Build connection settings using proper NM types QVariantMap connection; connection["type"] = QString("802-11-wireless"); connection["id"] = ssid; @@ -451,7 +421,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) wifi["ssid"] = ssid.toUtf8(); wifi["mode"] = QString("infrastructure"); - // For hidden networks, we need to set hidden flag bool isHiddenNetwork = (accessPoint.path() == "/" || accessPoint.path().isEmpty()); if (isHiddenNetwork) { @@ -459,7 +428,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) wifiLog("Treating as hidden network"); } - // Build settings map NMConnectionSettings settings; settings["connection"] = connection; @@ -471,28 +439,21 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) ipv6["method"] = QString("auto"); settings["ipv6"] = ipv6; - // Determine and apply security settings based on AP capabilities if (!password.isEmpty() && (apSupportsPsk || apSupportsSae || isHiddenNetwork)) { - // Password provided and AP supports PSK or SAE (or it's hidden, assume PSK) QVariantMap wifiSecurity; if (apSupportsSae && !apSupportsPsk) { - // WPA3-only network wifiLog("Using WPA3-SAE security"); wifiSecurity["key-mgmt"] = QString("sae"); wifiSecurity["psk"] = password; - // PMF (Protected Management Frames) is MANDATORY for WPA3-SAE - // 0 = default, 1 = disable, 2 = optional, 3 = required wifiSecurity["pmf"] = 3; } else if (apSupportsPsk) { - // Check if this is WPA2/WPA3 transition mode (supports both PSK and SAE) if (apSupportsSae) { - // Transition mode: prefer WPA3-SAE if available wifiLog("Using WPA3-SAE (transition mode - both PSK and SAE available)"); wifiSecurity["key-mgmt"] = QString("sae"); wifiSecurity["psk"] = password; @@ -500,7 +461,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) } else { - // Pure WPA/WPA2-PSK network (most common) wifiLog("Using WPA-PSK security"); wifiSecurity["key-mgmt"] = QString("wpa-psk"); wifiSecurity["psk"] = password; @@ -508,7 +468,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) } else if (isHiddenNetwork) { - // Hidden network with password - assume WPA-PSK wifiLog("Hidden network with password, assuming WPA-PSK"); wifiSecurity["key-mgmt"] = QString("wpa-psk"); wifiSecurity["psk"] = password; @@ -520,34 +479,28 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) } else if (apSupportsEnterprise) { - // Enterprise networks require more complex configuration wifiLog("WARNING: Enterprise (802.1X) networks are not supported by this simple connector"); return; } else if (apIsOpen || (!apHasPrivacy && !apSupportsPsk && !apSupportsSae)) { - // Open network - no security settings needed wifiLog("Connecting to open network (no security)"); settings["802-11-wireless"] = wifi; } else if (!password.isEmpty() && !apSupportsPsk && !apSupportsSae) { - // Password provided but AP doesn't support PSK/SAE - // This is the error case from the log! wifiLog("WARNING: Password provided but AP does not support PSK/SAE authentication!"); wifiLog("Attempting to connect as open network..."); settings["802-11-wireless"] = wifi; } else { - // Fallback - no password, assume open wifiLog("No password provided, treating as open network"); settings["802-11-wireless"] = wifi; } wifiLog("Calling AddAndActivateConnection..."); - // Use AddAndActivateConnection with proper DBus argument QDBusMessage msg = QDBusMessage::createMethodCall( "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", @@ -555,7 +508,6 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) "AddAndActivateConnection" ); - // Serialize settings properly for DBus QDBusArgument settingsArg; settingsArg.beginMap(QMetaType::fromType<QString>(), QMetaType::fromType<QVariantMap>()); for (auto it = settings.constBegin(); it != settings.constEnd(); ++it) @@ -580,12 +532,10 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) else { wifiLog("Connection initiated successfully"); - // Save credentials for later use (to be saved to installed system) m_lastConnectedSsid = ssid; m_lastConnectedPassword = password; wifiLog(QString("Stored credentials - SSID: '%1', Password length: %2").arg(m_lastConnectedSsid).arg(m_lastConnectedPassword.length())); - // Determine and save security type if (apSupportsSae && !apSupportsPsk) { m_lastSecurityType = "sae"; @@ -604,10 +554,7 @@ void NetworkManager::connectTo(const QString& ssid, const QString& password) } wifiLog(QString("Stored security type: '%1'").arg(m_lastSecurityType)); - // Note: WiFi persistence to installed system is disabled - // Connection only works during installation - // Check connection state multiple times (WPA3-SAE can be slow) m_connectionCheckCount = 0; startConnectionCheck(); } @@ -626,7 +573,6 @@ void NetworkManager::startConnectionCheck() return; } - // Retry up to 10 times (every 1 second = 10 seconds total) if (m_connectionCheckCount < 10) { QTimer::singleShot(1000, this, &NetworkManager::startConnectionCheck); diff --git a/raveos-calamares-module/wifi/NetworkManager.h b/raveos-calamares-module/wifi/NetworkManager.h index ff9dbf2..dd58a9a 100644 --- a/raveos-calamares-module/wifi/NetworkManager.h +++ b/raveos-calamares-module/wifi/NetworkManager.h @@ -16,7 +16,6 @@ public: QStringList networks() const; bool isConnected() const; - // Get the last connected network credentials (for saving to installed system) QString lastConnectedSsid() const { return m_lastConnectedSsid; } QString lastConnectedPassword() const { return m_lastConnectedPassword; } QString lastSecurityType() const { return m_lastSecurityType; } // "wpa-psk" or "sae" @@ -40,7 +39,6 @@ private: QStringList m_networks; bool m_connected = false; - // Store credentials for saving to installed system QString m_lastConnectedSsid; QString m_lastConnectedPassword; QString m_lastSecurityType; // "wpa-psk", "sae", or "" (open) diff --git a/raveos-calamares-module/wifi/WifiViewStep.cpp b/raveos-calamares-module/wifi/WifiViewStep.cpp index 5b55078..350bd43 100644 --- a/raveos-calamares-module/wifi/WifiViewStep.cpp +++ b/raveos-calamares-module/wifi/WifiViewStep.cpp @@ -121,23 +121,18 @@ bool WifiViewStep::isAtEnd() const Calamares::JobList WifiViewStep::jobs() const { - // WiFi persistence disabled - connection only works during installation - // The WiFi module only provides network connectivity for the installer return Calamares::JobList(); } void WifiViewStep::onActivate() { - // Force update locale from GlobalStorage QString newLocale = getLocale(); m_locale = newLocale; - // Update QML context property if (m_quickWidget) { m_quickWidget->rootContext()->setContextProperty("systemLocale", m_locale); - // Force QML to re-read the locale by calling a method on root object QQuickItem* root = m_quickWidget->rootObject(); if (root) { @@ -145,13 +140,10 @@ void WifiViewStep::onActivate() } } - // Start network check timer m_networkCheckTimer->start(2000); - // Check initial network state m_lastNetworkState = hasActiveNetwork(); - // Auto-skip ONLY on first activation AND if there's network if (m_firstActivation && m_lastNetworkState) { m_firstActivation = false; @@ -159,13 +151,10 @@ void WifiViewStep::onActivate() return; } - // Mark as no longer first activation m_firstActivation = false; - // Normal activation - show WiFi setup m_networkManager->scan(); - // Emit initial state emit nextStatusChanged(m_lastNetworkState); } @@ -225,9 +214,7 @@ QString WifiViewStep::getLocale() const if (gs) { - // Check all possible locale keys that Calamares might use - // Key 1: "locale" (direct string) if (gs->contains("locale")) { QString loc = gs->value("locale").toString(); @@ -235,7 +222,6 @@ QString WifiViewStep::getLocale() const return loc; } - // Key 2: "lang" (some modules use this) if (gs->contains("lang")) { QString loc = gs->value("lang").toString(); @@ -243,7 +229,6 @@ QString WifiViewStep::getLocale() const return loc; } - // Key 3: "language" if (gs->contains("language")) { QString loc = gs->value("language").toString(); @@ -251,7 +236,6 @@ QString WifiViewStep::getLocale() const return loc; } - // Key 4: "localeConf" map with LANG key if (gs->contains("localeConf")) { QVariantMap localeConf = gs->value("localeConf").toMap(); @@ -263,7 +247,6 @@ QString WifiViewStep::getLocale() const } } - // Key 5: Check for region-based locale if (gs->contains("locationRegion")) { QString region = gs->value("locationRegion").toString(); @@ -273,12 +256,9 @@ QString WifiViewStep::getLocale() const } } - // Key 6: "localeIndex" - welcome module sometimes stores index - // We'd need to map this to actual locale } } - // Fallback to system locale return QLocale::system().name(); } |