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
David Oberhollenzer
a42022c650
Cleanup: remove unnecessary allocations
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-08 18:04:01 +02:00
David Oberhollenzer
6b788edfa4
Cleanup: rename/split splitkv.c
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-08 16:12:24 +02:00
David Oberhollenzer
7d8ceb810f
Cleanup: split rdsvc into multiple functions
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-08 14:05:39 +02:00
David Oberhollenzer
212d3022e7
Fix: sometimes, char is unsigned by default
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-05 20:25:36 +02:00
David Oberhollenzer
00daf470d1
Split rdline into multiple, easier to read functions
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 23:37:20 +02:00
David Oberhollenzer
65d2abc3f0
Add comments to library headers
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 18:54:59 +02:00
David Oberhollenzer
04a23330e4
Merge preprocessing of command lines
...
- Common function for splitting string into argument vector
- Preprocess & split command lines while parsing the service file
- Specify "before" and "after" dependencies in a single line
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 14:58:01 +02:00
David Oberhollenzer
56e6004336
Simplifiy service file syntax
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 14:08:12 +02:00
David Oberhollenzer
ca7b7c15c5
Merge argument substitution into rdline
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 11:55:59 +02:00
David Oberhollenzer
352a9060b6
Add statefull preprocessing to rdline
...
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-04-04 00:03:28 +02:00