Project

General

Profile

Paste
Download (783 Bytes) Statistics
| Branch: | Revision:

root / bin / d7-generate-nginx-map.sh @ eec59787

1
#!/bin/sh
2

    
3
usage() {
4
    help=<<EOF
5
Generate nginx map from Drupal's sites.php.
6

    
7
No option required.
8

    
9
The left part of the map is $http_host$uri.
10
The right part is $subdir.
11
EOF
12
    echo -e "${help}"
13
}
14
. /home/assos/bin/print-help-if-required.sh
15

    
16

    
17
. /home/assos/bin/scripts-config.sh
18

    
19
# Only for sites with url like assos.centrale-marseille.fr/subsite (other sites don't need to be in the map)
20
cut -d"'" -f2,4 "${sites_php}" |\
21
 grep '^assos\.centrale-marseille\.fr\.' |\
22
 # In reverse order.
23
 sort -r |\
24
 # Remove the ' at the end of the line.
25
 sed "s/'/ /" |\
26
 # Put slashes where they are needed (beware of tabs).
27
 sed 's/ assos.centrale-marseille.fr\./	/; s/assos.centrale-marseille.fr\./~*^assos.centrale-marseille.fr\//; s/	/\/\.\*\$	\//; s/$/;/' \
28
 > "${d7_nginx_map_content}"