autossh: make forwarding optional
- previously localport option was required, which broke older configs - now in-config forwarding is only optional - ssh option still can be used for forwarding as in sample config Signed-off-by: kkubicki <krzysiek.kubicki@gmail.com>
This commit is contained in:
parent
b94c6dd37d
commit
278970f10c
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=autossh
|
PKG_NAME:=autossh
|
||||||
PKG_VERSION:=1.4g
|
PKG_VERSION:=1.4g
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
|
||||||
PKG_SOURCE_URL:=https://www.harding.motd.ca/autossh/
|
PKG_SOURCE_URL:=https://www.harding.motd.ca/autossh/
|
||||||
|
|
|
@ -34,16 +34,16 @@ start_instance() {
|
||||||
config_get path "$section" path
|
config_get path "$section" path
|
||||||
config_get pidfile "$section" pidfile
|
config_get pidfile "$section" pidfile
|
||||||
|
|
||||||
if [ -z "$localport" ]; then
|
if [ -n "$localport" ] && [ -n "$remoteport" ]; then
|
||||||
echo "autossh: localport option is required"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$remotehost" ]; then
|
if [ -n "$remotehost" ]; then
|
||||||
forwarding="-L ${localport}:${remotehost}:${remoteport}"
|
forwarding="-L ${localport}:${remotehost}:${remoteport}"
|
||||||
else
|
else
|
||||||
forwarding="-R ${remoteport}:${localhost}:${localport}"
|
forwarding="-R ${remoteport}:${localhost}:${localport}"
|
||||||
fi
|
fi
|
||||||
|
elif [ -n "$localport" ] || [ -n "$remoteport" ]; then
|
||||||
|
echo "autossh: both localport and remoteport options are required"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
procd_open_instance "$section"
|
procd_open_instance "$section"
|
||||||
procd_set_param command /usr/sbin/autossh ${forwarding} ${ssh}
|
procd_set_param command /usr/sbin/autossh ${forwarding} ${ssh}
|
||||||
|
|
Loading…
Reference in New Issue