Resolve remote $HOME in net.sh (#31702)
This commit is contained in:
parent
472fd6ecff
commit
68eb257f21
43
net/net.sh
43
net/net.sh
|
@ -232,29 +232,37 @@ build() {
|
||||||
echo "Build took $SECONDS seconds"
|
echo "Build took $SECONDS seconds"
|
||||||
}
|
}
|
||||||
|
|
||||||
SOLANA_HOME="\$HOME/solana"
|
remoteHomeDir() {
|
||||||
CARGO_BIN="\$HOME/.cargo/bin"
|
declare ipAddress=$1
|
||||||
|
declare remoteHome
|
||||||
|
remoteHome="$(ssh "${sshOptions[@]}" "$ipAddress" "echo \$HOME")"
|
||||||
|
echo "$remoteHome"
|
||||||
|
}
|
||||||
|
|
||||||
startCommon() {
|
startCommon() {
|
||||||
declare ipAddress=$1
|
declare ipAddress=$1
|
||||||
|
declare remoteHome
|
||||||
|
remoteHome=$(remoteHomeDir "$ipAddress")
|
||||||
|
local remoteSolanaHome="${remoteHome}/solana"
|
||||||
|
local remoteCargoBin="${remoteHome}/.cargo/bin"
|
||||||
test -d "$SOLANA_ROOT"
|
test -d "$SOLANA_ROOT"
|
||||||
if $skipSetup; then
|
if $skipSetup; then
|
||||||
# shellcheck disable=SC2029
|
# shellcheck disable=SC2029
|
||||||
ssh "${sshOptions[@]}" "$ipAddress" "
|
ssh "${sshOptions[@]}" "$ipAddress" "
|
||||||
set -x;
|
set -x;
|
||||||
mkdir -p $SOLANA_HOME/config;
|
mkdir -p $remoteSolanaHome/config;
|
||||||
rm -rf ~/config;
|
rm -rf ~/config;
|
||||||
mv $SOLANA_HOME/config ~;
|
mv $remoteSolanaHome/config ~;
|
||||||
rm -rf $SOLANA_HOME;
|
rm -rf $remoteSolanaHome;
|
||||||
mkdir -p $SOLANA_HOME $CARGO_BIN;
|
mkdir -p $remoteSolanaHome $remoteCargoBin;
|
||||||
mv ~/config $SOLANA_HOME/
|
mv ~/config $remoteSolanaHome/
|
||||||
"
|
"
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC2029
|
# shellcheck disable=SC2029
|
||||||
ssh "${sshOptions[@]}" "$ipAddress" "
|
ssh "${sshOptions[@]}" "$ipAddress" "
|
||||||
set -x;
|
set -x;
|
||||||
rm -rf $SOLANA_HOME;
|
rm -rf $remoteSolanaHome;
|
||||||
mkdir -p $CARGO_BIN
|
mkdir -p $remoteCargoBin
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
[[ -z "$externalNodeSshKey" ]] || ssh-copy-id -f -i "$externalNodeSshKey" "${sshOptions[@]}" "solana@$ipAddress"
|
[[ -z "$externalNodeSshKey" ]] || ssh-copy-id -f -i "$externalNodeSshKey" "${sshOptions[@]}" "solana@$ipAddress"
|
||||||
|
@ -264,10 +272,13 @@ startCommon() {
|
||||||
syncScripts() {
|
syncScripts() {
|
||||||
echo "rsyncing scripts... to $ipAddress"
|
echo "rsyncing scripts... to $ipAddress"
|
||||||
declare ipAddress=$1
|
declare ipAddress=$1
|
||||||
|
declare remoteHome
|
||||||
|
remoteHome=$(remoteHomeDir "$ipAddress")
|
||||||
|
local remoteSolanaHome="${remoteHome}/solana"
|
||||||
rsync -vPrc -e "ssh ${sshOptions[*]}" \
|
rsync -vPrc -e "ssh ${sshOptions[*]}" \
|
||||||
--exclude 'net/log*' \
|
--exclude 'net/log*' \
|
||||||
"$SOLANA_ROOT"/{fetch-perf-libs.sh,fetch-spl.sh,scripts,net,multinode-demo} \
|
"$SOLANA_ROOT"/{fetch-perf-libs.sh,fetch-spl.sh,scripts,net,multinode-demo} \
|
||||||
"$ipAddress":"$SOLANA_HOME"/ > /dev/null
|
"$ipAddress":"$remoteSolanaHome"/ > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Deploy local binaries to bootstrap validator. Other validators and clients later fetch the
|
# Deploy local binaries to bootstrap validator. Other validators and clients later fetch the
|
||||||
|
@ -275,14 +286,18 @@ syncScripts() {
|
||||||
deployBootstrapValidator() {
|
deployBootstrapValidator() {
|
||||||
declare ipAddress=$1
|
declare ipAddress=$1
|
||||||
|
|
||||||
|
declare remoteHome
|
||||||
|
remoteHome=$(remoteHomeDir "$ipAddress")
|
||||||
|
local remoteCargoBin="${remoteHome}/.cargo/bin"
|
||||||
|
|
||||||
echo "Deploying software to bootstrap validator ($ipAddress)"
|
echo "Deploying software to bootstrap validator ($ipAddress)"
|
||||||
case $deployMethod in
|
case $deployMethod in
|
||||||
tar)
|
tar)
|
||||||
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/solana-release/bin/* "$ipAddress:$CARGO_BIN/"
|
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/solana-release/bin/* "$ipAddress:$remoteCargoBin/"
|
||||||
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/solana-release/version.yml "$ipAddress:~/"
|
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/solana-release/version.yml "$ipAddress:~/"
|
||||||
;;
|
;;
|
||||||
local)
|
local)
|
||||||
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/farf/bin/* "$ipAddress:$CARGO_BIN/"
|
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/farf/bin/* "$ipAddress:$remoteCargoBin/"
|
||||||
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/farf/version.yml "$ipAddress:~/"
|
rsync -vPrc -e "ssh ${sshOptions[*]}" "$SOLANA_ROOT"/farf/version.yml "$ipAddress:~/"
|
||||||
;;
|
;;
|
||||||
skip)
|
skip)
|
||||||
|
@ -1179,7 +1194,9 @@ netem)
|
||||||
remoteNetemConfigFile="$(basename "$netemConfigFile")"
|
remoteNetemConfigFile="$(basename "$netemConfigFile")"
|
||||||
if [[ $netemCommand = "add" ]]; then
|
if [[ $netemCommand = "add" ]]; then
|
||||||
for ipAddress in "${validatorIpList[@]}"; do
|
for ipAddress in "${validatorIpList[@]}"; do
|
||||||
"$here"/scp.sh "$netemConfigFile" solana@"$ipAddress":"$SOLANA_HOME"
|
remoteHome=$(remoteHomeDir "$ipAddress")
|
||||||
|
remoteSolanaHome="${remoteHome}/solana"
|
||||||
|
"$here"/scp.sh "$netemConfigFile" solana@"$ipAddress":"$remoteSolanaHome"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
for i in "${!validatorIpList[@]}"; do
|
for i in "${!validatorIpList[@]}"; do
|
||||||
|
|
Loading…
Reference in New Issue