Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
prelogin.cpp File Reference

Definitions for setting up and checking reachability before login. More...

#include <algorithm>
#include <array>
#include <cctype>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <iterator>
#include <optional>
#include <sstream>
#include <vector>
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
#include <unistd.h>
#include "prelogin.h"
#include "src/config.h"
#include "src/logging.h"
#include "src/utility.h"
#include "virtual_display.h"
Include dependency graph for prelogin.cpp:

Go to the source code of this file.

Functions

std::string platf::prelogin::state_name (state_e state)
bool platf::prelogin::is_generated_unit (std::string_view unit)
 Whether unit was written by from_boot_unit().
bool platf::prelogin::unit_waits_for_session (std::string_view unit)
 Whether unit depends on a target that only exists once somebody has logged in, whoever wrote it.
std::string platf::prelogin::from_boot_unit (std::string_view packaged_unit, std::string_view source_path)
 Turn the packaged unit into one that starts with the user manager.
sddm_settings_t platf::prelogin::sddm_settings (const std::vector< std::string > &files)
 Read SDDM's settings from its configuration files.
report_t platf::prelogin::assess (const facts_t &facts)
 Decide every check from facts.
facts_t platf::prelogin::collect_facts ()
 Look at this machine.
report_t platf::prelogin::report ()
 assess(collect_facts()).
void platf::prelogin::log_report ()
 Say at startup what stands between this host and being reachable before login. Silent unless Hermes is set to start at boot.
int platf::prelogin::command (const char *name, int argc, char *argv[])
 hermes --prelogin status|enable|disable.

Detailed Description

Definitions for setting up and checking reachability before login.

Definition in file prelogin.cpp.

Function Documentation

◆ assess()

report_t platf::prelogin::assess ( const facts_t & facts)

Decide every check from facts.

Definition at line 492 of file prelogin.cpp.

◆ collect_facts()

facts_t platf::prelogin::collect_facts ( )

Look at this machine.

Definition at line 565 of file prelogin.cpp.

◆ command()

int platf::prelogin::command ( const char * name,
int argc,
char * argv[] )

hermes --prelogin status|enable|disable.

Runs before logging starts and prints to the terminal: starting the log rotates the log file, and this is a command to run while Hermes is up.

Returns
0 on success - for status, when everything is in place - 1 when something is missing or failed, 2 for a usage error.

Definition at line 632 of file prelogin.cpp.

◆ from_boot_unit()

std::string platf::prelogin::from_boot_unit ( std::string_view packaged_unit,
std::string_view source_path )

Turn the packaged unit into one that starts with the user manager.

The packaged unit starts with the graphical session and stops with it. Its Wants=graphical-session.target cannot simply be kept: pulled in at boot, that target would be active with no session behind it. So every reference to the graphical session goes, and the unit is installed under default.target. The service section is kept as packaged, whatever the packaging made of its start command; a restart policy is added if it had none, since Hermes leaves with the compositor at logout and has to come back for the login screen.

Parameters
packaged_unitThe unit file's text.
source_pathWhere it was read from, for the header.

Definition at line 395 of file prelogin.cpp.

◆ is_generated_unit()

bool platf::prelogin::is_generated_unit ( std::string_view unit)

Whether unit was written by from_boot_unit().

Definition at line 366 of file prelogin.cpp.

◆ log_report()

void platf::prelogin::log_report ( )

Say at startup what stands between this host and being reachable before login. Silent unless Hermes is set to start at boot.

Definition at line 613 of file prelogin.cpp.

◆ report()

report_t platf::prelogin::report ( )

assess(collect_facts()).

Definition at line 609 of file prelogin.cpp.

◆ sddm_settings()

sddm_settings_t platf::prelogin::sddm_settings ( const std::vector< std::string > & files)

Read SDDM's settings from its configuration files.

Parameters
filesTheir contents in the order SDDM applies them: the vendor directory, /etc/sddm.conf.d, then /etc/sddm.conf, which has the last word.

Definition at line 463 of file prelogin.cpp.

◆ state_name()

std::string platf::prelogin::state_name ( state_e state)

Definition at line 352 of file prelogin.cpp.

◆ unit_waits_for_session()

bool platf::prelogin::unit_waits_for_session ( std::string_view unit)

Whether unit depends on a target that only exists once somebody has logged in, whoever wrote it.

Definition at line 375 of file prelogin.cpp.