Projet

Général

Profil

Paste
Télécharger (678 octets) Statistiques
| Branche: | Révision:

root / bin / d7-generate-nginx-map.sh @ 7c435b4e

1
#!/bin/sh
2

    
3
. /home/assos/bin/scripts-config.sh
4

    
5
help=<<EOF
6
Generate nginx map from Drupal's sites.php
7

    
8
The left part of the map is $http_host$uri.
9
The right part is $subdir.
10
EOF
11

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