Skip to content

Commit

Permalink
setup: Add a failsafe while updating
Browse files Browse the repository at this point in the history
Signed-off-by: Saalim Quadri <[email protected]>
  • Loading branch information
danascape committed Oct 8, 2023
1 parent a68fe58 commit 541807b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ sworkflow_update_files()
{
echo "sworkflow: Updating files"
echo "sworkflow: Fetching Updates"
git clone --depth 1 https://github.com/danascape/sworkflow /tmp/sworkflow
cd /tmp/sworkflow
git clone --depth 1 https://github.com/danascape/sworkflow /tmp/sworkflow || trigger_error
cd /tmp/sworkflow || trigger_error
./setup.sh i
rm -rf /tmp/sworkflow
}
Expand All @@ -66,6 +66,7 @@ sworkflow_synchronize_files()

if [[ -z "$(which bash)" ]]; then
echo "error: No bash"
trigger_error
else
if [[ -f "$HOME/.bashrc" ]]; then
update_path '.bashrc'
Expand All @@ -75,6 +76,12 @@ sworkflow_synchronize_files()
fi
}

trigger_error()
{
echo "sworkflow: Failed to install"
exit 1
}

update_path()
{
local shellrc=${1:-'.bashrc'}
Expand Down

0 comments on commit 541807b

Please sign in to comment.