forked from openwrt/packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fsh helps you access local shell and TCP services behind a NAT or firewall. More details: https://github.com/heiher/hev-fsh Signed-off-by: Ray Wang <[email protected]>
- Loading branch information
Showing
5 changed files
with
159 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,41 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=fsh | ||
PKG_VERSION:=4.8.7 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz | ||
PKG_SOURCE_URL:=https://github.com/heiher/hev-fsh/releases/download/$(PKG_VERSION) | ||
PKG_HASH:=4b89857915fd6c9a39c66203ac7098d4fa5ff1bef6c2f7467f4ea617a0933ea2 | ||
|
||
PKG_MAINTAINER:=Ray Wang <[email protected]> | ||
PKG_LICENSE:=MIT | ||
PKG_LICENSE_FILES:=License | ||
|
||
PKG_BUILD_FLAGS:=no-mips16 | ||
PKG_BUILD_PARALLEL:=1 | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/fsh | ||
SECTION:=net | ||
CATEGORY:=Network | ||
TITLE:=Fsh helps you access local shell and TCP services behind a NAT or firewall | ||
URL:=https://github.com/heiher/hev-fsh | ||
endef | ||
|
||
define Package/fsh/conffiles | ||
/etc/config/fsh | ||
endef | ||
|
||
define Package/fsh/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/hev-fsh $(1)/usr/bin/fsh | ||
$(INSTALL_DIR) $(1)/etc/config/ | ||
$(INSTALL_CONF) ./files/fsh.config $(1)/etc/config/fsh | ||
$(INSTALL_DIR) $(1)/etc/init.d/ | ||
$(INSTALL_BIN) ./files/fshs.init $(1)/etc/init.d/fshs | ||
$(INSTALL_BIN) ./files/fshc.init $(1)/etc/init.d/fshc | ||
endef | ||
|
||
$(eval $(call BuildPackage,fsh)) |
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,12 @@ | ||
config fshs | ||
option enable '0' | ||
option addr '[::]' | ||
option port '6339' | ||
option tokens '/etc/fsh' | ||
|
||
config fshc | ||
option enable '0' | ||
option addr '127.0.0.1' | ||
option port '6339' | ||
option token '' | ||
option params '-f -p -w 127.0.0.1:22' |
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,50 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
START=99 | ||
USE_PROCD=1 | ||
|
||
NAME=fsh | ||
PROG=/usr/bin/$NAME | ||
|
||
validate_section_fshc() { | ||
uci_load_validate "${NAME}" fshc "$1" "$2" \ | ||
'enable:bool:0' \ | ||
'addr:string' \ | ||
'port:port' \ | ||
'token:string' \ | ||
'params:string' | ||
} | ||
|
||
fshc_instance() { | ||
[ "$2" = 0 ] || { | ||
echo "validation failed" | ||
return 1 | ||
} | ||
|
||
[ "${enable}" = 0 ] && return 1 | ||
|
||
procd_open_instance "$1" | ||
|
||
procd_set_param command "$PROG" | ||
procd_append_param command ${params} | ||
if [ -z "$token" ]; then | ||
procd_append_param command "$addr":"$port" | ||
else | ||
procd_append_param command "$addr":"$port"/"$token" | ||
fi | ||
|
||
procd_close_instance | ||
} | ||
|
||
start_service() { | ||
config_load "${NAME}" | ||
config_foreach validate_section_fshc fshc fshc_instance | ||
} | ||
|
||
service_triggers() { | ||
procd_add_reload_trigger "$NAME" | ||
|
||
procd_open_validate | ||
validate_section_fshc | ||
procd_close_validate | ||
} |
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,53 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
START=99 | ||
USE_PROCD=1 | ||
|
||
NAME=fsh | ||
PROG=/usr/bin/$NAME | ||
|
||
validate_section_fshs() { | ||
uci_load_validate "${NAME}" fshs "$1" "$2" \ | ||
'enable:bool:0' \ | ||
'addr:string' \ | ||
'port:port' \ | ||
'tokens:string' | ||
} | ||
|
||
fshs_instance() { | ||
[ "$2" = 0 ] || { | ||
echo "validation failed" | ||
return 1 | ||
} | ||
|
||
[ "${enable}" = 0 ] && return 1 | ||
|
||
procd_open_instance "$1" | ||
|
||
procd_set_param command "$PROG" "-s" | ||
[ -n "$tokens" ] && [ -e "$tokens" ] && { | ||
procd_append_param command -a "$tokens" | ||
} | ||
procd_append_param command "$addr":"$port" | ||
|
||
procd_set_param limits core="unlimited" | ||
procd_set_param limits nofile="1000000 1000000" | ||
procd_set_param stdout 1 | ||
procd_set_param stderr 1 | ||
procd_set_param respawn | ||
|
||
procd_close_instance | ||
} | ||
|
||
start_service() { | ||
config_load "${NAME}" | ||
config_foreach validate_section_fshs fshs fshs_instance | ||
} | ||
|
||
service_triggers() { | ||
procd_add_reload_trigger "$NAME" | ||
|
||
procd_open_validate | ||
validate_section_fshs | ||
procd_close_validate | ||
} |
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,3 @@ | ||
#!/bin/sh | ||
|
||
"$1" 2>&1 | grep "$2" |