|
|
@ -25,11 +25,17 @@
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WITH_KF5DBus
|
|
|
|
|
|
|
|
#warning "KDSingleApplicationGuard is deprecated"
|
|
|
|
#include "3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h"
|
|
|
|
#include "3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h"
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include <KF5/KCoreAddons/KAboutData>
|
|
|
|
#include <KCoreAddons/KAboutData>
|
|
|
|
|
|
|
|
#ifdef WITH_KF5DBus
|
|
|
|
|
|
|
|
#include <KDBusAddons/KDBusService>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_KF5Crash
|
|
|
|
#ifdef WITH_KF5Crash
|
|
|
|
#include <KF5/KCrash/KCrash>
|
|
|
|
#include <KCrash/KCrash>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QCommandLineParser>
|
|
|
@ -63,7 +69,13 @@ debug_level( QCommandLineParser& parser, QCommandLineOption& levelOption )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
/** @brief Handles the command-line arguments
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Sets up internals for Calamares based on command-line arguments like `-D`,
|
|
|
|
|
|
|
|
* `-d`, etc. Returns @c true if this is a *debug* run, i.e. if the `-d`
|
|
|
|
|
|
|
|
* command-line flag is given, @c false otherwise.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static bool
|
|
|
|
handle_args( CalamaresApplication& a )
|
|
|
|
handle_args( CalamaresApplication& a )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QCommandLineOption debugOption( QStringList { "d", "debug" },
|
|
|
|
QCommandLineOption debugOption( QStringList { "d", "debug" },
|
|
|
@ -100,8 +112,8 @@ handle_args( CalamaresApplication& a )
|
|
|
|
CalamaresUtils::setXdgDirs();
|
|
|
|
CalamaresUtils::setXdgDirs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CalamaresUtils::setAllowLocalTranslation( parser.isSet( debugOption ) || parser.isSet( debugTxOption ) );
|
|
|
|
CalamaresUtils::setAllowLocalTranslation( parser.isSet( debugOption ) || parser.isSet( debugTxOption ) );
|
|
|
|
Calamares::Settings::init( parser.isSet( debugOption ) );
|
|
|
|
|
|
|
|
a.init();
|
|
|
|
return parser.isSet( debugOption );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
int
|
|
|
@ -129,13 +141,14 @@ main( int argc, char* argv[] )
|
|
|
|
// TODO: umount anything in /tmp/calamares-... as an emergency save function
|
|
|
|
// TODO: umount anything in /tmp/calamares-... as an emergency save function
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
KDSingleApplicationGuard guard( KDSingleApplicationGuard::AutoKillOtherInstances );
|
|
|
|
bool is_debug = handle_args( a );
|
|
|
|
if ( guard.isPrimaryInstance() )
|
|
|
|
|
|
|
|
{
|
|
|
|
#ifdef WITH_KF5DBus
|
|
|
|
handle_args( a );
|
|
|
|
KDBusService service( is_debug ? KDBusService::Multiple : KDBusService::Unique );
|
|
|
|
return a.exec();
|
|
|
|
#else
|
|
|
|
}
|
|
|
|
KDSingleApplicationGuard guard( is_debug ? KDSingleApplicationGuard::NoPolicy
|
|
|
|
else
|
|
|
|
: KDSingleApplicationGuard::AutoKillOtherInstances );
|
|
|
|
|
|
|
|
if ( !is_debug && !guard.isPrimaryInstance() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Here we have not yet set-up the logger system, so qDebug() is ok
|
|
|
|
// Here we have not yet set-up the logger system, so qDebug() is ok
|
|
|
|
auto instancelist = guard.instances();
|
|
|
|
auto instancelist = guard.instances();
|
|
|
@ -150,4 +163,9 @@ main( int argc, char* argv[] )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 69; // EX_UNAVAILABLE on FreeBSD
|
|
|
|
return 69; // EX_UNAVAILABLE on FreeBSD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calamares::Settings::init( is_debug );
|
|
|
|
|
|
|
|
a.init();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|