Stricter rules for skipping autoload

pull/232/head
sezanzeb 3 years ago
parent 716b4bb921
commit ed2d084a22

@ -205,7 +205,12 @@ def main(options):
logger.debug('Call for "%s"', sys.argv)
if options.command == AUTOLOAD and num_logged_in_users() == 0:
from keymapper.paths import USER
during_boot = num_logged_in_users() == 0 # for the lack of a better method
is_root = USER == "root"
is_autoload = options.command == AUTOLOAD
config_dir_set = options.config_dir is not None
if is_autoload and during_boot and is_root and not config_dir_set:
# No user logged in, this is probably happening during boot time and got
# triggered by udev. There is no need to try to inject anything if the
# service doesn't know where to look for a config file. This avoids a lot

Loading…
Cancel
Save