-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo
More file actions
executable file
·71 lines (55 loc) · 2.21 KB
/
two
File metadata and controls
executable file
·71 lines (55 loc) · 2.21 KB
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
#!/bin/bash
print_color () { tput setab 7; tput setaf 0; echo "$1"; tput sgr0; }
# Check all required CLIs are available
dependencies=( wget git unzip node )
for dependency in "${dependencies[@]}"; do
command -v $dependency >/dev/null 2>&1 || apt-get -y install $dependency
done
####################################
# PLUGIN INSTALLATION & ACTIVATION #
####################################
WP_DIR="app/public"
# Advanced Custom Fields Pro
print_color "Installing Advanced Custom Fields Pro plugin..."
wget -O "$WP_DIR/wp-content/plugins/acf-pro.zip" "http://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=b3JkZXJfaWQ9NjQzMTJ8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTA5LTE2IDAzOjE4OjEy"
if [[ -f "$WP_DIR/wp-content/plugins/acf-pro.zip" ]]; then
wp plugin install "$WP_DIR/wp-content/plugins/acf-pro.zip" --activate --allow-root
rm "$WP_DIR/wp-content/plugins/acf-pro.zip"
else
echo "Can’t find file: $WP_DIR/wp-content/plugins/acf-pro.zip. Fatal error…"
exit 1
fi
# WordPress Importer
print_color "Installing WordPress Importer plugin..."
wp plugin install wordpress-importer --activate --allow-root
####################
# THEME ACTIVATION #
####################
THEME_LOCAL_DIR="$WP_DIR/wp-content/themes/hgnm-2014"
# Install & activate hgnm-2014 theme
print_color "Activating hgnm-2014 WordPress theme..."
if [ -d $THEME_LOCAL_DIR ]; then
wp theme activate hgnm-2014 --allow-root
else
echo "Can’t find directory: $THEME_LOCAL_DIR. Fatal error…"
exit 1
fi
#############################
# POPULATE DATABASE CONTENT #
#############################
# Clean default generated content
print_color "Deleting generic WordPress content..."
wp post delete 1 --force --allow-root # Delete ‘Hello world!’ post
wp post delete 2 --force --allow-root # Delete sample page
# Import exported XML from hgnm.org
HGNM_CONTENT="app/hgnm-export.xml"
print_color "Importing hgnm.org content..."
if [[ -f $HGNM_CONTENT ]]; then
wp import $HGNM_CONTENT --authors=create --allow-root
else
echo "Can’t find file: $HGNM_CONTENT. Fatal error…"
exit 1
fi
# Set permalink structure to refresh redirects
wp option update permalink_structure /%postname%/ --allow-root
print_color "Finished set-up! You can now close this window."