Improvement of the installation script, to allow easier restarts when the install fails

This commit is contained in:
ak6i 2024-05-05 22:42:10 +02:00 committed by GitHub
parent f4d12ec9eb
commit dacae41c9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 12 deletions

View File

@ -142,22 +142,24 @@ print "Installing Open Rowing Monitor, branch $BRANCH..."
if ! [[ -d "${INSTALL_DIR}" ]]; then if ! [[ -d "${INSTALL_DIR}" ]]; then
sudo mkdir -p $INSTALL_DIR sudo mkdir -p $INSTALL_DIR
cd $INSTALL_DIR
# get project code from repository
sudo git init -q
# older versions of git would use 'master' instead of 'main' for the default branch
sudo git checkout -q -b $BRANCH
sudo git config remote.origin.url $GIT_REMOTE
sudo git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
# prevent altering line endings
sudo git config core.autocrlf false
sudo git fetch --force origin
sudo git fetch --force --tags origin
sudo git reset --hard origin/$BRANCH
fi fi
cd $INSTALL_DIR cd $INSTALL_DIR
# get project code from repository
sudo git init -q
# older versions of git would use 'master' instead of 'main' for the default branch
sudo git checkout -q -b $BRANCH
sudo git config remote.origin.url $GIT_REMOTE
sudo git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
# prevent altering line endings
sudo git config core.autocrlf false
sudo git fetch --force origin
sudo git fetch --force --tags origin
sudo git reset --hard origin/$BRANCH
# add bin directory to the system path # add bin directory to the system path
echo "export PATH=\"\$PATH:$INSTALL_DIR/bin\"" >> ~/.bashrc echo "export PATH=\"\$PATH:$INSTALL_DIR/bin\"" >> ~/.bashrc