-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_wp.sh
executable file
·49 lines (41 loc) · 1.11 KB
/
install_wp.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
# Author: Persi.Liao <xiangchu.liao AT gmail.com>
#
# Notes: Linux Took Kit
#
# Project home page:
# https://github.com/persiliao/ltk
LTK_DIRECTORY="$(pwd)"
. "${LTK_DIRECTORY}/bootstrap.sh"
setup_install_wp_cli() {
if ! command_exists wp; then
fmt_tips "Do you want to install wp cli? [Y/n] "
read -r opt
case $opt in
y*|Y*|"") ;;
n*|N*) fmt_notice "wp cli install skipped."; return ;;
*) fmt_notice "Invalid choice. wp cli install skipped."; return ;;
esac
if curl -o "${LTK_WP_CLI_PATH}" https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; then
chmod +x "${LTK_WP_CLI_PATH}"
mv "${LTK_WP_CLI_PATH}" /usr/local/bin/wp
fmt_information "wp cli install successfully."
else
fmt_notice "Cancelled wp cli install."
rm -rf "${LTK_WP_CLI_PATH}"
fi
fi
if command_exists wp; then
if ! command_exists php; then
fmt_error "php is not installed. wp cli needs to depend on php"
else
php -v
wp --info
fi
fi
}
main() {
LTK_WP_CLI_PATH="${HOME}/wp-cli.phar"
setup_install_wp_cli
}
main