/[drupal]/contributions/sandbox/yaph/scripts/drupal_install.sh
ViewVC logotype

Contents of /contributions/sandbox/yaph/scripts/drupal_install.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Fri Jan 30 17:43:28 2009 UTC (9 months, 3 weeks ago) by yaph
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +3 -5 lines
File MIME type: application/x-shellscript
removed unnecessary sql statements
1 #!/bin/bash
2 # $Id: drupal_install.sh,v 1.2 2009/01/30 16:35:53 yaph Exp $
3
4 # check for user input
5 if [ ! $@ ]; then
6 echo "Example usage:"
7 echo "$0 drupal69 6.9"
8 exit 0
9 fi
10
11 NAME=$1
12 VERSION=$2
13
14 INSTALL_DIR="/var/www"
15 DRUPAL_DIR="${INSTALL_DIR}/${NAME}"
16
17 if [ -d $DRUPAL_DIR ]; then
18 echo "$DRUPAL_DIR exists!"
19 exit 0
20 fi
21
22 DRUPAL_VERSION="drupal-${VERSION}"
23 DRUPAL_PACKAGE="${DRUPAL_VERSION}.tar.gz"
24
25 echo "Installing in: $INSTALL_DIR"
26 cd $INSTALL_DIR
27
28 # example download link http://ftp.drupal.org/files/projects/drupal-6.9.tar.gz
29 DOWNLOAD="http://ftp.drupal.org/files/projects/${DRUPAL_PACKAGE}"
30 echo "Drupal download link: $DOWNLOAD"
31 echo "Start downloading $DRUPAL_PACKAGE"
32 wget $DOWNLOAD
33
34 tar xzf $DRUPAL_PACKAGE
35 mv $DRUPAL_VERSION $NAME
36
37 echo "creating module, theme, and files directories"
38 mkdir $DRUPAL_DIR/sites/all/modules
39 mkdir $DRUPAL_DIR/sites/all/themes
40 mkdir $DRUPAL_DIR/sites/default/files
41 chmod -R 777 $DRUPAL_DIR/sites/default/files
42
43 cp $DRUPAL_DIR/sites/default/default.settings.php $DRUPAL_DIR/sites/default/settings.php
44 chmod 666 $DRUPAL_DIR/sites/default/settings.php
45
46 # assuming mysql root user has no password set
47 echo "creating database and granting privileges to db user"
48 mysql -uroot -e "DROP DATABASE IF EXISTS $NAME;"
49 mysql -uroot -e "CREATE DATABASE $NAME;"
50 mysql -uroot -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON $NAME.* TO '$NAME'@'localhost' IDENTIFIED BY '$NAME';"
51 mysql -uroot -e "FLUSH PRIVILEGES;"
52
53 echo "Finished file system and database installation"
54 echo "Open your browser and go to http://localhost/$NAME"

  ViewVC Help
Powered by ViewVC 1.1.2