Skip to content

Instantly share code, notes, and snippets.

@robballou
Created February 19, 2013 18:34
Show Gist options
  • Save robballou/4988578 to your computer and use it in GitHub Desktop.
Save robballou/4988578 to your computer and use it in GitHub Desktop.
#!/bin/bash
# create an empty shell module
if [[ $# -ne 1 ]]; then
echo 'Usage: drupal_make_module.sh [module_name]'
exit 1
fi
if [[ ! -d sites/all/modules ]]; then
echo 'sites/all/modules does not exist'
exit 1
fi
if [[ ! -d sites/all/modules/custom ]]; then
mkdir 'sites/all/modules/custom'
fi
MODULE_DIR=sites/all/modules/custom/$1
if [[ -d $MODULE_DIR ]]; then
echo "$MODULE_DIR already exists"
exit 1
fi
mkdir $MODULE_DIR
touch $MODULE_DIR/{$1.info,$1.module}
echo '<?php' >> $MODULE_DIR/$1.module
echo 'name = ' $1 >> $MODULE_DIR/$1.info
echo 'description = ' >> $MODULE_DIR/$1.info
echo 'core = 7.x' >> $MODULE_DIR/$1.info
#!/bin/bash
# initial setup for a new Drupal install
# - Create the files directory and make it world writable (needs to change)
# - Create the settings file and make it world writable
mkdir sites/default/files
chmod 777 sites/default/files
cp sites/default/default.settings.php sites/default/settings.php
chmod 777 sites/default/settings.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment