diff options
Diffstat (limited to 'urunlevel/runlevel/boot_time.c')
-rw-r--r-- | urunlevel/runlevel/boot_time.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/urunlevel/runlevel/boot_time.c b/urunlevel/runlevel/boot_time.c index aa1fde7..88227ac 100644 --- a/urunlevel/runlevel/boot_time.c +++ b/urunlevel/runlevel/boot_time.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au | 4 | * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au |
5 | * | 5 | * |
6 | * Clean room implementation of LSB init.d specs. | ||
7 | * I didn't steal any of this, honest B-). | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -31,35 +34,34 @@ static int status(struct init_d_handle_s *, int); | |||
31 | static int stop(struct init_d_handle_s *, int); | 34 | static int stop(struct init_d_handle_s *, int); |
32 | 35 | ||
33 | 36 | ||
34 | static init_d_handle_t my_commands = | 37 | static init_d_handle_t my_commands = { |
35 | { | 38 | &start, |
36 | &start, | 39 | &stop, |
37 | &stop, | 40 | NULL, |
38 | NULL, | 41 | NULL, |
39 | NULL, | 42 | &no_reload, |
40 | &no_reload, | 43 | NULL, |
41 | NULL, | 44 | &status, |
42 | &status, | 45 | NULL, |
43 | NULL, | 46 | "time", |
44 | "boot_time", | 47 | NULL, |
45 | NULL, | 48 | NULL, |
46 | NULL, | 49 | NULL, |
47 | NULL, | 50 | INIT_D_BEGIN |
48 | INIT_D_BEGIN \ | 51 | INIT_D_PROV "$time" |
49 | INIT_D_PROV "$time" \ | 52 | INIT_D_DSTART "1 2 3 4 5" |
50 | INIT_D_DSTART "1 2 3 4 5" \ | 53 | INIT_D_DSTOP "0 6" |
51 | INIT_D_DSTOP "0 6" \ | 54 | INIT_D_SDESC "Set the system time." |
52 | INIT_D_SDESC "Set the system time." \ | 55 | INIT_D_DESC "Set the system time, maybe from the hardware clock," |
53 | INIT_D_DESC "Set the system time, maybe from the hardware clock," \ | 56 | INIT_D_CONT "maybe from the network via NTP or DATE." INIT_D_END |
54 | INIT_D_CONT "maybe from the network via NTP or DATE." \ | ||
55 | INIT_D_END | ||
56 | }; | 57 | }; |
58 | |||
57 | // INIT_D_SSTART "$network" \ | 59 | // INIT_D_SSTART "$network" \ |
58 | 60 | ||
59 | 61 | ||
60 | int boot_time_main(int argc, char **argv) | 62 | int boot_time_main(int argc, char **argv) |
61 | { | 63 | { |
62 | return do_init_from_main(argc, argv, &my_commands); | 64 | return do_init_from_main(argc, argv, &my_commands); |
63 | } | 65 | } |
64 | 66 | ||
65 | 67 | ||
@@ -67,22 +69,22 @@ static int start(struct init_d_handle_s *init_d, int just_checking) | |||
67 | { | 69 | { |
68 | // Should check if we need to NTP or whatever | 70 | // Should check if we need to NTP or whatever |
69 | // Should check for -l/-u | 71 | // Should check for -l/-u |
70 | doit(0, "/sbin/hwclock -su"); | 72 | doit(0, "/sbin/hwclock -su"); |
71 | // Should check errno and convert into INIT_D_ERROR_? | 73 | // Should check errno and convert into INIT_D_ERROR_? |
72 | return INIT_D_OK; | 74 | return INIT_D_OK; |
73 | } | 75 | } |
74 | 76 | ||
75 | 77 | ||
76 | static int status(struct init_d_handle_s *init_d, int quiet) | 78 | static int status(struct init_d_handle_s *init_d, int quiet) |
77 | { | 79 | { |
78 | return print_status(init_d, quiet, INIT_D_STATUS_OK); | 80 | return print_status(init_d, quiet, INIT_D_STATUS_OK); |
79 | } | 81 | } |
80 | 82 | ||
81 | 83 | ||
82 | static int stop(struct init_d_handle_s *init_d, int just_checking) | 84 | static int stop(struct init_d_handle_s *init_d, int just_checking) |
83 | { | 85 | { |
84 | // Should check for -l/-u | 86 | // Should check for -l/-u |
85 | doit(0, "/sbin/hwclock -wu"); | 87 | doit(0, "/sbin/hwclock -wu"); |
86 | // Should check errno and convert into INIT_D_ERROR_? | 88 | // Should check errno and convert into INIT_D_ERROR_? |
87 | return INIT_D_OK; | 89 | return INIT_D_OK; |
88 | } | 90 | } |