forked from acquia/acquia_cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-acms
executable file
·50 lines (45 loc) · 1.37 KB
/
install-acms
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
#!/bin/sh
# Set colors, because we're fancy.
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
validate_email () {
if [[ $1 =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$ ]]
then
return
fi
printf "${YELLOW}*** Invalid email address!${NC}\n"
false
}
printf "${CYAN}### Welcome to Acquia CMS! ###${NC}\n"
COMPOSER=$(composer -V)
VERSION="Composer version 1"
printf "${CYAN}Composer version:${NC} $COMPOSER\n"
if grep -q "$VERSION" <<< "$COMPOSER"; then
printf "${YELLOW}This script requires Composer version 2 or later. Go here for instructions to install: https://getcomposer.org${NC}\n";
exit 0;
fi
printf "Please enter the username for your administrator account [${GREEN}admin${NC}]: "
DEFAULT_NAME="admin"
read ADMIN_NAME
ADMIN_NAME="${ADMIN_NAME:-$DEFAULT_NAME}"
printf "Please enter the password for your administrator account [${GREEN}random${NC}]: "
read ADMIN_PASS
while [ ! ${FINISHED} ]
do
printf "Please enter the email for your administrator account: "
read ADMIN_EMAIL
if validate_email ${ADMIN_EMAIL}; then
FINISHED=1
fi
done
printf "${CYAN}*** Thanks! Proceeding with the install..${NC}\n"
PARAMS=""
if [ ${ADMIN_PASS} ]; then
PARAMS+="--account-pass=${ADMIN_PASS} "
fi
if [ ${ADMIN_EMAIL} ]; then
PARAMS+="--account-mail=${ADMIN_EMAIL} "
fi
./vendor/bin/acms site-install -y --account-name=${ADMIN_NAME} ${PARAMS}