From 9841ec398e19ae43fe6ad3e9b7e01418034fb9cd Mon Sep 17 00:00:00 2001 From: Fridrik Asmundsson Date: Mon, 22 Apr 2024 16:20:53 +0000 Subject: [PATCH] Rename existing ipc folder with timestamp instead of deleting it --- .../prepare_local.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/deploy_subnet_under_calibration_net/prepare_local.sh b/scripts/deploy_subnet_under_calibration_net/prepare_local.sh index 2fac63592..9451ff04e 100755 --- a/scripts/deploy_subnet_under_calibration_net/prepare_local.sh +++ b/scripts/deploy_subnet_under_calibration_net/prepare_local.sh @@ -12,9 +12,11 @@ set -eo pipefail -read -p "Warning, this will erase your ~/.ipc folder, continue (y/n)?" -if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 +if [ -d ~/.ipc ]; then + TIMESTAMP=$(date +%s) + echo "Warning: an existing ~/.ipc folder already exists!" + echo "Renaming ~/.ipc to ~/.ipc.$TIMESTAMP for backup" + mv ~/.ipc ~/.ipc.$TIMESTAMP fi SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) @@ -23,9 +25,6 @@ echo "SCRIPT_DIR: $SCRIPT_DIR" echo "Installing dependencies..." cargo install toml-cli -echo "Removing existing .ipc folder" -rm -rf ~/.ipc - echo "Copying new .ipc folder" cp -r $SCRIPT_DIR/.ipc ~/.ipc