87a524d931
cleanup: delete remains of libutil
...
- exec_t belongs to service.h, the main place where it is used/needed
- code for executing exec_t is moved to runsvc for the same reason
- what is left are NORETURN and ARRAY_SIZE
- the former can be replaced with direct attribute usage since
the only relevant compilers all support the attribute.
- the later is only used in 3 places and can be trivially replaced
with direct usage of sizeof().
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-03-31 18:19:27 +02:00
0d985a7430
Add RDSVC_NO_DESC flag
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-06-16 20:51:23 +02:00
60efd9dc33
Remove unused SOCK_FLAG_* enum
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-06-16 18:20:26 +02:00
c8c0f10ce1
Keep original respawn limit
...
We also want this meachanism to still work for manually started
service (especially after reloading services).
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
be06641904
cleanup: init socket wire format
...
Replace array adhockery with structs and make use of the handy
endianness conversion macros.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
c3d14cbfa8
cleanup: init status response
...
- rename init_status_response_t to init_status_t
- merge code for handling it
- fix memory leak in status command
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
7cfe6e8458
cleanup: move init specific stuff of init socket to initd
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:00:53 +01:00
ba12700080
Add start/stop commands to init socket
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28 15:32:10 +01:00
9e7478397a
Include service ID in initsock status response
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28 15:19:06 +01:00
c16735414b
initd: Hand out unique IDs to services
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-28 13:45:33 +01:00
d16d260181
Add filter argument to status request
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-27 17:48:32 +01:00
affe9e4b88
Use fixed size integer for init socket request
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-27 17:48:32 +01:00
a6c059203b
Fix warnings from gcc 8.3 + musl build
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20 20:43:41 +01:00
e21840cfce
initd: don't start runsvc for services without exec block
...
First in rdsvc, tag the services that *do* have exec lines, even if we don't
read them.
Second, if a service does not have that flag set, don't try to execute it.
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-20 15:44:14 +01:00
a9602ad6e0
Cleanup status reporting
...
- mimic format of initd
- skip formatting if not a tty
- distinguish exited because failed vs exited because done
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 18:47:20 +01:00
23b713c3b5
Add functions to transmit service status accross initd socket
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 18:29:02 +01:00
c78bbd2f73
Add helpers for initd socket
...
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-18 14:15:58 +01:00
David Oberhollenzer
d9a5736bdf
Remove some no longer needed cruft
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-23 23:00:58 +01:00
David Oberhollenzer
c14c3c0173
Relicense what is left of the init system under OpenBSD style ISC license
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-23 13:16:08 +01:00
David Oberhollenzer
dc6358b0e1
rdline: always do substitution of '%%'
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-13 19:11:33 +01:00
David Oberhollenzer
4bcfd98764
Cleanup header dependencies
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-05 20:18:48 +01:00
David Oberhollenzer
5923ad488a
Move cron library code to crond
...
Nothing else uses it.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 15:37:15 +01:00
David Oberhollenzer
b864c727c8
Remove unused telinit code
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 15:33:00 +01:00
David Oberhollenzer
c0e8c7e245
cleanup: let rdline_init open the file
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 15:02:11 +01:00
David Oberhollenzer
074fe20a47
Add fopenat utility function
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 14:45:46 +01:00
David Oberhollenzer
34f542b7cc
Seperate init specific code from utility code
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 14:30:16 +01:00
David Oberhollenzer
1ffc240b3f
cleanup normalize_line state machine
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-04 14:20:23 +01:00
David Oberhollenzer
b3773d09ea
Only parse arguments if index actually is numeric
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-03 19:26:00 +01:00
David Oberhollenzer
24e98f1e5b
Fix parameter substitution escape of '%'
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-20 17:41:22 +02:00
David Oberhollenzer
53bc182e09
Fix argv_exec allocation size of argument vector
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-16 23:06:58 +02:00
David Oberhollenzer
24c90b7700
Configuration parser cleanup
...
- Do a getline() & process in rdline instead of doing a read per character
and feeding it through a state machine.
- Move splitkv to rdcfg.c, the only place where it is used
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-10-10 16:45:11 +02:00
David Oberhollenzer
e171f88865
Remove pid fron cron serives, reap children in signal handler
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-21 18:08:48 +02:00
David Oberhollenzer
f38163772c
Add simple cron implementation
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-19 12:22:14 +02:00
David Oberhollenzer
5cd5f48f76
Add helper library for cron configuration
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-17 14:53:19 +02:00
David Oberhollenzer
481744a2ba
Move splitkv function to libcfg
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-16 01:12:06 +02:00
David Oberhollenzer
42fba964c9
Centralize/unify version string printing
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-01 17:22:24 +02:00
David Oberhollenzer
25afc0b3d0
Remove ctrl+alt+del target, simply initiate reboot target
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-08-24 21:17:31 +02:00
David Oberhollenzer
056d3c8e64
Add output truncation flag
...
This commit adds a "truncate" flag that can be added to a service
description between the "tty" keyword and the path string.
If the flag is set, the output file is truncated to 0 after opening.
This probably requires some remodeling in the future as the tty keyword
no longer deals with just tty devices.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-07-22 17:57:20 +02:00
David Oberhollenzer
ed23d075ca
Make mksock() more generic, move to util library
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
bf63f78b66
Split configuration parser and utility library
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-06-09 15:32:29 +02:00
David Oberhollenzer
720220a3c3
Add flags to selectively skip fields in service files
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22 13:41:18 +02:00
David Oberhollenzer
160cd6b6aa
Store original file name in service structure
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-22 13:41:18 +02:00
David Oberhollenzer
38ad6f1b2f
Allow aggregating command lines in blocks
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 23:01:35 +02:00
David Oberhollenzer
20e08db1a5
Minor cleanup
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 20:12:15 +02:00
David Oberhollenzer
6642b2b2bf
Don't pre-allocate argument vector for command lines
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 19:45:26 +02:00
David Oberhollenzer
71d98c150f
Don't split dependencies into argument vector, keep list of strings
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 16:08:25 +02:00
David Oberhollenzer
4ee0ea9754
Split bulk of split_argv out into helper function
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 15:57:01 +02:00
David Oberhollenzer
dca72a4c77
Do not allow embedding null-bytes into a string
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 15:05:59 +02:00
David Oberhollenzer
67d000cdc3
Cleanup: redeuce number of allocations in rdsvc
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 15:05:16 +02:00
David Oberhollenzer
77725291ef
Make line buffer static, move error reporting to rdline
...
- Expose rdline_t struct and move a lot of extra processing
to rdline code
- Make line buffer statically allocated
- Simplify rdsvc code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-11 14:25:15 +02:00