@@ -25,20 +25,20 @@ defmodule Systemd.UnitFile.Validator do
2525 @ known_directives % {
2626 "Unit" =>
2727 MapSet . new (
28- ~w( Description Documentation Requires Wants After Before BindsTo PartOf Conflicts ConditionPathExists AssertPathExists StartLimitIntervalSec StartLimitBurst)
28+ ~w( Description Documentation Requires Wants After Before BindsTo PartOf Conflicts RequiresMountsFor ConditionPathExists AssertPathExists StartLimitIntervalSec StartLimitBurst)
2929 ) ,
3030 "Service" =>
3131 MapSet . new (
32- ~w( Type ExecStart ExecStartPre ExecStartPost ExecReload ExecStop ExecStopPost Restart RestartSec User Group WorkingDirectory Environment EnvironmentFile TimeoutStartSec TimeoutStopSec KillSignal KillMode RemainAfterExit PIDFile RuntimeDirectory StateDirectory CacheDirectory LogsDirectory StandardOutput StandardError LimitNOFILE)
32+ ~w( Type ExecStart ExecStartPre ExecStartPost ExecCondition ExecReload ExecStop ExecStopPost Restart RestartSec User Group WorkingDirectory RootDirectory Environment EnvironmentFile PassEnvironment UnsetEnvironment TimeoutStartSec TimeoutStopSec TimeoutAbortSec KillSignal KillMode RemainAfterExit GuessMainPID PIDFile RuntimeDirectory RuntimeDirectoryPreserve StateDirectory CacheDirectory LogsDirectory ConfigurationDirectory StandardOutput StandardError SyslogIdentifier LimitNOFILE LimitNPROC LimitMEMLOCK LimitCORE LimitCPU LimitAS LimitFSIZE NoNewPrivileges PrivateTmp PrivateDevices ProtectSystem ProtectHome AmbientCapabilities CapabilityBoundingSet ReadWritePaths ReadOnlyPaths InaccessiblePaths OOMPolicy )
3333 ) ,
3434 "Install" => MapSet . new ( ~w( WantedBy RequiredBy Also Alias DefaultInstance) ) ,
3535 "Socket" =>
3636 MapSet . new (
37- ~w( ListenStream ListenDatagram ListenSequentialPacket SocketUser SocketGroup SocketMode Accept Service)
37+ ~w( ListenStream ListenDatagram ListenSequentialPacket ListenFIFO ListenSpecial ListenNetlink ListenMessageQueue ListenUSBFunction SocketUser SocketGroup SocketMode DirectoryMode Accept Writable MaxConnections MaxConnectionsPerSource KeepAlive NoDelay FreeBind BindIPv6Only Backlog Service)
3838 ) ,
3939 "Timer" =>
4040 MapSet . new (
41- ~w( OnActiveSec OnBootSec OnStartupSec OnUnitActiveSec OnUnitInactiveSec OnCalendar Unit Persistent AccuracySec RandomizedDelaySec)
41+ ~w( OnActiveSec OnBootSec OnStartupSec OnUnitActiveSec OnUnitInactiveSec OnCalendar Unit Persistent AccuracySec RandomizedDelaySec FixedRandomDelay WakeSystem RemainAfterElapse )
4242 ) ,
4343 "Target" => MapSet . new ( ~w( AllowIsolate) ) ,
4444 "Mount" =>
@@ -215,10 +215,25 @@ defmodule Systemd.UnitFile.Validator do
215215 end
216216
217217 defp value_errors ( "Service" , directive , value , span )
218- when directive in [ "TimeoutStartSec" , "TimeoutStopSec" , "RestartSec" ] do
218+ when directive in [ "TimeoutStartSec" , "TimeoutStopSec" , "TimeoutAbortSec" , " RestartSec"] do
219219 duration ( "Service" , directive , value , span )
220220 end
221221
222+ defp value_errors ( "Service" , directive , value , span )
223+ when directive in [
224+ "RemainAfterExit" ,
225+ "GuessMainPID" ,
226+ "NoNewPrivileges" ,
227+ "PrivateTmp" ,
228+ "PrivateDevices"
229+ ] do
230+ boolean ( "Service" , directive , value , span )
231+ end
232+
233+ defp value_errors ( "Service" , "KillMode" , value , span ) do
234+ one_of ( "Service" , "KillMode" , value , ~w( control-group mixed process none) , span )
235+ end
236+
222237 defp value_errors ( "Timer" , directive , value , span )
223238 when directive in [
224239 "OnActiveSec" ,
@@ -232,19 +247,37 @@ defmodule Systemd.UnitFile.Validator do
232247 duration ( "Timer" , directive , value , span )
233248 end
234249
235- defp value_errors ( "Timer" , "Persistent" , value , span ) ,
236- do: boolean ( "Timer" , "Persistent" , value , span )
250+ defp value_errors ( "Timer" , directive , value , span )
251+ when directive in [ "Persistent" , "FixedRandomDelay" , "WakeSystem" , "RemainAfterElapse" ] do
252+ boolean ( "Timer" , directive , value , span )
253+ end
237254
238255 defp value_errors ( "Timer" , "OnCalendar" , value , span ) ,
239256 do: non_empty ( "Timer" , "OnCalendar" , value , span )
240257
241258 defp value_errors ( "Socket" , directive , value , span )
242- when directive in [ "ListenStream" , "ListenDatagram" , "ListenSequentialPacket" ] do
259+ when directive in [
260+ "ListenStream" ,
261+ "ListenDatagram" ,
262+ "ListenSequentialPacket" ,
263+ "ListenFIFO" ,
264+ "ListenSpecial" ,
265+ "ListenNetlink" ,
266+ "ListenMessageQueue" ,
267+ "ListenUSBFunction"
268+ ] do
243269 non_empty ( "Socket" , directive , value , span )
244270 end
245271
246- defp value_errors ( "Socket" , "SocketMode" , value , span ) ,
247- do: octal_mode ( "Socket" , "SocketMode" , value , span )
272+ defp value_errors ( "Socket" , directive , value , span )
273+ when directive in [ "SocketMode" , "DirectoryMode" ] do
274+ octal_mode ( "Socket" , directive , value , span )
275+ end
276+
277+ defp value_errors ( "Socket" , directive , value , span )
278+ when directive in [ "Accept" , "Writable" , "KeepAlive" , "NoDelay" , "FreeBind" ] do
279+ boolean ( "Socket" , directive , value , span )
280+ end
248281
249282 defp value_errors ( "Install" , directive , value , span )
250283 when directive in [ "WantedBy" , "RequiredBy" , "Also" , "Alias" ] do
0 commit comments