aboutsummaryrefslogtreecommitdiff
path: root/rmbt-client
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-09-01 12:47:27 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-09-01 12:47:27 +0200
commit75680b1fa9d349387c898040f838c58bd20c53e4 (patch)
treed8f293d137dd66604032f0bc641ab882f2660a85 /rmbt-client
parentf030f0062a806dcbeae8c38bdf4c813f1feb05fb (diff)
downloadturris-myrepo-75680b1fa9d349387c898040f838c58bd20c53e4.tar.gz
turris-myrepo-75680b1fa9d349387c898040f838c58bd20c53e4.tar.bz2
turris-myrepo-75680b1fa9d349387c898040f838c58bd20c53e4.zip
Add rmbt-client package
Diffstat (limited to 'rmbt-client')
-rw-r--r--rmbt-client/Makefile51
-rw-r--r--rmbt-client/files/updater.config9
-rw-r--r--rmbt-client/files/updater.defaults24
-rw-r--r--rmbt-client/patches/remove_stdatomic.patch22
4 files changed, 106 insertions, 0 deletions
diff --git a/rmbt-client/Makefile b/rmbt-client/Makefile
new file mode 100644
index 0000000..0b4740d
--- /dev/null
+++ b/rmbt-client/Makefile
@@ -0,0 +1,51 @@
+#
+## Copyright (C) 2016-2017 CZ.NIC z.s.p.o. (http://www.nic.cz/)
+#
+## This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+# #
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rmbt-client
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/lwimmer/rmbt-client.git
+PKG_SOURCE:=$(PKG_NAME).tar.gz
+PKG_SOURCE_VERSION:=cd544e53c24c35ea36211bf95dc7983a5c7f6a9f
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+ TITLE:=RMBT speed measurement client in C
+ MAINTAINER:=CZ.NIC <packaging@turris.cz>
+ DEPENDS:=+libuuid +openssl +libjson-c
+endef
+define Package/$(PKG_NAME)/description
+ Desc
+endef
+
+define Package/$(PKG_NAME)/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rmbt $(1)/usr/bin/rmbt-client
+endef
+
+#define Package/$(PKG_NAME)/conffiles
+#endef
+
+#define Package/$(PKG_NAME)/postinst
+##!/bin/sh
+#[ -n "$$IPKG_INSTROOT" ] || {
+#/etc/init.d/updater enable || true
+## Run the uci-defaults now if we are installed at runtime and not flashed
+#/etc/uci-defaults/updater && rm /etc/uci-defaults/updater
+#}
+#endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/rmbt-client/files/updater.config b/rmbt-client/files/updater.config
new file mode 100644
index 0000000..c9c68a0
--- /dev/null
+++ b/rmbt-client/files/updater.config
@@ -0,0 +1,9 @@
+config pkglists pkglists
+ list lists 'luci-controls'
+ list lists 'nas'
+ list lists 'printserver'
+ list lists 'netutils'
+
+config l10n 'l10n'
+ list langs 'cs'
+ list langs 'de'
diff --git a/rmbt-client/files/updater.defaults b/rmbt-client/files/updater.defaults
new file mode 100644
index 0000000..951558a
--- /dev/null
+++ b/rmbt-client/files/updater.defaults
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# We want to generate some "random" time when the updater is run, every 12 hours.
+# The time when the router is first booted or the updater is installed for
+# the first time is as good source of the time as any.
+#
+# With date +%l we get time in interval 1-12. Substracting 1 gives us 0-11, and
+# the next run is 12-23 by adding 12. We may take the minutes as they are.
+#
+# We need to take care not to have leading zeroes, since tools tend to take that
+# as octal. We don't want to study which tools are OK with it, so we simply
+# don't have them.
+
+HOUR=$(($(date +%I | sed -e 's/^0*\(..*\)/\1/') - 1)) # We want 12-hour interval. And no leading zeroes (except for a lone 0)
+HOUR_NEXT=$(($HOUR + 12))
+MINUTE=$(date +%M | sed -e 's/^0*\(..*\)/\1/')
+
+# Generate the cron script
+(
+ echo 'MAILTO=""'
+ echo "$MINUTE $HOUR,$HOUR_NEXT * * * root /usr/bin/updater.sh >/dev/null 2>&1 &"
+ echo "0 0 * * * root /usr/bin/updater-unstuck.sh >/dev/null 2>&1"
+) >/etc/cron.d/updater
+chmod 0600 /etc/cron.d/updater
diff --git a/rmbt-client/patches/remove_stdatomic.patch b/rmbt-client/patches/remove_stdatomic.patch
new file mode 100644
index 0000000..d1a35a4
--- /dev/null
+++ b/rmbt-client/patches/remove_stdatomic.patch
@@ -0,0 +1,22 @@
+diff --git a/src/rmbt_flow.h b/src/rmbt_flow.h
+index 310eb29..cba5814 100644
+--- a/src/rmbt_flow.h
++++ b/src/rmbt_flow.h
+@@ -20,8 +20,6 @@
+ #include "rmbt_common.h"
+ #include "rmbt_result.h"
+
+-#include <stdatomic.h>
+-
+ typedef struct {
+ char *bind_ip, *server_host, *server_port, *cipherlist, *secret, *token, *test_id, *file_summary, *file_flows, *file_stats;
+ int_fast16_t dl_num_flows, ul_num_flows, dl_duration_s, ul_duration_s, rtt_tcp_payload_num, dl_pretest_duration_s, ul_pretest_duration_s, dl_wait_time_s,
+@@ -32,7 +30,7 @@ typedef struct {
+ } TestConfig;
+
+ typedef struct {
+- atomic_bool global_abort;
++ volatile bool global_abort;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int_fast16_t total;