-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall3.sh
More file actions
executable file
·75 lines (55 loc) · 2.28 KB
/
install3.sh
File metadata and controls
executable file
·75 lines (55 loc) · 2.28 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
echo "running install3.sh"
echo "current working directory:"
pwd
echo "deb http://http://ftp.osuosl.org/pub/cran/bin/linux/ubuntu trusty/" >> ./sources.list.appendme
sudo cat /etc/apt/sources.list ./sources.list.appendme > ./sources.list.tmp
sudo cp ./sources.list.tmp /etc/apt/sources.list
rm ./sources.list.appendme
sudo apt-get update
sudo apt-get -y install r-base
sudo apt-get -y install r-base-dev
#create a R library for the user:
echo R_LIBS_USER=\"~/lib/R/library\" > ~/.Renviron
sudo mkdir ~/lib/R/library
sudo cp ./Rprofile ~/.Rprofile
#install java so that some r packages will work.
#https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
#installing the needed development kit
#for xls import
sudo apt-get -y install default-jdk
if [ -e ./hackoregon.sql.bz2 ]
then
echo "hackoregon.sql.bz2 found"
else
echo "hackoregon.sql.bz2 not found, downloading..."
wget http://s3-us-west-2.amazonaws.com/mp-orestar-dump/hackoregon.sql.bz2
fi
echo "Current working directory:"
pwd
sudo mkdir ~/data_infrastructure
sudo cp ./hackoregon.sql.bz2 ~/data_infrastructure/hackoregon.sql.bz2
sudo chmod 755 ./buildoutFromGitRepo.sh
sudo ./buildOutFromGitRepo.sh
sudo ./setPermissionsForCronTab.sh
# cd ~
# cwd=$(pwd)
# datadir="${cwd}/data_infrastructure"
# cd $datadir
cd ~/data_infrastructure
echo "install3.sh changed the working directory to:"
pwd
sudo bunzip2 ./hackoregon.sql.bz2
sudo -u postgres psql -c 'CREATE DATABASE hackoregon;'
sudo -u postgres psql hackoregon < ./hackoregon.sql
sudo -u postgres psql hackoregon < ./trimTransactionsTable.sql
sudo -u postgres psql hackoregon -c 'CREATE TABLE raw_committee_transactions_errors AS SELECT * FROM raw_committee_transactions LIMIT 0;'
sudo -u postgres psql hackoregon < ./makeImportDatesTable.sql
sudo -u postgres psql hackoregon < ./makeAccessLogTable.sql
sudo -u postgres createlang plpgsql
# sudo -u postgres psql hackoregon < ./campaign_detail.sql #will try building this on the fly...
sudo -u postgres psql -c "alter user postgres password 'points';"
sudo chmod 755 ./orestar_scrape/bulkAddTransactions.R
sudo ./orestar_scrape/bulkAddTransactions.R ~/data_infrastructure/successfullyMerged/joinedTables.tsv skipRebuild
sudo chmod 755 ./buildOutDBFromRawTables.sh
sudo ./buildOutDBFromRawTables.sh