Skip to content

Commit

Permalink
re-apply missed commit on socat check, ssh agent home variable and
Browse files Browse the repository at this point in the history
messages for run.sh

Changes to be committed:
	modified:   image-files/scripts/common.sh
	modified:   image-files/scripts/port_forwarding.sh
	modified:   image-files/scripts/run.sh
	modified:   latest/scripts/common.sh
	modified:   latest/scripts/port_forwarding.sh
	modified:   latest/scripts/run.sh
	modified:   stable/scripts/common.sh
	modified:   stable/scripts/port_forwarding.sh
	modified:   stable/scripts/run.sh
  • Loading branch information
gnzsnz committed Nov 27, 2023
1 parent 78eacae commit c7564f6
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 9 deletions.
6 changes: 3 additions & 3 deletions image-files/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ setup_ssh() {
# start agent if it's not already running
# https://wiki.archlinux.org/title/SSH_keys#SSH_agents
echo ".> Starting ssh-agent."
ssh-agent >"/config/.ssh-agent.env"
source "/config/.ssh-agent.env"
ssh-agent >"${HOME}/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
else
echo ".> ssh-agent already running"
if [ -z "${SSH_AUTH_SOCK}" ]; then
echo ".> Loading agent environment"
source "/config/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
fi
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
fi
Expand Down
5 changes: 5 additions & 0 deletions image-files/scripts/port_forwarding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ else
echo ".> SOCAT_PORT not set, port: ${SOCAT_PORT}"
exit 1
fi
if [ -n "$(pgrep -x socat)" ]; then
# if this script is already running don't start it
echo ".> socat already active. Not starting a new one"
exit 0
fi
# no ssh tunnel, start socat
echo ".> Waiting for socat to start"
sleep 30
Expand Down
13 changes: 13 additions & 0 deletions image-files/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# shellcheck disable=SC2317
# Don't warn about unreachable commands in this file

echo "*************************************************************************"
echo ".> Starting IBC/IB gateway"
echo "*************************************************************************"

# shellcheck disable=SC1091
source "${SCRIPT_PATH}/common.sh"

Expand Down Expand Up @@ -38,6 +42,7 @@ stop_ibc() {

start_xvfb() {
# start Xvfb
echo ".> Starting Xvfb server"
DISPLAY=:1
export DISPLAY
rm -f /tmp/.X1-lock
Expand Down Expand Up @@ -72,6 +77,14 @@ set_ports
# forward ports, socat or ssh
"${SCRIPT_PATH}/port_forwarding.sh" &

echo ".> Starting IBC with params:"
echo ".> Version: ${TWS_MAJOR_VRSN}"
echo ".> program: ${IBC_COMMAND:-gateway}"
echo ".> tws-path: ${TWS_PATH}"
echo ".> ibc-path: ${IBC_PATH}"
echo ".> ibc-init: ${IBC_INI}"
echo ".> tws-settings-path: ${TWS_SETTINGS_PATH:-$TWS_PATH}"
echo ".> on2fatimeout: ${TWOFA_TIMEOUT_ACTION}"
# start IBC -g for gateway
"${IBC_PATH}/scripts/ibcstart.sh" "${TWS_MAJOR_VRSN}" -g \
"--tws-path=${TWS_PATH}" \
Expand Down
6 changes: 3 additions & 3 deletions latest/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ setup_ssh() {
# start agent if it's not already running
# https://wiki.archlinux.org/title/SSH_keys#SSH_agents
echo ".> Starting ssh-agent."
ssh-agent >"/config/.ssh-agent.env"
source "/config/.ssh-agent.env"
ssh-agent >"${HOME}/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
else
echo ".> ssh-agent already running"
if [ -z "${SSH_AUTH_SOCK}" ]; then
echo ".> Loading agent environment"
source "/config/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
fi
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
fi
Expand Down
5 changes: 5 additions & 0 deletions latest/scripts/port_forwarding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ else
echo ".> SOCAT_PORT not set, port: ${SOCAT_PORT}"
exit 1
fi
if [ -n "$(pgrep -x socat)" ]; then
# if this script is already running don't start it
echo ".> socat already active. Not starting a new one"
exit 0
fi
# no ssh tunnel, start socat
echo ".> Waiting for socat to start"
sleep 30
Expand Down
13 changes: 13 additions & 0 deletions latest/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# shellcheck disable=SC2317
# Don't warn about unreachable commands in this file

echo "*************************************************************************"
echo ".> Starting IBC/IB gateway"
echo "*************************************************************************"

# shellcheck disable=SC1091
source "${SCRIPT_PATH}/common.sh"

Expand Down Expand Up @@ -38,6 +42,7 @@ stop_ibc() {

start_xvfb() {
# start Xvfb
echo ".> Starting Xvfb server"
DISPLAY=:1
export DISPLAY
rm -f /tmp/.X1-lock
Expand Down Expand Up @@ -72,6 +77,14 @@ set_ports
# forward ports, socat or ssh
"${SCRIPT_PATH}/port_forwarding.sh" &

echo ".> Starting IBC with params:"
echo ".> Version: ${TWS_MAJOR_VRSN}"
echo ".> program: ${IBC_COMMAND:-gateway}"
echo ".> tws-path: ${TWS_PATH}"
echo ".> ibc-path: ${IBC_PATH}"
echo ".> ibc-init: ${IBC_INI}"
echo ".> tws-settings-path: ${TWS_SETTINGS_PATH:-$TWS_PATH}"
echo ".> on2fatimeout: ${TWOFA_TIMEOUT_ACTION}"
# start IBC -g for gateway
"${IBC_PATH}/scripts/ibcstart.sh" "${TWS_MAJOR_VRSN}" -g \
"--tws-path=${TWS_PATH}" \
Expand Down
6 changes: 3 additions & 3 deletions stable/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ setup_ssh() {
# start agent if it's not already running
# https://wiki.archlinux.org/title/SSH_keys#SSH_agents
echo ".> Starting ssh-agent."
ssh-agent >"/config/.ssh-agent.env"
source "/config/.ssh-agent.env"
ssh-agent >"${HOME}/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
else
echo ".> ssh-agent already running"
if [ -z "${SSH_AUTH_SOCK}" ]; then
echo ".> Loading agent environment"
source "/config/.ssh-agent.env"
source "${HOME}/.ssh-agent.env"
fi
echo ".> ssh-agent sock: ${SSH_AUTH_SOCK}"
fi
Expand Down
5 changes: 5 additions & 0 deletions stable/scripts/port_forwarding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ else
echo ".> SOCAT_PORT not set, port: ${SOCAT_PORT}"
exit 1
fi
if [ -n "$(pgrep -x socat)" ]; then
# if this script is already running don't start it
echo ".> socat already active. Not starting a new one"
exit 0
fi
# no ssh tunnel, start socat
echo ".> Waiting for socat to start"
sleep 30
Expand Down
13 changes: 13 additions & 0 deletions stable/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# shellcheck disable=SC2317
# Don't warn about unreachable commands in this file

echo "*************************************************************************"
echo ".> Starting IBC/IB gateway"
echo "*************************************************************************"

# shellcheck disable=SC1091
source "${SCRIPT_PATH}/common.sh"

Expand Down Expand Up @@ -38,6 +42,7 @@ stop_ibc() {

start_xvfb() {
# start Xvfb
echo ".> Starting Xvfb server"
DISPLAY=:1
export DISPLAY
rm -f /tmp/.X1-lock
Expand Down Expand Up @@ -72,6 +77,14 @@ set_ports
# forward ports, socat or ssh
"${SCRIPT_PATH}/port_forwarding.sh" &

echo ".> Starting IBC with params:"
echo ".> Version: ${TWS_MAJOR_VRSN}"
echo ".> program: ${IBC_COMMAND:-gateway}"
echo ".> tws-path: ${TWS_PATH}"
echo ".> ibc-path: ${IBC_PATH}"
echo ".> ibc-init: ${IBC_INI}"
echo ".> tws-settings-path: ${TWS_SETTINGS_PATH:-$TWS_PATH}"
echo ".> on2fatimeout: ${TWOFA_TIMEOUT_ACTION}"
# start IBC -g for gateway
"${IBC_PATH}/scripts/ibcstart.sh" "${TWS_MAJOR_VRSN}" -g \
"--tws-path=${TWS_PATH}" \
Expand Down

0 comments on commit c7564f6

Please sign in to comment.