61 lines
1.8 KiB
Bash
Executable File
61 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Set CryoSPARC installation directory
|
|
CRYOSPARC_HOME="/data/user/$USER/cryosparc"
|
|
|
|
# Check that CRYOSPARC_HOME is set and directory exists
|
|
if [ -z "$CRYOSPARC_HOME" ]; then
|
|
echo "Error: CRYOSPARC_HOME is not set."
|
|
return 1
|
|
fi
|
|
|
|
if [ ! -d "$CRYOSPARC_HOME" ]; then
|
|
echo "Error: CRYOSPARC_HOME directory '$CRYOSPARC_HOME' does not exist."
|
|
return 1
|
|
fi
|
|
|
|
cd "$CRYOSPARC_HOME" || { echo "Failed to change directory to $CRYOSPARC_HOME"; return 1; }
|
|
|
|
# Check if 'config' directory already exists
|
|
if [ -d "config/.git" ]; then
|
|
echo "'config' directory already exists. Attempting to pull latest changes..."
|
|
cd config || { echo "Failed to change directory to config"; return 1; }
|
|
|
|
# Check if we're on the correct branch
|
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
if [ "$current_branch" != "merlin7" ]; then
|
|
echo "Switching to 'merlin7' branch..."
|
|
git fetch origin merlin7 && git checkout merlin7 || { echo "Failed to switch to merlin7 branch"; return 1; }
|
|
fi
|
|
|
|
git pull || { echo "Git pull failed."; return 1; }
|
|
echo "Repository updated successfully."
|
|
else
|
|
echo "Cloning merlin7 branch of merlin-cryosparc into 'config' directory..."
|
|
if git clone -b merlin7 git@gitea.psi.ch:CLS-IT/merlin-cryosparc.git config; then
|
|
echo "Clone successful."
|
|
else
|
|
echo "Git clone failed."
|
|
return 1
|
|
fi
|
|
fi
|
|
|
|
# Define remote host
|
|
remote_host="merlin7-cryosparc01.psi.ch"
|
|
|
|
echo "Running install_filter on remote host..."
|
|
if ssh "$USER@$remote_host" install_filter; then
|
|
echo "install_filter command completed successfully."
|
|
else
|
|
echo "install_filter command failed."
|
|
return 1
|
|
fi
|
|
|
|
echo "Running connect_all on remote host..."
|
|
if ssh "$USER@$remote_host" connect_all; then
|
|
echo "connect_all command completed successfully."
|
|
else
|
|
echo "connect_all command failed."
|
|
return 1
|
|
fi
|