Skip to content

Commit

Permalink
Most recent version of build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
DAWacker committed Nov 11, 2013
1 parent 5083838 commit d931a4b
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,63 @@
if [ -e /run/media/$USER/* ]; then

# Build the .xo file
echo 'Found external device.'
echo 'Building xo file...'
./setup.py dist_xo
file=dist/*.xo
$(echo $file | cut -f1 -d-)

# Check if the file already exists
if [ -e /run/media/$USER/*/$file ]; then
echo 'Removing version on device...'
rm /run/media/$USER/*/$file
fi
fi

# Move the new file onto the external device
echo 'Moving xo file to device...'
mv $file /run/media/$USER/*/
rm -rf dist/
echo 'Cleaning up...'
rm -r dist/

# Notify the user a device was not found
else
echo 'No external device found.'
echo 'Building xo file...'
./setup.py dist_xo
file=dist/*.xo
activity=$(echo $(echo $file | cut -f1 -d-) | cut -f2 -d/)

# Check if there is a current version of the xo file in your directory
if [ -e ./$activity-*.xo ]; then
# Prompt the user if they would like to replace the file or not
echo -n 'Would you like to replace the current xo file? [y/n]: '
read answer

# Notify the user a device was not found
# If the user wants to replace the file, replace it
if [ "$answer" == "y" ]; then
echo 'Removing previous version...'
rm ./$activity-*.xo
mv dist/* ./

# If the user does not want to replace the file,
# save the old one and create the new file
elif [ "$answer" == "n" ]; then
old=$activity-*.xo
mv ./$old ./$activity.old.xo
mv ./$file ./$activity.new.xo

else
echo 'Invalid input.'
echo 'Aborting.'
rm -r dist/
exit 1
fi
else
echo 'No external device found.'
mv dist/* ./
fi

echo 'Cleaning up...'
rm -r dist/
fi

echo 'Finished!'

0 comments on commit d931a4b

Please sign in to comment.