To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / deploy / provision.d / 030-webapp-dir.sh @ 1613:90bed4e10cc8

History | View | Annotate | Download (1019 Bytes)

1 1577:e38eee2e1d47 Chris
#!/bin/bash
2
3
set -e
4
5 1589:94669513c53c Chris
# We might be running in one of two ways:
6
#
7
# 1. The code directory is already at /var/www/code, either because a
8
# previous provisioning step has imported it there or because this
9
# script has been run before -- in this situation all we do is
10
# re-check the ownership and permissions. OR
11
#
12
# 2. The code directory has not yet been copied to /var/www/code, in
13
# which case we expect to find it at /code-to-deploy, e.g. as a
14
# Vagrant shared folder, and we copy it over from there. (We don't
15
# deploy directly from shared folders as we might not be able to
16
# manipulate ownership and permissions properly there.)
17
18 1577:e38eee2e1d47 Chris
if [ ! -d /var/www/code ]; then
19 1587:d8949733849d Chris
    if [ ! -d /code-to-deploy ]; then
20 1589:94669513c53c Chris
        echo "ERROR: Expected to find code tree at /var/www/code or /code-to-deploy: is the deployment script being invoked correctly?"
21 1587:d8949733849d Chris
        exit 2
22
    fi
23
    cp -a /code-to-deploy /var/www/code
24 1577:e38eee2e1d47 Chris
fi
25
26 1587:d8949733849d Chris
chown -R code.www-data /var/www/code
27 1605:18643ab36008 Chris
chmod 755 /var/www/code
28 1587:d8949733849d Chris
find /var/www/code -type d -exec chmod g+s \{\} \;