-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordpress-project-create
More file actions
executable file
·61 lines (48 loc) · 952 Bytes
/
wordpress-project-create
File metadata and controls
executable file
·61 lines (48 loc) · 952 Bytes
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
#! /bin/bash
function usage
{
cat << EOF
usage: $(basename $0) [-g] directory
Extract https://wordpress.org/latest.tar.gz to target directory.
Options:
-g (create Git repository with WordPress .gitignore)
EOF
}
OPT_GIT=0
OPT_DIR=$BASH_ARGV
while getopts "d:g" OPTION
do
case $OPTION in
g)
OPT_GIT=1
;;
?)
usage
exit
;;
esac
done
if [ ! $OPT_DIR ]; then
usage
exit
fi
if [ -d $OPT_DIR ]; then
echo "error: directory $OPT_DIR already exists"
exit 0
fi
# make directory
mkdir $OPT_DIR
cd $OPT_DIR
echo "Downloading https://wordpress.org/latest.tar.gz"
# get latest WordPress
curl -# -o ./latest.tar.gz https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
mv wordpress/* ./
rm -f -r wordpress latest.tar.gz
# setup Git
if [ $OPT_GIT -eq 1 ]; then
echo "creating Git repository"
gitignore wp
git init -q
fi
echo -e "\ndone"