Skip to content

Instantly share code, notes, and snippets.

@mahfuzul
Last active August 29, 2015 14:13
Show Gist options
  • Save mahfuzul/15b7ad52e906c4541ee6 to your computer and use it in GitHub Desktop.
Save mahfuzul/15b7ad52e906c4541ee6 to your computer and use it in GitHub Desktop.
setdrupal function download and extract Drupal from https://www.drupal.org
#!/bin/zsh
# @author: Mahfuzul Hasan <mha.cse@gmail.com>
# setdrupal function download and extract Drupal from https://www.drupal.org
# To execute this function run this commands:
# chmod +x setwp.sh
# ./setwp.sh
# or add this file as a source in your .zshrc / .bashrc file " source ~/bin/zsh/setdrupal.sh "
#
setdrupal(){
echo -n "Which version you want to download (ex. 7.34) ? "
read ver
echo -n "Press 1 for .zip or 2 for .tar.gz version "
read zip
echo "Downloading....."
if [ $zip = "1" ]
then
wget --no-check-certificate http://ftp.drupal.org/files/projects/drupal-$ver.zip
echo "Extracting....."
unzip drupal-$ver.zip
elif [ $zip = "2" ]
then
wget --no-check-certificate http://ftp.drupal.org/files/projects/drupal-$ver.tar.gz
echo "Extracting....."
tar -zxvf drupal-$ver.tar.gz
else
wget --no-check-certificate http://ftp.drupal.org/files/projects/drupal-$ver.zip
echo "Extracting....."
unzip drupal-$ver.zip
fi
echo "Moving into public_html....."
mv drupal-$ver/* public_html/.
echo "Removing drupal-$ver.$zip & drupal folder....."
rm -rf drupal-$ver.zip
rm -rf drupal-$ver
echo "Changing dir to public_html"
cd public_html
echo -n "Do you want to create settings.php file? Y/n : "
read cmd
if [ $cmd = "Y" ] || [ $cmd = "y" ]
then
cp sites/default/default.settings.php sites/default/settings.php
echo "settings.php file is created"
else
echo "settings.php file is not created"
fi
echo "Job Done! Have fun"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment