Shell Script to build sub-theme
Task · automate zen subtheme building · script · subtheme · zen · zen theme · Developers and coders · Themers · Drupal 5.x
Last modified: August 26, 2009 - 20:40
#!/bin/bash
# This script creates a new subtheme for zen following the instructions on drupal.org/node/201423
# Place this file in your zen directory as a file name "subtheme"
# Usage: open a shell, navigate to the zen directory and run ./subtheme
# (Run chmod 700 on this file to make it executable)
echo -n "Enter a machine-readable subtheme name (only lowercase and underscore characters): "
read -e NAME
echo -n "Choose a page layout type (fixed, liquid): "
read -e LAYOUT
if [ $LAYOUT = "fixed" ]; then
CSS="layout-fixed.css"
elif [ $LAYOUT = "liquid" ]; then
CSS="layout-liquid.css"
else
echo Invalid layout type.
exit
fi
cp -r STARTERKIT $NAME
cp $CSS $NAME/layout.css
cp print.css $NAME/print.css
cp zen.css $NAME/$NAME.css
sed 's/STARTERKIT/'$NAME'/g' $NAME/template.php > temp
mv temp $NAME/template.php
sed 's/STARTERKIT/'$NAME'/g' $NAME/theme-settings.php > temp
mv temp $NAME/theme-settings.php
cp page.tpl.php $NAME/page.tpl.php
cp node.tpl.php $NAME/node.tpl.php