-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·49 lines (38 loc) · 1.89 KB
/
setup.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
#!/bin/bash
CURRENT_DIR=$( cd "$(dirname "$0")" ; pwd -P )
source "$CURRENT_DIR"/functions.sh
setColors
if ! getWPDir; then
echo "$RED"An error occured while getting the WordPress directories"$ENDCOLOR"
exit
fi
echo -e "$YELLOW"Symlinking hook files..."$ENDCOLOR"
ln -s "$CURRENT_DIR"/{get-wp-addons.php,p*,install.sh,remove.sh,functions.sh} "$WORDPRESS_UPLOADS_DIR"/.git/hooks
echo -e "$YELLOW"Copying YML if httpd is available..."$ENDCOLOR"
if type apachectl &> /dev/null; then
cp "$CURRENT_DIR"/wp-cli.yml.example "$WORDPRESS_SETUP_DIR"/wp-cli.yml
cp "$CURRENT_DIR"/wp-cli.yml.example "$WORDPRESS_SETUP_DIR"
fi
if [ ! -e "$WORDPRESS_SETUP_DIR"/wp-addons.php ] ; then
echo -e "$YELLOW"The wp-addons.php was not found in the project."$ENDCOLOR"
if [ ! -e "$WORDPRESS_SETUP_DIR"/wp-addons.php.example ]; then
echo -e "$YELLOW"Copying example wp-addons from hooks repo."$ENDCOLOR"
cp "$CURRENT_DIR"/wp-addons.php.example "$WORDPRESS_SETUP_DIR"/wp-addons.php
cp "$CURRENT_DIR"/wp-addons.php.example "$WORDPRESS_SETUP_DIR"
else
echo -e "$YELLOW"Copying example wp-addons from project repo."$ENDCOLOR"
cp "$WORDPRESS_SETUP_DIR"/wp-addons.php.example "$WORDPRESS_SETUP_DIR"/wp-addons.php
fi
fi
if [ ! -e "$WORDPRESS_SETUP_DIR"/cleanup.sh ] ; then
echo -e "$YELLOW"A cleanup script was not found in the project."$ENDCOLOR"
if [ ! -e "$WORDPRESS_SETUP_DIR"/cleanup.sh.example ]; then
echo -e "$YELLOW"Copying example cleanup.sh from hooks repo."$ENDCOLOR"
cp "$CURRENT_DIR"/cleanup.sh.example "$WORDPRESS_SETUP_DIR"/cleanup.sh
cp "$CURRENT_DIR"/cleanup.sh.example "$WORDPRESS_SETUP_DIR"
else
echo -e "$YELLOW"Copying example cleanup.sh from project repo."$ENDCOLOR"
cp "$WORDPRESS_SETUP_DIR"/cleanup.sh.example "$WORDPRESS_SETUP_DIR"/cleanup.sh
fi
chmod u+x "$WORDPRESS_SETUP_DIR"/cleanup.sh
fi