- About
- Blogs
- Programming
- Shell scripts
- Shell Script For Creating Virtual Drupal Hosts From Single Codebase
- Shell Script For Downloading and Installing Drupal Themes
- Shell Script for Creating Virtual Drupal Hosts From Standalone Codebase
- Shell script for downloading and installing Drupal modules
- Simple Backup Shell Script For Apache Conf And SQL Databases and Home
- Drupal Modules
- Jobnet Script
- Shell scripts
- Site map
- Contact
Shell Script For Downloading and Installing Drupal Themes
#!/bin/bash
###################################################
#
# Got tired of downloading / unpacking / moving
# when I tested Drupal themes. So I made a
# Small shell script for downloading drupal themes
# And placing them in your modules folder
# Edit:
# theme_dir=./yoursite/themes/
#
# Usage: ./drupal-theme-install.sh
# Enter module URL to fetch and theme will be
# installed
#
###################################################
###################################################
#
# Conf: Edit next line
# Place to put the downloaded modules
# Your Drupal modules folder
#
###################################################
theme_dir="/home/dennis/www/www.os-cms.net/htdocs/themes/"
###################################################
echo "Enter URL with theme to fetch and install"
echo "(Just copy the link location on the druapl site)"
echo "Example:"
echo "http://ftp.drupal.org/files/projects/zubrick-6.x-1.1.tar.gz"
read package
echo "Fetching package $package"
wget $package
#split url with "/" to get package name
#eg.: http://ftp.drupal.org/files/projects/blocks404-6.x-1.0.tar.gz
#will now split in 6 pieces for every piece seperated by /
#package name is in last element ${arr[5]}
IFS="/"
set -- $package
arr=( $package )
IFS=""
package_file=${arr[5]}
#extract
echo "extracting package"
tar xfz $package_file
echo "Done extracting"
#will now split package name and find directory name to be moved
#will place module in ${arr[0]}
IFS="-"
set -- $package_file
arr=( $package_file )
IFS=""
#move the module dir to modules
module=${arr[0]}
#echo "Moving $module to $module_dir"
mv ./$module $theme_dir
#clean up
echo "Removing $package_file"
rm $package_file
echo "Done"
echo "Go to your site and enable your new theme!"
exit 0
###################################################
#
# Got tired of downloading / unpacking / moving
# when I tested Drupal themes. So I made a
# Small shell script for downloading drupal themes
# And placing them in your modules folder
# Edit:
# theme_dir=./yoursite/themes/
#
# Usage: ./drupal-theme-install.sh
# Enter module URL to fetch and theme will be
# installed
#
###################################################
###################################################
#
# Conf: Edit next line
# Place to put the downloaded modules
# Your Drupal modules folder
#
###################################################
theme_dir="/home/dennis/www/www.os-cms.net/htdocs/themes/"
###################################################
echo "Enter URL with theme to fetch and install"
echo "(Just copy the link location on the druapl site)"
echo "Example:"
echo "http://ftp.drupal.org/files/projects/zubrick-6.x-1.1.tar.gz"
read package
echo "Fetching package $package"
wget $package
#split url with "/" to get package name
#eg.: http://ftp.drupal.org/files/projects/blocks404-6.x-1.0.tar.gz
#will now split in 6 pieces for every piece seperated by /
#package name is in last element ${arr[5]}
IFS="/"
set -- $package
arr=( $package )
IFS=""
package_file=${arr[5]}
#extract
echo "extracting package"
tar xfz $package_file
echo "Done extracting"
#will now split package name and find directory name to be moved
#will place module in ${arr[0]}
IFS="-"
set -- $package_file
arr=( $package_file )
IFS=""
#move the module dir to modules
module=${arr[0]}
#echo "Moving $module to $module_dir"
mv ./$module $theme_dir
#clean up
echo "Removing $package_file"
rm $package_file
echo "Done"
echo "Go to your site and enable your new theme!"
exit 0