Last active
April 14, 2017 13:24
-
-
Save vishalbasnet23/309c11369cfe5b63f199 to your computer and use it in GitHub Desktop.
Cloning repo and installing WordPress and gitignore file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -eq 1 ]; then | |
if [ -d "$1" ]; then | |
# Control will enter here if $DIRECTORY exists. | |
echo "Repository $1 already exists" | |
exit 0 | |
fi | |
printf "Are you cloning empty repo \n 1. Yes \n 2. No \n" | |
read repo_status | |
echo $repo_status | |
if [ $repo_status -eq 1 ]; then | |
echo "Creating Database" | |
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS $1" | |
git clone ssh://{user}@{IP}:{2014}/{repo_path}/$1.git | |
chmod -R 775 $1 | |
cd $1 | |
cp /var/www/html/gitessentials/.gitignore . | |
git add . | |
git commit -m "Added gitignore file" | |
git push origin master | |
wget wordpress.org/latest.tar.gz | |
tar -zxvf latest.tar.gz | |
cp -r /var/www/html/$1/wordpress/* . | |
rm -r wordpress | |
rm latest.tar.gz | |
git add . | |
git commit -m "Wordpress installed" | |
git push origin master | |
cd /var/www/html/$1/wp-content/ | |
mkdir uploads | |
chmod -R 777 uploads | |
cd /var/www/html/$1/ | |
cp wp-config-sample.php wp-config.php | |
touch .htaccess | |
chmod 777 .htaccess | |
echo "You have successfully cloned and installed WordPress to the server" | |
elif [ $repo_status -eq 2 ]; then | |
git clone ssh://[email protected]:2014/home/www/git/$1.git | |
cd $1 | |
cp wp-config-sample.php wp-config.php | |
vim wp-config.php | |
touch .htaccess | |
chmod 777 .htaccess | |
echo "You have successfully cloned existing repo with its content" | |
else | |
echo "Invalid Input" | |
exit 0 | |
fi | |
else | |
echo "Invalid Name" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment