File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -145,12 +145,26 @@ set(LOG_FILE "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/sddm.lo
145145set (DBUS_CONFIG_FILENAME "org.freedesktop.DisplayManager.conf" CACHE STRING "Name of the sddm config file" )
146146set (COMPONENTS_TRANSLATION_DIR "${DATA_INSTALL_DIR} /translations" CACHE PATH "Components translations directory" )
147147
148+
149+ # Autodetect UID_MIN and UID_MAX from /etc/login.defs
150+ if (NOT DEFINED LOGIN_DEFS_PATH)
151+ set (LOGIN_DEFS_PATH "/etc/login.defs" CACHE PATH "Path to login.defs" )
152+ endif ()
153+
154+ if (NOT EXISTS "${LOGIN_DEFS_PATH} " AND NOT DEFINED UID_MIN AND NOT DEFINED UID_MAX)
155+ message (FATAL_ERROR "Could not find login.defs at ${LOGIN_DEFS_PATH} . Try -DLOGIN_DEFS_PATH." )
156+ endif ()
157+
148158if (NOT DEFINED UID_MIN)
149- set (UID_MIN 1000 CACHE STRING "UID_MIN from login.defs (MinimumUid)" )
159+ file (STRINGS "${LOGIN_DEFS_PATH} " UID_MIN LIMIT_COUNT 1 REGEX "^UID_MIN" )
160+ STRING (REGEX REPLACE "^UID_MIN[\t ]+([0-9]+)" "\\ 1" UID_MIN "${UID_MIN} " )
161+ message (STATUS "Autodetected UID_MIN=${UID_MIN} from ${LOGIN_DEFS_PATH} " )
150162endif ()
151163
152164if (NOT DEFINED UID_MAX)
153- set (UID_MAX 65000 CACHE STRING "UID_MAX from login.defs (MaximumUid)" )
165+ file (STRINGS "${LOGIN_DEFS_PATH} " UID_MAX LIMIT_COUNT 1 REGEX "^UID_MAX" )
166+ STRING (REGEX REPLACE "^UID_MAX[\t ]+([0-9]+)" "\\ 1" UID_MAX "${UID_MAX} " )
167+ message (STATUS "Autodetected UID_MAX=${UID_MAX} from ${LOGIN_DEFS_PATH} " )
154168endif ()
155169
156170# Add subdirectories
Original file line number Diff line number Diff line change 66
77## 0.12.0 - XXXX-XX-XX
88----------------------
9+ * Autodetect UID_MIN and UID_MAX from /etc/login.defs
910 * Add Arabic translation by Safa Alfulaij.
1011 * Russian translation improvements by Alexander Potashev.
1112
You can’t perform that action at this time.
0 commit comments