2. What is a Distribution?
• Drupal Installation profiles are pre-
packaged website solutions for specific use
cases.
• They include Drupal core as well as
additional modules.
3. Confusing Terminology
• Distributions are often called
Installation Profiles (on the
Drupal.org download page among places)
4. Installation Profiles vs
Distributions
• Installation profiles are scripts that
run once when Drupal is installed.
Installation profiles provide an installation
process that differs from the default install.
• Distributions are full copies of Drupal
that include extra things aren't in the
regular Drupal download. These extras
typically include installation profiles and
additional modules and themes.
5. History
• Support for custom Installation Profiles was
added in Drupal 5
• Until recently downloading an Installation
Profile from Drupal.org was just that, an
Installation Profile
• The Drupal.org packaging script now
automatically packages core and contrib
modules into a Distribution
10. Why Build a
Distribution?
• Building multiple similar sites
• Giving back to the community
• Encouraging community involvement with
your project
11. Components
Distribution
Contrib Custom
Drupal Installation
Modules & Modules &
Core Profile
Themes Themes
Including Features Modules
12. Steps to Creating a
Distribution
• Build a new Drupal site to use as a template
• Move configuration (node types, views, etc.) into code
(Features modules)
• Create an Installation Profile for setting up a new site
• Create a .make file for downloading resources
• Test and Release
15. Creating an Installation
Profile
/**
* Implement hook_install().
*
* Perform actions to set up the site for this profile.
*/
function mydistro_install() {
include_once DRUPAL_ROOT . '/profiles/standard/standard.install';
standard_install();
// Do other things here. For example, let’s change the theme:
theme_enable(array('photoblog', 'seven'));
variable_set('theme_default', 'photoblog');
variable_set('admin_theme', 'seven');
}
16. Drush and Drush Make
• Drush is a command line tool for Drupal:
http://drupal.org/project/drush
• Drush Make is an extension to Drush:
http://drupal.org/project/drush_make
17. Create a .make file
• This tells the Drupal.org packaging script
which contrib modules and themes to
include in your distribution
• Can be make-generate mydistro.make
drush
created automatically:
18. Make File Format
; $Id$
;
; Example makefile
; ----------------
; This is an example makefile to introduce new users of drush_make to the
; syntax and options available to drush_make. For a full description of all
; options available, see README.txt.
; This make file is a working makefile - try it! Any line starting with a `;`
; is a comment.
; Core version
; ------------
; Each makefile should begin by declaring the core version of Drupal that all
; projects should be compatible with.
core = 6.x
; API version
; ------------
; Every makefile needs to declare it's Drush Make API version. This version of
; drush make uses API version `2`.
api = 2
Part 1 of 3
19. ; Core project
; ------------
; In order for your makefile to generate a full Drupal site, you must include
; a core project. This is usually Drupal core, but you can also specify
; alternative core projects like Pressflow. Note that makefiles included with
; install profiles *should not* include a core project.
; Use pressflow instead of Drupal core:
; projects[pressflow][type] = "core"
; projects[pressflow][download][type] = "file"
; projects[pressflow][download][url] = "http://launchpad.net/pressflow/6.x/6.15.73/+download/
pressflow-6.15.73.tar.gz"
; CVS checkout of Drupal 6.x core:
; projects[drupal][type] = "core"
; projects[drupal][download][type] = "cvs"
; projects[drupal][download][root] = ":pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal"
; projects[drupal][download][revision] = "DRUPAL-6"
; projects[drupal][download][module] = "drupal"
; CVS checkout of Drupal 7.x. Requires the `core` property to be set to 7.x.
; projects[drupal][type] = "core"
; projects[drupal][download][type] = "cvs"
; projects[drupal][download][root] = ":pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal"
; projects[drupal][download][revision] = "HEAD"
; projects[drupal][download][module] = "drupal"
projects[] = drupal
Part 2 of 3
20. ; Projects
; --------
; Each project that you would like to include in the makefile should be
; declared under the `projects` key. The simplest declaration of a project
; looks like this:
projects[] = views
; This will, by default, retrieve the latest recommended version of the project
; using its update XML feed on Drupal.org. If any of those defaults are not
; desirable for a project, you will want to use the keyed syntax combined with
; some options.
; If you want to retrieve a specific version of a project:
projects[cck] = 2.6
; Or an alternative, extended syntax:
projects[ctools][version] = 1.3
; Check out the latest version of a project from CVS. Note that when using a
; repository as your project source, you must explictly declare the project
; type so that drush_make knows where to put your project.
projects[data][type] = module
projects[data][download][type] = cvs
projects[data][download][module] = contributions/modules/data
projects[data][download][revision] = DRUPAL-6--1
; Clone a project from github.
projects[tao][type] = theme
projects[tao][download][type] = git
projects[tao][download][url] = git://github.com/developmentseed/tao.git
; If you want to install a module into a sub-directory, you can use the
; `subdir` attribute.
projects[admin_menu][subdir] = custom
; To apply a patch to a project, use the `patch` attribute and pass in the URL
; of the patch.
projects[admin_menu][patch][] = "http://drupal.org/files/issues/admin_menu.long_.31.patch"
Part 3 of 3
22. Testing
(We finally get to use the “Drush Make” command.)
• Put your .make file in a new folder
• Run: drush make mydistro.make
• After the build, put your profile module in
the profiles directory of the new Drupal
site
• Install Drupal, choosing your Installation
Profile
23. Releasing a Distribution
on Drupal.org
From http://drupal.org/node/642116:
• Verify the .make file
• Name the .make file drupal-org.make
• Add the .make file to your Installation Profile
• Create a Drupal project or sandbox page
• Commit your Installation Profile directory to Git
(These steps aren’t necessary if you don’t
release your distribution on Drupal.org)
24. Verifying the Make File
• This tests to ensure the .make file is in the
correct format for Drupal.org
• Run:
drush verify-makefile profiles/mydistro/drupal-org.make
25. Setup a Drupal.org
Project or Sandbox
• Anyone can create a sandbox project
• Sandbox projects can be promoted to full
projects
• Choose “Installation Profile” as the type of
project
26. Get Ready for Release
• Custom module and themes (not released
elsewhere) can be added to the installation
profile in subdirectory: /profiles/mydistro/
modules/myspecialmodule
• Run git init in your installation profile
folder, then follow instructions on your
project/sandbox page to commit your code
and push it to Drupal.org
27. Push your code to
Drupal.org
• The Drupal.org packaging system uses
your .make file to download core and the
contrib module/themes specified
• Your installation profile is moved to a
subdirectory of the build (/profiles/mydistro)
• Contrib modules/themes are put in
/profiles/mydistro/modules and /profiles/
mydistro/themes
28. For More Information
• General information about Distributions
and Installation Profiles: http://drupal.org/
node/1089736
• Drupal Groups for Distributions: http://
drupal.org/node/1089736
• Releasing a Distribution on Drupal.org:
http://drupal.org/node/642116