-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-provision.sh
executable file
·34 lines (28 loc) · 1.58 KB
/
post-provision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Make a temporary directory for populating the database
mkdir /tmp/populate
cd /tmp/populate
explorer .
# Partially download sources. Remove the pipe to "head -n xxx" if you want the full database.
# This is not recommended as that means you'll have to manually enter indexing commands
# in couchbase's console to have any meaningful performance (but it can be done).
curl ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/nhanes3/1A/exam.dat | head -n 500 > exam.dat
curl ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/nhanes3/1A/youth.dat | head -n 200 > youth.dat
curl ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/nhanes3/1A/adult.dat | head -n 200 > adult.dat
# Download and unpack the raw spirometry data. It's packed in an exe so that's
# the reason behind this fuckery. Again, remove lines 18 and 19 to get the full file.
curl -OkL ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/nhanes/nhanes3/9A/nh3spiro.exe
7z e nh3spiro.exe
mv NH3SPIRO.CSV NH3SPIRO.trimme
cat NH3SPIRO.trimme | head -n 1330 > NH3SPIRO.CSV
# We move the PopulateCouch executable into the directory, pass it the files it needs,
# let it do its thing.
cp /vagrant/PopulateCouch/PopulateCouch/PopulateCouch/bin/Debug/* .
mono PopulateCouch.exe NH3SPIRO.CSV adult.dat youth.dat exam.dat
# Clean up our mess. This is strictly speaking not necessary since we're on a tmpfs. Can't hurt though.
cd /tmp
rm -rf populate
# Congratulate user on managing to get this broken mess to work.
cowsay "Website is now online at http://localhost/ .
Follow the instructions in README.md to
figure out how to use the damn thing."