aboutsummaryrefslogtreecommitdiffhomepage
path: root/deploy.sh
blob: c9671213c9070b04a11fab2f474beee087b6cd5e (plain)
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
#!/bin/bash
. $HOME/.shenv

# simple deploy script: first make sure GHC and cabal are available
# (on the MetaArray, see comproc.org "MetaArray Haskell")

# 1. choose where to deploy

live="$HOME/html/sariul/cgi-bin"
devel="$HOME/html/sariul-devel/cgi-bin"

if [ "$1" = "live" ]; then
    dest="$live"
else
    if [ "$1" = "devel" ]; then
        dest="$devel"
    else
        echo "Please supply one of \`devel', \`live' cmd line args" >&2
        exit 1
    fi
fi

cd ~/src/sariulclocks
mkdir -p $dest

# 2. build our software

if ! [ -d ".cabal-sandbox" ]; then
    cabal sandbox init
fi
cabal install --only-dependencies
cabal configure
cabal build
# TODO: make this build actually work on ma!  Missing librt.  In the
# meantime, manually copy sariulclocks.cgi into place from demeter.

# 3. copy our software into place

cp -RL assets/* assets/.htaccess dist/build/sariulclocks.cgi/sariulclocks.cgi $dest
# TODO: run strip on binary
cp -RL ../schoolclock/sounds $dest

# 4. further permissions & dirs

cd $HOME
# mkhomepg -p
mkdir -p $dest/data
if ! [ -e "$dest/password" ]; then
    echo "dummy_password" > $dest/password
    echo "Please update password in $dest/password!"
fi
chmod 777 $dest/data
chmod 755 $dest/sariulclocks.cgi

# TODO: also put script that resets clocks and deducts points at the
# end of the week into ~/local/bin ready to be cronned