add hook, fix demo script

This commit is contained in:
Cold-Egg
2020-01-15 15:34:04 -05:00
parent bcf12dbf18
commit 3a1aa4c6fb
5 changed files with 36 additions and 7 deletions
+15 -6
View File
@@ -5,7 +5,6 @@ APP_NAME='wordpress'
DEMO_PATH="/var/www/${DEMO_VH}"
help_message(){
echo 'Command [-domain]'
echo 'Script will get database password and wordpress password from .env file and install the demo wordpress site for you'
}
@@ -16,17 +15,27 @@ check_input(){
fi
}
run_database(){
bash bin/database.sh -domain ${DEMO_VH} -user ${MYSQL_USER} -password ${MYSQL_PASSWORD} -database ${MYSQL_DATABASE}
store_credential(){
if [ -d "./sites/${1}" ]; then
if [ -f ./sites/${1}/.db_pass ]; then
mv ./sites/${1}/.db_pass ./sites/${1}/.db_pass.bk
fi
cat > "./sites/${1}/.db_pass" << EOT
"Database":"${MYSQL_DATABASE}"
"Username":"${MYSQL_USER}"
"Password":"$(echo ${MYSQL_PASSWORD} | tr -d "'")"
EOT
else
echo "./sites/${1} not found, abort credential store!"
fi
}
app_download(){
docker-compose exec litespeed su -c "appinstallctl.sh -app ${1} -domain ${2} -vhname localhost"
docker-compose exec litespeed su -c "appinstallctl.sh -app ${1} -domain ${2} -vhname ${DEMO_VH}"
}
main(){
run_database
store_credential ${DEMO_VH}
app_download ${APP_NAME} ${DOMAIN}
}