-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# Copyright (C) 2017-2018 Justin Kilpatrick, Openwrt.org | ||
# | ||
# This is free software, licensed under the GNU General Public License v2. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
# you must set $RUST_TRIPLE in your env | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=rita-extender | ||
PKG_VERSION:=0.20.8 | ||
PKG_RELEASE:=0 | ||
|
||
PKG_SOURCE_PROTO:=git | ||
PKG_SOURCE_URL:=https://github.com/althea-net/althea_rs | ||
PKG_SOURCE_VERSION:=f53562ac1f445449c4d639e7eb5e764c30f3ce48 | ||
PKG_LICENSE:=Apache-2.0 | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/rita-extender | ||
SECTION:=net | ||
CATEGORY:=Utilities | ||
SUBMENU:=Althea | ||
TITLE:=Althea Rita Extender | ||
URL:=https://github.com/althea-net/althea_rs | ||
MAINTAINER:= Justin Kilpatrick <[email protected]> | ||
DEPENDS:=@IPV6 +ca-bundle +ca-certificates +kmod-sched-cake +tc | ||
PKG_BUILD_DEPENDS:=openssl | ||
endef | ||
|
||
define Package/rita-extender/description | ||
Althea Rita Extender | ||
endef | ||
|
||
RITA_PATH:="$(PKG_BUILD_DIR)/target/$(RUST_TRIPLE)/release/rita_extender" | ||
|
||
define Build/Compile | ||
(\ | ||
cd $(PKG_BUILD_DIR) && \ | ||
cargo install cross && \ | ||
cross build --release --target $(RUST_TRIPLE) -p rita_bin --bin rita_extender \ | ||
) | ||
$(STRIP) $(RITA_PATH) | ||
endef | ||
|
||
define Package/rita-extender/install | ||
$(INSTALL_DIR) $(1)/usr/sbin | ||
$(INSTALL_BIN) $(RITA_PATH) $(1)/usr/sbin/rita_extender | ||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/rita_extender.init $(1)/etc/init.d/rita_extender | ||
$(INSTALL_DIR) $(1)/etc/crontabs/ | ||
$(CP) ./files/checkup.ash $(1)/etc/ | ||
$(CP) ./files/root $(1)/etc/crontabs/ | ||
endef | ||
|
||
$(eval $(call BuildPackage,rita-extender)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/ash | ||
set -eux | ||
|
||
set +e | ||
curl -f --max-time 300 127.0.0.1:4877/status | ||
# if the ping fails we should restart | ||
if [ 0 -ne $? ]; then | ||
/etc/init.d/rita_extender restart | ||
date > /etc/lastcrash | ||
fi | ||
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh /etc/rc.common | ||
# Copyright (C) 2006-2016 OpenWrt.org | ||
|
||
START=90 | ||
PROG=/usr/sbin/rita_extender | ||
|
||
RUST_LOG=INFO | ||
|
||
start() { | ||
[ -f $config_file ] || return 1 | ||
(service_start $PROG &> /dev/null )& | ||
} | ||
|
||
stop() { | ||
service_stop $PROG | ||
} | ||
|
||
reload() { | ||
$PROG2 reload | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Every 10 minutes curl Rita and try and restart if there's no response | ||
*/10 * * * * ash /etc/checkup.ash |