build/drupal/installDrupal.sh
author ymh <ymh.work@gmail.com>
Fri, 17 Nov 2017 09:10:41 +0100
changeset 558 64c4050f6a36
parent 553 251df6cb3afa
child 561 bb2cb0fad904
permissions -rwxr-xr-x
small correction
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     1
#!/bin/bash
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
#
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
clear
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
TARFILE=sources.tar.gz
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     5
DUMP=corpusdelaparole.sql
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     6
APUSER=apache
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     7
APGROUP=apache
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     8
# Variable de configuration à modifier selon vos besoins
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
     9
#########################################################
558
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    10
ROOT=/var/www/corpusdelaparole/drupal
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
#########################################################
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
splashTitle() {
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
cat <<"EOT"
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    14
                __ _   _____                         _    _____      _
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    15
               / _(_) |  __ \                       | |  / ____|    | |
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    16
          __ _| |_ _  | |  | |_ __ _   _ _ __   __ _| | | (___   ___| |_ _   _ _ __
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    17
         / _` |  _| | | |  | | '__| | | | '_ \ / _` | |  \___ \ / _ \ __| | | | '_ \
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    18
        | (_| | | | | | |__| | |  | |_| | |_) | (_| | |  ____) |  __/ |_| |_| | |_) |
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    19
         \__, |_| |_| |_____/|_|   \__,_| .__/ \__,_|_| |_____/ \___|\__|\__,_| .__/
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    20
          __/ |                         | |                                   | |
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    21
         |___/                          |_|                                   |_|
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    22
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
EOT
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
}
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
splashTitle
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    27
export DRUSH_OPTIONS="-q"
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
echo "--------------------------- PARAMETRES D'INSTALLATION -------------------------------------------------------"
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    29
echo "------------ A modifier dans le fichier sites/default/settings.php au besoin --------------------------------"
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
echo "-------------------------------------------------------------------------------------------------------------"
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    31
drush -r "$ROOT" sql-conf
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
echo "-------------------------------------------------------------------------------------------------------------"
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
echo "-------------------------------------------------------------------------------------------------------------"
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
read -r -p "Etes-vous sur(e) de vouloir installer avec les paramètres ci dessus ? [Oui/n]" response
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 response=${response,,} # tolower
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    36
 if [[ $response =~ ^(oui|o| ) ]]; then
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    37
    #
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    38
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    39
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    40
    echo "-------------------- Installation du site corpus de la parole -----------------------------------------------"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    41
    echo "-------------------------------------------------------------------------------------------------------------"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    42
    #
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    43
    # Errors are fatal
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    44
    #
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    45
    set -e
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    47
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    48
    echo "Copie des sources et du dump SQL dans $ROOT"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    49
    echo "-------------------------------------------"
558
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    50
    if [ -f "$TARFILE" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    51
        echo "cp $TARFILE $ROOT/$TARFILE"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    52
        cp "$TARFILE" "$ROOT/$TARFILE"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    53
    fi
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    54
    if [ -f "$DUMP" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    55
        echo "cp $DUMP $ROOT/$DUMP"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    56
        cp "$DUMP" "$ROOT/$DUMP"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    57
    fi
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    58
    echo ">> Copie effectuée avec succès"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    59
    echo ""
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    61
    cd "$ROOT"
558
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    62
    if [ -f "$TARFILE" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    63
        echo "Extraction des sources dans $ROOT"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    64
        echo "---------------------------------"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    65
        echo "tar -xf $TARFILE --strip 1"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    66
        tar -xf "$TARFILE" --strip 1
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    67
        echo ">> Extraction effectuée avec succès"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    68
        echo ""
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    69
    fi
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    70
558
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    71
    if [ -f "$DUMP" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    72
        echo ""
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    73
        echo "Vidage de la base de données"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    74
        echo "------------------------------------------------"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    75
        echo "drush -r $ROOT sql-drop -y"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    76
        drush -r "$ROOT" sql-drop -y
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    77
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    78
        echo ""
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    79
        echo "Restauration du dump de bdd dans la base de données"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    80
        echo "------------------------------------------------"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    81
        echo "drush -r $ROOT sql-cli < $DUMP"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    82
        drush -r "$ROOT" sql-cli < $DUMP
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
    83
    fi
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    85
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    86
    echo "Application des mises à jour de base de données si besoin"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    87
    echo "------------------------------------------------"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    88
    echo "drush -r $ROOT updb -y"
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    89
    drush -r "$ROOT" updb -y
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    91
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    92
    echo "Vidage des tables accesslog,search_dataset,search_index,search_total,sessions,watchdog"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
    93
    echo "--------------------------------------------------------------------------------------"
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    94
    drush -r "$ROOT" sql-query "TRUNCATE TABLE accesslog"
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    95
    drush -r "$ROOT" sql-query "TRUNCATE TABLE search_dataset"
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    96
    drush -r "$ROOT" sql-query "TRUNCATE TABLE search_index"
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    97
    drush -r "$ROOT" sql-query "TRUNCATE TABLE search_total"
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    98
    drush -r "$ROOT" sql-query "TRUNCATE TABLE sessions"
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
    99
    drush -r "$ROOT" sql-query "TRUNCATE TABLE watchdog"
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   100
    echo ">> Restauration effectuée avec succès"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   101
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   102
    echo "Suppression de l'archive tar et du dump"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   103
    echo "-----------------------------------------------------"
558
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   104
    if [ -f "$TARFILE" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   105
        rm "$ROOT/$TARFILE"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   106
    fi
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   107
    if [ -f "$DUMP" ]; then
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   108
        rm "$ROOT/$DUMP"
64c4050f6a36 small correction
ymh <ymh.work@gmail.com>
parents: 553
diff changeset
   109
    fi
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   110
    echo ">> Suppression effectuée avec succès"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   111
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   112
    echo "Attribution des droits apache (httpd) sur les sources"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   113
    echo "-----------------------------------------------------"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   114
    echo "chown -R $APUSER:$APGROUP $ROOT/*"
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
   115
    chown -R $APUSER:$APGROUP "$ROOT/*"
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   116
    echo ">> Droits apache attribués avec succès"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   117
    echo ""
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   119
    echo "Vidage des caches Drupal"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   120
    echo "-----------------------------------------------------"
553
251df6cb3afa upgrade drupal with the new tresor theme
ymh <ymh.work@gmail.com>
parents: 541
diff changeset
   121
    drush -r "$ROOT" cc all
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   122
    set -e
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   123
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   124
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   125
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   126
    echo ">>>>>>>>>>>>>> INSTALLATION EFFECTUEE AVEC SUCCESS"
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   127
    echo ""
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 491
diff changeset
   128
    echo ""
428
76a47f714766 add memcached configuration option, small corrections for the build process and add installDrupal.sh file to the release
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
 fi