Skip to content

Commit

Permalink
Added download.sh and modified .gitignore to ignore data directory
Browse files Browse the repository at this point in the history
  • Loading branch information
rbeck4 committed Feb 26, 2019
1 parent 69e0412 commit db62395
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/

# ignore data profiles
DATA/*
42 changes: 42 additions & 0 deletions download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Download the PHOTOCHEMCAD3 database for the user, will unpack it into
# the DATA directory (not tracked by github)

URL="http://www.photochemcad.com/download/PhotochemCAD3.zip"
FLNM=$(basename $URL)
PREFIX=DATA

#make data directory if needed
ls $PREFIX 2>/dev/null
if [[ $? -ne 0 ]]; then
echo "Making $PREFIX directory in $PWD"
mkdir $PREFIX || \
{ echo "Unable to create directory, check permissions" && exit 1; }
else
echo "DATA directory already exists, be careful of existing files"
fi

#Downloading the *.zip archive
which wget 2>/dev/null
if [[ $? -eq 0 ]]; then
wget -P $PREFIX/ $URL ||\
{ echo "Unable to download, check internet and try again" && exit 1; }
else
curl -o $PREFIX/$FLNM $URL ||\
{ echo "Unable to download, check curl installed and internet" && exit 1; }
fi

#Unzipping the *.zip archive
which unzip 2>/dev/null
if [[ $? -eq 0 ]]; then
unzip $PREFIX/$FLNM -d DATA || \
{ echo "Unable to extract, check internet and is zip" && exit 1; }
else
echo "You need to install 'unzip' for this script"
exit 1
fi

#Let user know finished
echo "PHOTOCHEM archive sucessfully downloaded and unziped"
exit 0

0 comments on commit db62395

Please sign in to comment.