Created
April 15, 2010 01:42
-
-
Save quiptime/366585 to your computer and use it in GitHub Desktop.
Script to provide Drupal 7 installation requirements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# drupalir.sh, v 0.9.1 | |
# | |
# Supplied by Quiptime Group | |
# Developed 2010 by Siegfried Neumann <quiptime@gmail.com> | |
# | |
# This file is free software; | |
# you can redistribute it and/or modify it under the terms of the GNU | |
# General Public License as published by the Free Software Foundation. | |
# This script is distributed in the hope that it will be useful, but | |
# WITHOUT ANY WARRANTY of any kind. | |
# | |
# description: Script to provide Drupal 7 installation requirements. | |
# installation: Put the script in an Drupal root directory and make it executable. | |
# | |
### BEGIN INIT INFO | |
# Provides: An Drupal 7 installation. | |
# Description: Script to provide Drupal 7 installation requirements. | |
### END INIT INFO | |
PATH=/bin:/usr/bin | |
SCRIPT=drupalir.sh | |
VERSION=0.9 | |
CPATH=sites/default | |
# Writable directories | |
DIR1=$CPATH/files | |
DIR2=$CPATH/private/files | |
DIR3=$CPATH/private/temp | |
# Configuration file | |
CONFFILE1=default.settings.php | |
CONFFILE2=settings.php | |
# Simple, minimal requirement check. | |
requirement_check() { | |
# Check for modules directory. | |
if [ ! -e "modules" ]; then | |
echo "ERROR: No Drupal installation found.\n" | |
exit 1 | |
fi | |
} | |
case "$1" in | |
create) | |
requirement_check; | |
echo "Starting directory creation:" | |
/bin/mkdir -m 777 -v $DIR1 | |
/bin/mkdir -p -m 777 -v $DIR2 | |
/bin/mkdir -p -m 777 -v $DIR3 | |
echo "Create configuration file:" | |
/bin/cp -v $CPATH/$CONFFILE1 $CPATH/$CONFFILE2 | |
/bin/chmod -v 777 $CPATH/$CONFFILE2 | |
;; | |
post) | |
requirement_check; | |
/bin/chmod -v 644 $CPATH/$CONFFILE2 | |
;; | |
help) | |
echo "$SCRIPT, version $VERSION, help\n" | |
echo "Put the script in an Drupal root directory." | |
echo "This is the same place as the files install.php and update.php.\n" | |
echo "Use ./drupalir.sh create\n" | |
echo "This will create the directories\n" | |
echo " $DIR1" | |
echo " $DIR2" | |
echo " $DIR3\n" | |
echo "and sets its write permissions to 0777 (rwxrwxrwx) - world writable." | |
echo "The configuration file\n" | |
echo " $CPATH/$CONFFILE2\n" | |
echo "will be created and set its write permissions to 0777 (rwxrwxrwx).\n" | |
echo "Use ./drupalir.sh post\n" | |
echo "Use this parameter if the Drupal installation is finished." | |
echo "This will set back the write permissions of the file $CONFFILE2 to 0644 (rw-r--r--).\n" | |
;; | |
*) | |
echo "Usage: $0 {create|post|help}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment