mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 18:05:36 -04:00
Check for internet connection in prepare viewmodule.
This commit is contained in:
parent
b32bbf2b9a
commit
26419f2c8a
3 changed files with 26 additions and 2 deletions
|
@ -25,7 +25,9 @@ cmake_policy( SET CMP0043 OLD )
|
||||||
include( MacroOptionalFindPackage )
|
include( MacroOptionalFindPackage )
|
||||||
include( MacroLogFeature )
|
include( MacroLogFeature )
|
||||||
|
|
||||||
find_package( Qt5 5.3.0 CONFIG REQUIRED Core Gui Widgets LinguistTools )
|
set( QT_VERSION 5.3.0 )
|
||||||
|
|
||||||
|
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools )
|
||||||
find_package( YamlCpp 0.5.1 REQUIRED )
|
find_package( YamlCpp 0.5.1 REQUIRED )
|
||||||
|
|
||||||
option( WITH_PYTHON "Enable Python modules support." ON )
|
option( WITH_PYTHON "Enable Python modules support." ON )
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
||||||
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules )
|
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules )
|
||||||
find_package( LIBPARTED REQUIRED )
|
find_package( LIBPARTED REQUIRED )
|
||||||
|
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus )
|
||||||
|
|
||||||
set_source_files_properties( partman_devices.c PROPERTIES LANGUAGE CXX )
|
set_source_files_properties( partman_devices.c PROPERTIES LANGUAGE CXX )
|
||||||
|
|
||||||
|
@ -15,5 +16,6 @@ calamares_add_plugin( prepare
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
${LIBPARTED_LIBS}
|
${LIBPARTED_LIBS}
|
||||||
|
Qt5::DBus
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusInterface>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
|
@ -238,6 +240,24 @@ PrepareViewStep::checkHasPower()
|
||||||
bool
|
bool
|
||||||
PrepareViewStep::checkHasInternet()
|
PrepareViewStep::checkHasInternet()
|
||||||
{
|
{
|
||||||
return false;
|
const QString NM_INTF_NAME( "org.freedesktop.NetworkManager" );
|
||||||
|
const int NM_STATE_CONNECTED_GLOBAL = 70;
|
||||||
|
|
||||||
|
QDBusInterface nmIntf( "org.freedesktop.NetworkManager",
|
||||||
|
"/org/freedesktop/NetworkManager",
|
||||||
|
NM_INTF_NAME,
|
||||||
|
QDBusConnection::systemBus(), 0 );
|
||||||
|
bool ok = false;
|
||||||
|
int nmState = nmIntf.property( "state" ).toInt( &ok );
|
||||||
|
|
||||||
|
if ( !ok || !nmIntf.isValid() )
|
||||||
|
{
|
||||||
|
// We can't talk to NM, so no idea. Wild guess: we're connected
|
||||||
|
// using ssh with X forwarding, and are therefore connected. This
|
||||||
|
// allows us to proceed with a minimum of complaint.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nmState == NM_STATE_CONNECTED_GLOBAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue