Projet

Général

Profil

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

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

1 5fbc698e Julien Enselme
#!/bin/sh
2
3 15ed27d8 Julien Enselme
usage() {
4
    help=<<EOF
5
Generate nginx map from Drupal's sites.php.
6 73a967a6 Julien Enselme
7 15ed27d8 Julien Enselme
No option required.
8 5fbc698e Julien Enselme
9
The left part of the map is $http_host$uri.
10
The right part is $subdir.
11
EOF
12 15ed27d8 Julien Enselme
    echo -e "${help}"
13
}
14
. /home/assos/bin/print-help-if-required.sh
15
16
17
. /home/assos/bin/scripts-config.sh
18 5fbc698e Julien Enselme
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 7c435b4e Julien Enselme
 sed 's/ assos.centrale-marseille.fr\./	/; s/assos.centrale-marseille.fr\./~*^assos.centrale-marseille.fr\//; s/	/\/\.\*\$	\//; s/$/;/' \
28
 > "${d7_nginx_map_content}"