-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-pi-trump.sh
executable file
·44 lines (35 loc) · 1015 Bytes
/
install-pi-trump.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
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
if [ ! -f config-trump ]; then
echo "config-trump file required"
exit 1
fi
set -ex
REPO_NAME=tbot
BRANCH=master
FILE=$BRANCH.zip
DIR=$REPO_NAME-$BRANCH
[email protected]:willrogers/$REPO_NAME.git
LINK=https://github.com/willrogers/$REPO_NAME/archive/$FILE
PHANTOM_FILE=phantomjs-2.0.0-linux-armv7l.tar.bz2
PHANTOM_TAR=https://github.com/mitghi/phantomjs-2.0.0-armv7/raw/master/$PHANTOM_FILE
wget $LINK
unzip $FILE
cd $DIR
virtualenv --no-site-packages venv
source venv/bin/activate
pip install -r requirements.txt
wget $PHANTOM_TAR
tar xjvf $PHANTOM_FILE phantomjs-2.0.0-linux-armv7l/bin/phantomjs
mv phantomjs-2.0.0-linux-armv7l/bin/phantomjs venv/bin/phantomjs
chmod +x venv/bin/phantomjs
echo
cat > trump.sh <<- EOM
#!/bin/bash
cd $(pwd)
source venv/bin/activate
python tweet.py trump
EOM
chmod +x trump.sh
# Append to cron removing any existing trump crons
(crontab -l | grep -v trump ; echo "00 * * * * $(pwd)/trump.sh >> $(pwd)/trump.log 2>&1") | crontab -
cp ../config-trump .