Skip to content

Commit d3c8437

Browse files
Update setup.sh
1 parent f85e7d9 commit d3c8437

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

setup.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,17 @@ install_from_git() {
505505

506506
log "Cloning the $APP_NAME repository from GitHub..."
507507
create_and_own_dir "$GIT_INSTALL_DIR"
508+
check_conda # check if conda is installed
509+
508510
if ! git clone $FULL_GIT_URL "$GIT_INSTALL_DIR"; then
509511
log "ERROR" "Failed to clone the repository. Please check your internet connection and the branch name, and try again."
510512
exit 1
511513
fi
512514

513515
log "Repository cloned successfully."
514516

517+
install_conda_env # if conda is installed then install the conda environment
518+
515519
# Change to the installation directory
516520
cd "$GIT_INSTALL_DIR" || {
517521
log "ERROR" "Failed to navigate to the installation directory.";
@@ -556,6 +560,9 @@ install_from_release() {
556560
rm "$DOWNLOAD_DIR/systemguard.zip"
557561
log "Extraction completed."
558562

563+
check_conda # check if conda is installed
564+
install_conda_env # if conda is installed then install the conda environment
565+
559566
install_executable
560567
setup_cron_job
561568

@@ -573,8 +580,6 @@ display_credentials() {
573580
# Install function
574581
install() {
575582
log "Starting installation of $APP_NAME..."
576-
check_conda # check if conda is installed
577-
install_conda_env # if conda is installed then install the conda environment
578583
create_and_own_dir "$EXTRACT_DIR"
579584
echo ""
580585
echo "Do you want to install from a Git repository or a specific release?"
@@ -727,6 +732,7 @@ show_installer_logs() {
727732

728733
update_dependencies() {
729734
# Activate Conda environment
735+
check_conda
730736
source "$CONDA_SETUP_SCRIPT"
731737
conda activate "$CONDA_ENV_NAME" || { log "ERROR" "Failed to activate Conda environment $CONDA_ENV_NAME"; exit 1; }
732738

@@ -793,9 +799,23 @@ install_latest() {
793799
cd $EXTRACT_DIR/$APP_NAME-*/
794800
# check if the .git directory exists
795801
if [ -d ".git" ]; then
796-
log "Updating the code to the latest version..."
797-
git pull
798-
log "Code updated successfully."
802+
log "Fetching the server for the latest version..."
803+
# sleep 3 seconds
804+
# some kind of animation of fetching the latest code
805+
echo -n "connecting to the SystemGuard server"
806+
for i in {1..3}; do
807+
echo -n "..."
808+
sleep 1
809+
done
810+
echo ""
811+
echo -n "connected now fetching the latest code"
812+
for i in {1..3}; do
813+
echo -n "..."
814+
sleep 1
815+
done
816+
echo ""
817+
git pull >> /dev/null 2>&1 || { log "ERROR" "Failed to update the code. Please check your internet connection and try again."; exit 1; }
818+
log "Hurray: Code updated successfully."
799819
else
800820
log "Probably you have installed the code from the release, so you can't update the code."
801821
log "Please install the code from the git repository to update the code."
@@ -899,7 +919,3 @@ case $ACTION in
899919
update_dependencies) update_dependencies ;;
900920
*) echo "No action specified. Use --help for usage information." ;;
901921
esac
902-
903-
904-
# check conda is there or not in fix
905-
# argument to update manually

0 commit comments

Comments
 (0)