From 216c660cd1a1fcbd189880548c33f7846542698e Mon Sep 17 00:00:00 2001 From: Isaac Hill Date: Sun, 3 Nov 2024 17:01:51 -0800 Subject: Use bash variable rather than optional argument for ssh key path --- util/download-latest-save.bash | 10 +++++----- util/upload-save.bash | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'util') diff --git a/util/download-latest-save.bash b/util/download-latest-save.bash index 2ab5c62..c1d0f0d 100644 --- a/util/download-latest-save.bash +++ b/util/download-latest-save.bash @@ -1,17 +1,17 @@ #!/bin/bash # Check if remote name is provided -if [ $# -ne 1 -a $# -ne 2 ]; then - echo "Usage: $0 [optional_path_to_MyKey.pem]" +if [ $# -ne 1 ]; then + echo "Usage: $0 " exit 1 fi remote_name="$1" key_path="" -# Check if remote name is provided -if [ $# -eq 2 ]; then - key_path="-i $2" +# Check if custom PEM file is provided +if [ -n "$FACTORIO_PEM" ]; then + key_path="-i $FACTORIO_PEM" fi # Generate a human-readable timestamp diff --git a/util/upload-save.bash b/util/upload-save.bash index d8a109f..4cd55e8 100644 --- a/util/upload-save.bash +++ b/util/upload-save.bash @@ -1,8 +1,8 @@ #!/bin/bash # Check if both arguments are provided -if [ $# -ne 2 -a $# -ne 3 ]; then - echo "Usage: $0 [optional_path_to_MyKey.pem]" +if [ $# -ne 2 ]; then + echo "Usage: $0 " exit 1 fi @@ -11,9 +11,9 @@ save_file="$1" ec2_address="$2" key_path="" -# Check if remote name is provided -if [ $# -eq 3 ]; then - key_path="-i $3" +# Check if custom PEM file is provided +if [ -n "$FACTORIO_PEM" ]; then + key_path="-i $FACTORIO_PEM" fi # Check if the file exists -- cgit v1.2.3