Remove directories on failure

This commit is contained in:
Bob Mottram 2016-11-08 13:23:01 +00:00
parent b5b9a1f04d
commit ab5e6e2aa4
1 changed files with 3 additions and 0 deletions

View File

@ -291,11 +291,13 @@ function install_ghost {
wget https://ghost.org/zip/ghost-${GHOST_VERSION}.zip wget https://ghost.org/zip/ghost-${GHOST_VERSION}.zip
if [ ! -f ghost-${GHOST_VERSION}.zip ]; then if [ ! -f ghost-${GHOST_VERSION}.zip ]; then
echo $'Unable to download ghost' echo $'Unable to download ghost'
rm -rf /var/www/$GHOST_DOMAIN_NAME
exit 63892 exit 63892
fi fi
unzip ghost-${GHOST_VERSION}.zip unzip ghost-${GHOST_VERSION}.zip
if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then if [ ! -f /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js ]; then
echo $'ghost failed to unzip' echo $'ghost failed to unzip'
rm -rf /var/www/$GHOST_DOMAIN_NAME
exit 63835 exit 63835
fi fi
@ -307,6 +309,7 @@ function install_ghost {
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
function_check remove_nodejs function_check remove_nodejs
remove_nodejs ghost remove_nodejs ghost
rm -rf /var/www/$GHOST_DOMAIN_NAME
echo $'Failed to install ghost' echo $'Failed to install ghost'
exit 7383563 exit 7383563
fi fi