Skip to content

Commit 1d8ae65

Browse files
committed
WIP: Add Rita extender definition
1 parent 05d4fbe commit 1d8ae65

4 files changed

Lines changed: 91 additions & 0 deletions

File tree

althea/rita-extender/Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Copyright (C) 2017-2018 Justin Kilpatrick, Openwrt.org
3+
#
4+
# This is free software, licensed under the GNU General Public License v2.
5+
# See /LICENSE for more information.
6+
#
7+
8+
# you must set $RUST_TRIPLE in your env
9+
include $(TOPDIR)/rules.mk
10+
11+
PKG_NAME:=rita-extender
12+
PKG_VERSION:=0.20.8
13+
PKG_RELEASE:=0
14+
15+
PKG_SOURCE_PROTO:=git
16+
PKG_SOURCE_URL:=https://github.com/althea-net/althea_rs
17+
PKG_SOURCE_VERSION:=a5a715be81e0b4060a7fe6a87e462e1964020420
18+
PKG_LICENSE:=Apache-2.0
19+
20+
include $(INCLUDE_DIR)/package.mk
21+
22+
define Package/rita-extender
23+
SECTION:=net
24+
CATEGORY:=Utilities
25+
SUBMENU:=Althea
26+
TITLE:=Althea Rita Extender
27+
URL:=https://github.com/althea-net/althea_rs
28+
MAINTAINER:= Justin Kilpatrick <justin@althea.net>
29+
DEPENDS:=@IPV6 +ca-bundle +ca-certificates +kmod-sched-cake +tc
30+
PKG_BUILD_DEPENDS:=openssl
31+
endef
32+
33+
define Package/rita-extender/description
34+
Althea Rita Extender
35+
endef
36+
37+
RITA_PATH:="$(PKG_BUILD_DIR)/target/$(RUST_TRIPLE)/release/rita_extender"
38+
39+
define Build/Compile
40+
(\
41+
cd $(PKG_BUILD_DIR) && \
42+
cargo install cross && \
43+
cross build --release --target $(RUST_TRIPLE) -p rita_bin --bin rita_extender \
44+
)
45+
$(STRIP) $(RITA_PATH)
46+
endef
47+
48+
define Package/rita-extender/install
49+
$(INSTALL_DIR) $(1)/usr/sbin
50+
$(INSTALL_BIN) $(RITA_PATH) $(1)/usr/sbin/rita_extender
51+
$(INSTALL_DIR) $(1)/etc/init.d
52+
$(INSTALL_BIN) ./files/rita_extender.init $(1)/etc/init.d/rita_extender
53+
$(INSTALL_DIR) $(1)/etc/crontabs/
54+
$(CP) ./files/checkup.ash $(1)/etc/
55+
$(CP) ./files/root $(1)/etc/crontabs/
56+
endef
57+
58+
$(eval $(call BuildPackage,rita-extender))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/ash
2+
set -eux
3+
4+
set +e
5+
curl -f --max-time 300 127.0.0.1:4877/status
6+
# if the ping fails we should restart
7+
if [ 0 -ne $? ]; then
8+
/etc/init.d/rita_extender restart
9+
date > /etc/lastcrash
10+
fi
11+
set -e
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh /etc/rc.common
2+
# Copyright (C) 2006-2016 OpenWrt.org
3+
4+
START=90
5+
PROG=/usr/sbin/rita_extender
6+
7+
RUST_LOG=INFO
8+
9+
start() {
10+
[ -f $config_file ] || return 1
11+
(service_start $PROG &> /dev/null )&
12+
}
13+
14+
stop() {
15+
service_stop $PROG
16+
}
17+
18+
reload() {
19+
$PROG2 reload
20+
}

althea/rita-extender/files/root

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Every 10 minutes curl Rita and try and restart if there's no response
2+
*/10 * * * * ash /etc/checkup.ash

0 commit comments

Comments
 (0)