Update remote deployment script to accept glob hash arg

This commit is contained in:
Prathamesh Musale 2023-12-05 13:52:58 +05:30
parent 37a1b21fcd
commit 2969cce48b
2 changed files with 15 additions and 13 deletions

View File

@ -1,23 +1,22 @@
#!/bin/bash
# $1: Glob file URL (eg. https://xyz.com/glob-abcd.glob)
# $2: Urbit ship's pier dir (default: ./zod)
# $1: Glob file URL (eg. https://xyz.com/glob-0vabcd.glob)
# $2: Glob file hash (eg. 0vabcd)
# $3: Urbit ship's pier dir (default: ./zod)
if [ -z "$1" ]; then
echo "Glob file URL arg not provided"
if [ "$#" -lt 2 ]; then
echo "Insufficient arguments"
exit 0
fi
glob_url=$1
glob_file=$(basename "$glob_url")
glob_hash=$(echo "$glob_file" | sed "s/glob-\([a-z0-9\.]*\).glob/\1/")
echo "Using glob file ${glob_file}"
glob_hash=$2
echo "Using glob file from ${glob_url} with hash ${glob_hash}"
# Default pier dir: ./zod
# Default desk dir: ./zod/uniswap
pier_dir="${2:-./zod}"
pier_dir="${3:-./zod}"
uniswap_desk_dir="${pier_dir}/uniswap"
echo "Using ${uniswap_desk_dir} as the Uniswap desk dir path"
# Fire curl requests to perform operations on the ship

View File

@ -2,17 +2,20 @@
# $1: Remote user host
# $2: Remote Urbit ship's pier dir path (eg. /home/user/zod)
# $3: Glob file URL (eg. https://xyz.com/glob-abcd.glob)
# $3: Glob file URL (eg. https://xyz.com/glob-0vabcd.glob)
# $4: Glob file hash (eg. 0vabcd)
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <username@remote_host> </path/to/remote/pier/folder> <glob_url>"
if [ "$#" -ne 4 ]; then
echo "Incorrect number of arguments"
echo "Usage: $0 <username@remote_host> </path/to/remote/pier/folder> <glob_url> <glob_hash>"
exit 1
fi
remote_user_host="$1"
remote_pier_folder="$2"
glob_url="$3"
glob_hash="$4"
installation_script="./install-uniswap-app.sh"
ssh "$remote_user_host" "bash -s $glob_url $remote_pier_folder" < "$installation_script"
ssh "$remote_user_host" "bash -s $glob_url $glob_hash $remote_pier_folder" < "$installation_script"