-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
73 lines (65 loc) · 1.93 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
################################
# Ask for variables
################################
echo "Quel est l'url de votre projet( exemple: https://localhost:8000 ) ?"
read project_url
echo "------------------------"
echo "Quel est le nom de votre projet ?"
read project_name
echo "------------------------"
echo "DB_NAME ?"
read db_name
echo "------------------------"
echo "DB_USER ?"
read db_user
echo "------------------------"
echo "DB_PASSWORD ?"
read db_password
echo "------------------------"
echo "DB_PREFIX ?"
read db_prefix
echo "------------------------"
echo "Quel est l'identifiant du compte admin ?"
read site_id
echo "------------------------"
echo "Quel est le mot de passe du compte admin ?"
read site_passwd
echo "------------------------"
echo "Quel est l'email du compte admin ?"
read site_mail
################################
# Init WP
################################
mkdir -p $project_name
cd $project_name
wp core download
wp core config --dbname=$db_name --dbuser=$db_user --dbpass=$db_password --dbhost=localhost --dbprefix=$db_prefix --extra-php <<PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_POST_REVISIONS', 3 );
PHP
wp db create
wp core install --url=$project_url --title=$project_name --admin_user=admin --admin_password=admin [email protected] --skip-email
# User admin do not have id of 1
wp user delete 1 --yes
wp user create $site_id $site_mail --user_pass=$site_passwd --role=administrator
wp option update admin_email $site_mail
# Set good permalinks
wp rewrite structure '/%postname%/'
wp rewrite flush
# Delete all sample stuff
wp plugin delete --all
wp post delete 1 2 3 --force
wp theme delete --all
# Disable indexing
wp option set blog_public 0
# Set default config
wp language core install fr_FR --activate
wp core update-db
################################
# Delete Installation directory
################################
rm wp-config-sample.php
cd ..
rm ./install.sh