diff options
author | Jonathan Steel <jsteel@archlinux.org> | 2017-06-13 14:15:42 +0100 |
---|---|---|
committer | Jonathan Steel <jsteel@archlinux.org> | 2017-06-13 14:15:42 +0100 |
commit | 746bfc7e2fd0c246b880b529d02af264a1744e1d (patch) | |
tree | 18e33deefa169caaf413c53cd003031b21471c26 | |
parent | 679640f802129af0a8e9a4b6f9f31ccfd86fa2f9 (diff) | |
download | AUR-746bfc7e2fd0c246b880b529d02af264a1744e1d.tar.gz AUR-746bfc7e2fd0c246b880b529d02af264a1744e1d.tar.zst AUR-746bfc7e2fd0c246b880b529d02af264a1744e1d.zip |
gcc7 fix and run with --daemon
journalctl was very noisy without --daemon
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 16 | ||||
-rw-r--r-- | gcc7.patch | 211 | ||||
-rw-r--r-- | naemon.service | 6 |
4 files changed, 232 insertions, 9 deletions
@@ -1,9 +1,9 @@ | |||
1 | # Generated by mksrcinfo v8 | 1 | # Generated by mksrcinfo v8 |
2 | # Tue May 16 07:43:28 UTC 2017 | 2 | # Tue Jun 13 13:14:33 UTC 2017 |
3 | pkgbase = naemon | 3 | pkgbase = naemon |
4 | pkgdesc = System and network monitoring application | 4 | pkgdesc = System and network monitoring application |
5 | pkgver = 1.0.6 | 5 | pkgver = 1.0.6 |
6 | pkgrel = 3 | 6 | pkgrel = 4 |
7 | url = http://naemon.org | 7 | url = http://naemon.org |
8 | install = naemon.install | 8 | install = naemon.install |
9 | arch = i686 | 9 | arch = i686 |
@@ -26,9 +26,11 @@ pkgbase = naemon | |||
26 | backup = etc/naemon/naemon.cfg | 26 | backup = etc/naemon/naemon.cfg |
27 | backup = etc/naemon/resource.cfg | 27 | backup = etc/naemon/resource.cfg |
28 | source = http://labs.consol.de/naemon/release/v1.0.6/src/naemon-1.0.6.tar.gz | 28 | source = http://labs.consol.de/naemon/release/v1.0.6/src/naemon-1.0.6.tar.gz |
29 | source = gcc7.patch | ||
29 | source = naemon.service | 30 | source = naemon.service |
30 | md5sums = 6c9b95a737a8f232e114f4cff200ff92 | 31 | md5sums = 6c9b95a737a8f232e114f4cff200ff92 |
31 | md5sums = d6a77534e612e8f65ff3360336faec77 | 32 | md5sums = 4a6d8f9b39335dfe3348a1a20df10dfd |
33 | md5sums = 29f1d11c1a7f4f1515b7993c540dabe8 | ||
32 | 34 | ||
33 | pkgname = naemon | 35 | pkgname = naemon |
34 | 36 | ||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | pkgname=naemon | 3 | pkgname=naemon |
4 | pkgver=1.0.6 | 4 | pkgver=1.0.6 |
5 | pkgrel=3 | 5 | pkgrel=4 |
6 | pkgdesc="System and network monitoring application" | 6 | pkgdesc="System and network monitoring application" |
7 | arch=('i686' 'x86_64') | 7 | arch=('i686' 'x86_64') |
8 | url="http://naemon.org" | 8 | url="http://naemon.org" |
@@ -16,14 +16,22 @@ provides=('naemon-core' 'naemon-livestatus') | |||
16 | conflicts=('naemon-core' 'naemon-livestatus') | 16 | conflicts=('naemon-core' 'naemon-livestatus') |
17 | replaces=('naemon-core' 'naemon-livestatus') | 17 | replaces=('naemon-core' 'naemon-livestatus') |
18 | source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgname-$pkgver.tar.gz | 18 | source=(http://labs.consol.de/naemon/release/v$pkgver/src/$pkgname-$pkgver.tar.gz |
19 | gcc7.patch | ||
19 | $pkgname.service) | 20 | $pkgname.service) |
20 | md5sums=('6c9b95a737a8f232e114f4cff200ff92' | 21 | md5sums=('6c9b95a737a8f232e114f4cff200ff92' |
21 | 'd6a77534e612e8f65ff3360336faec77') | 22 | '4a6d8f9b39335dfe3348a1a20df10dfd' |
23 | '29f1d11c1a7f4f1515b7993c540dabe8') | ||
22 | backup=('etc/logrotate.d/naemon' | 24 | backup=('etc/logrotate.d/naemon' |
23 | 'etc/naemon/naemon.cfg' | 25 | 'etc/naemon/naemon.cfg' |
24 | 'etc/naemon/resource.cfg') | 26 | 'etc/naemon/resource.cfg') |
25 | install=$pkgname.install | 27 | install=$pkgname.install |
26 | 28 | ||
29 | prepare() { | ||
30 | cd $pkgname-$pkgver/naemon-core | ||
31 | |||
32 | patch -Np1 -i "$srcdir"/gcc7.patch | ||
33 | } | ||
34 | |||
27 | build() { | 35 | build() { |
28 | cd $pkgname-$pkgver | 36 | cd $pkgname-$pkgver |
29 | 37 | ||
@@ -44,7 +52,7 @@ build() { | |||
44 | --with-logrotatedir="/etc/logrotate.d" \ | 52 | --with-logrotatedir="/etc/logrotate.d" \ |
45 | --with-naemon-user="naemon" \ | 53 | --with-naemon-user="naemon" \ |
46 | --with-naemon-group="naemon" \ | 54 | --with-naemon-group="naemon" \ |
47 | --with-lockfile="/run/naemon.pid" \ | 55 | --with-lockfile="/run/naemon/naemon.pid" \ |
48 | --with-thruk-user="http" \ | 56 | --with-thruk-user="http" \ |
49 | --with-thruk-group="naemon" \ | 57 | --with-thruk-group="naemon" \ |
50 | --with-thruk-libs="/usr/lib/naemon/perl5" \ | 58 | --with-thruk-libs="/usr/lib/naemon/perl5" \ |
@@ -76,6 +84,8 @@ package() { | |||
76 | 84 | ||
77 | install -Dm644 "$srcdir"/$pkgname.service \ | 85 | install -Dm644 "$srcdir"/$pkgname.service \ |
78 | "$pkgdir"/usr/lib/systemd/system/$pkgname.service | 86 | "$pkgdir"/usr/lib/systemd/system/$pkgname.service |
87 | install -Dm644 naemon-core/naemon.tmpfiles.conf \ | ||
88 | "$pkgdir"/usr/lib/tmpfiles.d/naemon.conf | ||
79 | 89 | ||
80 | # Move sample config files | 90 | # Move sample config files |
81 | mv "$pkgdir"/etc/naemon/conf.d "$pkgdir"/etc/naemon/examples | 91 | mv "$pkgdir"/etc/naemon/conf.d "$pkgdir"/etc/naemon/examples |
diff --git a/gcc7.patch b/gcc7.patch new file mode 100644 index 0000000..113140e --- /dev/null +++ b/gcc7.patch | |||
@@ -0,0 +1,211 @@ | |||
1 | From 0390d827eab62ad2d84f0d6db8278d683659c0ba Mon Sep 17 00:00:00 2001 | ||
2 | From: Oleg Pereverzev <oleg.pereverzev@gmail.com> | ||
3 | Date: Mon, 12 Jun 2017 23:20:59 +0300 | ||
4 | Subject: [PATCH] Support for GCC 7 | ||
5 | |||
6 | --- | ||
7 | lib/runcmd.c | 3 +++ | ||
8 | lib/snprintf.c | 6 ++++++ | ||
9 | src/naemon/checks.c | 12 +++++++++++- | ||
10 | src/naemon/configuration.c | 13 +++++++++++-- | ||
11 | src/naemon/macros.c | 18 ++++++++++++++++++ | ||
12 | src/naemon/xodtemplate.c | 11 ++++++++++- | ||
13 | 6 files changed, 59 insertions(+), 4 deletions(-) | ||
14 | |||
15 | diff --git a/lib/runcmd.c b/lib/runcmd.c | ||
16 | index eb6668fe..4e55fbd7 100644 | ||
17 | --- a/lib/runcmd.c | ||
18 | +++ b/lib/runcmd.c | ||
19 | @@ -199,6 +199,9 @@ int runcmd_cmd2strv(const char *str, int *out_argc, char **out_argv) | ||
20 | set_state(STATE_INSQ | STATE_INARG); | ||
21 | continue; | ||
22 | } | ||
23 | +#if __GNUC__ >= 7 | ||
24 | + __attribute__((fallthrough)); | ||
25 | +#endif | ||
26 | case '"': | ||
27 | if (have_state(STATE_INSQ)) | ||
28 | break; | ||
29 | diff --git a/lib/snprintf.c b/lib/snprintf.c | ||
30 | index 49bf8962..80b69dbf 100644 | ||
31 | --- a/lib/snprintf.c | ||
32 | +++ b/lib/snprintf.c | ||
33 | @@ -493,6 +493,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | ||
34 | break; | ||
35 | case 'X': | ||
36 | cnk->flags |= DP_F_UP; | ||
37 | +#if __GNUC__ >= 7 | ||
38 | + __attribute__((fallthrough)); | ||
39 | +#endif | ||
40 | case 'x': | ||
41 | cnk->type = CNK_HEX; | ||
42 | cnk->flags |= DP_F_UNSIGNED; | ||
43 | @@ -503,6 +506,9 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args | ||
44 | case 'G': | ||
45 | case 'F': | ||
46 | cnk->flags |= DP_F_UP; | ||
47 | +#if __GNUC__ >= 7 | ||
48 | + __attribute__((fallthrough)); | ||
49 | +#endif | ||
50 | case 'a': | ||
51 | /* hex float not supported yet */ | ||
52 | case 'e': | ||
53 | diff --git a/src/naemon/checks.c b/src/naemon/checks.c | ||
54 | index 97bd9f73..91d83ef1 100644 | ||
55 | --- a/src/naemon/checks.c | ||
56 | +++ b/src/naemon/checks.c | ||
57 | @@ -207,6 +207,9 @@ int process_check_result_queue(char *dirname) | ||
58 | char *temp_buffer = NULL; | ||
59 | int result = OK, check_result_files = 0; | ||
60 | time_t start; | ||
61 | +#if __GNUC__ >= 7 | ||
62 | + unsigned int writesize; | ||
63 | +#endif | ||
64 | |||
65 | /* make sure we have what we need */ | ||
66 | if (dirname == NULL) { | ||
67 | @@ -240,9 +243,16 @@ int process_check_result_queue(char *dirname) | ||
68 | } | ||
69 | |||
70 | /* create /path/to/file */ | ||
71 | + | ||
72 | +#if __GNUC__ >= 7 | ||
73 | + writesize = snprintf(file, sizeof(file), "%s/%s", dirname, dirfile->d_name); | ||
74 | + if (writesize < (strlen(dirname) + strlen(dirfile->d_name) + 2)) | ||
75 | + nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to file in check result queue directory '%s'", dirfile->d_name); | ||
76 | +#else | ||
77 | snprintf(file, sizeof(file), "%s/%s", dirname, dirfile->d_name); | ||
78 | +#endif | ||
79 | file[sizeof(file) - 1] = '\x0'; | ||
80 | - | ||
81 | + | ||
82 | /* process this if it's a check result file... */ | ||
83 | x = strlen(dirfile->d_name); | ||
84 | if (x == 7 && dirfile->d_name[0] == 'c') { | ||
85 | diff --git a/src/naemon/configuration.c b/src/naemon/configuration.c | ||
86 | index a2a8d3ed..c4dc97dd 100644 | ||
87 | --- a/src/naemon/configuration.c | ||
88 | +++ b/src/naemon/configuration.c | ||
89 | @@ -59,6 +59,9 @@ read_config_file(const char *main_config_file, nagios_macros *mac) | ||
90 | char *argptr = NULL; | ||
91 | mmapfile *thefile = NULL; | ||
92 | DIR *tmpdir = NULL; | ||
93 | +#if __GNUC__ >= 7 | ||
94 | + unsigned int writesize; | ||
95 | +#endif | ||
96 | |||
97 | /* open the config file for reading */ | ||
98 | if ((thefile = mmap_fopen(main_config_file)) == NULL) { | ||
99 | @@ -1021,10 +1024,16 @@ read_config_file(const char *main_config_file, nagios_macros *mac) | ||
100 | if (strcmp(dirfile->d_name + strlen(dirfile->d_name) - 4, ".cfg")) | ||
101 | continue; | ||
102 | |||
103 | - /* create /path/to/file */ | ||
104 | + /* create /path/to/file */ | ||
105 | +#if __GNUC__ >= 7 | ||
106 | + writesize = snprintf(file, sizeof(file), "%s/%s", include_dir, dirfile->d_name); | ||
107 | + if (writesize < (strlen(include_dir) + strlen(dirfile->d_name) + 2)) | ||
108 | + nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to sub-configuration file '%s'", dirfile->d_name); | ||
109 | +#else | ||
110 | snprintf(file, sizeof(file), "%s/%s", include_dir, dirfile->d_name); | ||
111 | +#endif | ||
112 | file[sizeof(file) - 1] = '\x0'; | ||
113 | - | ||
114 | + | ||
115 | error |= read_config_file(file, mac); | ||
116 | } | ||
117 | closedir(dirp); | ||
118 | diff --git a/src/naemon/macros.c b/src/naemon/macros.c | ||
119 | index 700bc821..13d817cf 100644 | ||
120 | --- a/src/naemon/macros.c | ||
121 | +++ b/src/naemon/macros.c | ||
122 | @@ -1518,6 +1518,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
123 | /***************/ | ||
124 | case MACRO_HOSTGROUPNAMES: | ||
125 | *free_macro = TRUE; | ||
126 | +#if __GNUC__ >= 7 | ||
127 | + __attribute__((fallthrough)); | ||
128 | +#endif | ||
129 | case MACRO_HOSTNAME: | ||
130 | case MACRO_HOSTALIAS: | ||
131 | case MACRO_HOSTADDRESS: | ||
132 | @@ -1612,6 +1615,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
133 | /********************/ | ||
134 | case MACRO_HOSTGROUPMEMBERS: | ||
135 | *free_macro = TRUE; | ||
136 | +#if __GNUC__ >= 7 | ||
137 | + __attribute__((fallthrough)); | ||
138 | +#endif | ||
139 | case MACRO_HOSTGROUPNAME: | ||
140 | case MACRO_HOSTGROUPALIAS: | ||
141 | case MACRO_HOSTGROUPNOTES: | ||
142 | @@ -1640,6 +1646,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
143 | /******************/ | ||
144 | case MACRO_SERVICEGROUPNAMES: | ||
145 | *free_macro = TRUE; | ||
146 | +#if __GNUC__ >= 7 | ||
147 | + __attribute__((fallthrough)); | ||
148 | +#endif | ||
149 | case MACRO_SERVICEDESC: | ||
150 | case MACRO_SERVICESTATE: | ||
151 | case MACRO_SERVICESTATEID: | ||
152 | @@ -1757,6 +1766,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
153 | case MACRO_SERVICEGROUPNOTESURL: | ||
154 | case MACRO_SERVICEGROUPACTIONURL: | ||
155 | *free_macro = TRUE; | ||
156 | +#if __GNUC__ >= 7 | ||
157 | + __attribute__((fallthrough)); | ||
158 | +#endif | ||
159 | case MACRO_SERVICEGROUPNAME: | ||
160 | case MACRO_SERVICEGROUPALIAS: | ||
161 | /* a standard servicegroup macro */ | ||
162 | @@ -1781,6 +1793,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
163 | /******************/ | ||
164 | case MACRO_CONTACTGROUPNAMES: | ||
165 | *free_macro = TRUE; | ||
166 | +#if __GNUC__ >= 7 | ||
167 | + __attribute__((fallthrough)); | ||
168 | +#endif | ||
169 | case MACRO_CONTACTNAME: | ||
170 | case MACRO_CONTACTALIAS: | ||
171 | case MACRO_CONTACTEMAIL: | ||
172 | @@ -1841,6 +1856,9 @@ static int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, c | ||
173 | /***********************/ | ||
174 | case MACRO_CONTACTGROUPMEMBERS: | ||
175 | *free_macro = TRUE; | ||
176 | +#if __GNUC__ >= 7 | ||
177 | + __attribute__((fallthrough)); | ||
178 | +#endif | ||
179 | case MACRO_CONTACTGROUPNAME: | ||
180 | case MACRO_CONTACTGROUPALIAS: | ||
181 | /* a standard contactgroup macro */ | ||
182 | diff --git a/src/naemon/xodtemplate.c b/src/naemon/xodtemplate.c | ||
183 | index d5fd1cda..225fc40a 100644 | ||
184 | --- a/src/naemon/xodtemplate.c | ||
185 | +++ b/src/naemon/xodtemplate.c | ||
186 | @@ -8443,7 +8443,10 @@ static int xodtemplate_process_config_dir(char *dir_name) | ||
187 | int result = OK; | ||
188 | register int x = 0; | ||
189 | struct stat stat_buf; | ||
190 | - | ||
191 | +#if __GNUC__ >= 7 | ||
192 | + unsigned int writesize; | ||
193 | +#endif | ||
194 | + | ||
195 | if (verify_config >= 2) | ||
196 | printf("Processing object config directory '%s'...\n", dir_name); | ||
197 | |||
198 | @@ -8462,7 +8465,13 @@ static int xodtemplate_process_config_dir(char *dir_name) | ||
199 | continue; | ||
200 | |||
201 | /* create /path/to/file */ | ||
202 | +#if __GNUC__ >= 7 | ||
203 | + writesize = snprintf(file, sizeof(file), "%s/%s", dir_name, dirfile->d_name); | ||
204 | + if (writesize < (strlen(dir_name) + strlen(dirfile->d_name) + 2)) | ||
205 | + nm_log(NSLOG_RUNTIME_WARNING, "Warning: truncated path to file '%s' in config directory '%s'", dirfile->d_name, dir_name); | ||
206 | +#else | ||
207 | snprintf(file, sizeof(file), "%s/%s", dir_name, dirfile->d_name); | ||
208 | +#endif | ||
209 | file[sizeof(file) - 1] = '\x0'; | ||
210 | |||
211 | /* process this if it's a non-hidden config file... */ | ||
diff --git a/naemon.service b/naemon.service index 6b3edc8..0c3a0da 100644 --- a/naemon.service +++ b/naemon.service | |||
@@ -4,10 +4,10 @@ Documentation=http://naemon.org/documentation | |||
4 | After=network.target | 4 | After=network.target |
5 | 5 | ||
6 | [Service] | 6 | [Service] |
7 | Type=simple | 7 | Type=forking |
8 | PIDFile=/run/naemon.pid | 8 | PIDFile=/run/naemon/naemon.pid |
9 | ExecStartPre=/usr/bin/naemon -vp /etc/naemon/naemon.cfg | 9 | ExecStartPre=/usr/bin/naemon -vp /etc/naemon/naemon.cfg |
10 | ExecStart=/usr/bin/naemon /etc/naemon/naemon.cfg | 10 | ExecStart=/usr/bin/naemon --daemon /etc/naemon/naemon.cfg |
11 | ExecReload=/bin/kill -HUP $MAINPID | 11 | ExecReload=/bin/kill -HUP $MAINPID |
12 | User=naemon | 12 | User=naemon |
13 | Group=naemon | 13 | Group=naemon |