-
Notifications
You must be signed in to change notification settings - Fork 1
/
wp_install.sh
49 lines (41 loc) · 1.06 KB
/
wp_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
echo "#####################################"
echo "# Wordpress installer #"
echo "# Made by Rick Bakker #"
echo "# RickB2000@GitHub #"
echo "#####################################"
directory=.
dbname=.
dbuser=.
dbpass=.
if [ $# != 4 ]
then
echo "Wrong notation."
echo "Please use: ./wp_install.sh [directory] [mysql_db] [mysql_user] [mysql_password]"
exit
fi
directory=$1
dbname=$2
dbuser=$3
dbpass=$4
if [ ! -d "$directory" ]; then
mkdir -p $directory
fi
cd $directory
curl -O https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
cd wordpress
cp -rf . ..
cd ..
rm -R wordpress
cp wp-config-sample.php wp-config.php
perl -pi -e "s/database_name_here/$dbname/g" wp-config.php
perl -pi -e "s/username_here/$dbuser/g" wp-config.php
perl -pi -e "s/password_here/$dbpass/g" wp-config.php
mkdir wp-content/uploads
chmod 777 wp-content/uploads
rm latest.tar.gz
clear
echo "#####################################"
echo "# Wordpress is installed! #"
echo "#####################################"