diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2018-06-01 14:48:45 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2018-06-01 14:51:46 -0700 |
commit | 47d734b5d4acb322b1db5b57a45e59c936380b06 (patch) | |
tree | eac9b6c8225f233e9f0f2837c080db4700720a5a /net-misc | |
parent | dev-python/mysql-connector-python: Revbump for python 3.6 (diff) | |
download | gentoo-47d734b5d4acb322b1db5b57a45e59c936380b06.tar.gz gentoo-47d734b5d4acb322b1db5b57a45e59c936380b06.tar.bz2 gentoo-47d734b5d4acb322b1db5b57a45e59c936380b06.zip |
net-misc/omnisync: fix bugs, allow multiple instances
Code bugs:
- Fix --help display
- Raise SHM unit limit
- getopt loop failed to apply stats_file setting.
Init improvement:
- allow multiple instances.
- write pidfile
- declare that we use DNS (in case it starts before local resolver)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Package-Manager: Portage-2.3.33, Repoman-2.3.9
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/omnisync/files/omnisync-1.0-help.patch | 16 | ||||
-rw-r--r-- | net-misc/omnisync/files/omnisync-1.0-maxshm.patch | 18 | ||||
-rw-r--r-- | net-misc/omnisync/files/omnisync-1.0-statfile.patch | 18 | ||||
-rw-r--r-- | net-misc/omnisync/files/omnisync.initd | 11 | ||||
-rw-r--r-- | net-misc/omnisync/omnisync-1.0-r1.ebuild | 48 |
5 files changed, 109 insertions, 2 deletions
diff --git a/net-misc/omnisync/files/omnisync-1.0-help.patch b/net-misc/omnisync/files/omnisync-1.0-help.patch new file mode 100644 index 000000000000..47ff5201c030 --- /dev/null +++ b/net-misc/omnisync/files/omnisync-1.0-help.patch @@ -0,0 +1,16 @@ +main: fix help missing newline + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c +--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 ++++ omnisync-1.0/main.c 2018-06-01 14:31:25.720686155 -0700 +@@ -139,7 +139,7 @@ + printf("-c x community (snmp only)\n"); + printf("-h x host to connect to\n"); + printf("-u x ntpd shared memory unit\n"); +- printf("-z x do an initial step, to speed up syncing, parameter is number of samples"); ++ printf("-z x do an initial step, to speed up syncing, parameter is number of samples\n"); + printf("-S x write measurements to file x\n"); + printf("-n do NOT submit to NTPd/set clock, query only (use in combination with -v and -f)\n"); + printf("-f do not fork\n"); diff --git a/net-misc/omnisync/files/omnisync-1.0-maxshm.patch b/net-misc/omnisync/files/omnisync-1.0-maxshm.patch new file mode 100644 index 000000000000..678c6e0072dd --- /dev/null +++ b/net-misc/omnisync/files/omnisync-1.0-maxshm.patch @@ -0,0 +1,18 @@ +main: raise SHM unit limit + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c +--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 ++++ omnisync-1.0/main.c 2018-06-01 14:32:34.630066839 -0700 +@@ -346,8 +346,8 @@ + unit_nr = atoi(optarg); + if (unit_nr < 0) + error_exit("-u requires a positive value\n"); +- if (unit_nr > 3) +- error_exit("NTPd normally supports only 4 shared memory devices, still continuing though\n"); ++ if (unit_nr > 254) ++ error_exit("NTPd normally supports only 254 shared memory devices\n"); + break; + + case 'v': diff --git a/net-misc/omnisync/files/omnisync-1.0-statfile.patch b/net-misc/omnisync/files/omnisync-1.0-statfile.patch new file mode 100644 index 000000000000..972316a33bd1 --- /dev/null +++ b/net-misc/omnisync/files/omnisync-1.0-statfile.patch @@ -0,0 +1,18 @@ +main: wire up stats_file variable + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar --exclude '*~' omnisync-1.0.orig/main.c omnisync-1.0/main.c +--- omnisync-1.0.orig/main.c 2009-01-02 01:03:20.000000000 -0800 ++++ omnisync-1.0/main.c 2018-06-01 14:39:22.115229735 -0700 +@@ -358,6 +358,10 @@ + version(); + return 0; + ++ case 'S': ++ stats_file = optarg; ++ break; ++ + default: + help(); + return 1; diff --git a/net-misc/omnisync/files/omnisync.initd b/net-misc/omnisync/files/omnisync.initd index 7820af6e94e3..c71e63d4d3e3 100644 --- a/net-misc/omnisync/files/omnisync.initd +++ b/net-misc/omnisync/files/omnisync.initd @@ -3,11 +3,18 @@ # Distributed under the terms of the GNU General Public License v2 depend() { - use net + use net dns } +INSTANCE=${SVCNAME#*.} +if [ -n "${INSTANCE}" ] && [ ${SVCNAME} != "omnisync" ]; then + pidfile="/var/run/omnisync.${INSTANCE}.pid" +else + pidfile="/var/run/omnisync.pid" +fi + command="/usr/sbin/omnisync" -command_args="-M ${OMNISYNC_MODE} ${OMNISYNC_ARGS}" +command_args="-P ${pidfile} -M ${OMNISYNC_MODE} ${OMNISYNC_ARGS}" start_pre() { if [ -z "${OMNISYNC_MODE}" ] ; then diff --git a/net-misc/omnisync/omnisync-1.0-r1.ebuild b/net-misc/omnisync/omnisync-1.0-r1.ebuild new file mode 100644 index 000000000000..5875550ac80f --- /dev/null +++ b/net-misc/omnisync/omnisync-1.0-r1.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit toolchain-funcs + +DESCRIPTION="A driver for NTPd for people who are firewall-challenged" +HOMEPAGE="https://www.vanheusden.com/time/omnisync" +LICENSE="GPL-2" +SRC_URI="https://www.vanheusden.com/time/${PN}/${P}.tgz" + +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug" + +RDEPEND="dev-libs/openssl:0= net-analyzer/net-snmp:=" +DEPEND="${RDEPEND}" +DOCS=( readme.txt Changes ) +PATCHES=( + "${FILESDIR}"/omnisync-1.0-help.patch + "${FILESDIR}"/omnisync-1.0-maxshm.patch + "${FILESDIR}"/omnisync-1.0-statfile.patch +) + +src_prepare() { + default + tc-export CC + sed -i \ + -e 's/-O2 -Wall/-Wall/' \ + -e 's/-lsnmp/-lnetsnmp/' \ + "${S%/}/Makefile" || die + use debug || sed -i -e 's/$(DEBUG)//' "${S%/}/Makefile" || die +} + +src_install() { + dosbin omnisync + newinitd "${FILESDIR%/}/${PN}.initd" ${PN} + newconfd "${FILESDIR%/}/${PN}.confd" ${PN} + einstalldocs +} + +pkg_postinst() { + local isConfigured=$(grep 'OMNISYNC_MODE=""' "${ROOT%/}/etc/conf.d/${PN}") + if [[ -n "${isConfigured}" ]] ; then + elog "Be sure to configure ${PN} in ${ROOT%/}/etc/conf.d before trying to start the service" + fi +} |