add echo statements to install script

This commit is contained in:
Danny van Kooten 2018-05-24 09:38:51 +02:00
parent 67bbdf34eb
commit d4bd700513

View File

@ -16,12 +16,14 @@ echo "Welcome to the Fathom quick installer. Press CTRL-C at any time to abort."
function download_fathom() { function download_fathom() {
# Download latest version of the Fathom application # Download latest version of the Fathom application
echo "Downloading Fathom" echo "Downloading latest Fathom"
wget -O fathom https://usesfathom.com/downloads/fathom-latest wget -O fathom https://usesfathom.com/downloads/fathom-latest
# Move Fathom to $PATH so we can run the command from anywhere # Move Fathom to $PATH so we can run the command from anywhere
echo "Moving Fathom to /usr/local/bin/fathom"
chmod +x fathom chmod +x fathom
mv fathom /usr/local/bin/fathom mv fathom /usr/local/bin/fathom
FATHOM_PATH=$(command -v fathom) FATHOM_PATH=$(command -v fathom)
echo "Fathom installed to $FATHOM_PATH" echo "Fathom installed to $FATHOM_PATH"
echo "" echo ""
@ -40,6 +42,7 @@ function new_site_dir() {
fi; fi;
if [ ! -e "$SITE_DIR" ]; then if [ ! -e "$SITE_DIR" ]; then
echo "Creating directory $SITE_DIR_ABS"
mkdir -p "$SITE_DIR" mkdir -p "$SITE_DIR"
chmod 755 "$SITE_DIR" chmod 755 "$SITE_DIR"
fi; fi;
@ -83,7 +86,7 @@ function setup_config() {
DATABASE_NAME="fathom" DATABASE_NAME="fathom"
fi; fi;
echo "Creating database $DATABASE_NAME" echo "Creating $DATABASE database $DATABASE_NAME"
mysql --user="$DATABASE_USER" --password="$DATABASE_PASSWORD" --execute="CREATE DATABASE $DATABASE_NAME;" mysql --user="$DATABASE_USER" --password="$DATABASE_PASSWORD" --execute="CREATE DATABASE $DATABASE_NAME;"
# TODO: Add Postgres support # TODO: Add Postgres support
fi; fi;
@ -138,9 +141,14 @@ server {
} }
END END
) )
echo "Creating file /etc/nginx/sites-available/$SERVER_NAME"
echo "$TEMPLATE" > "/etc/nginx/sites-available/$SERVER_NAME" echo "$TEMPLATE" > "/etc/nginx/sites-available/$SERVER_NAME"
ln -s "/etc/nginx/sites-available/$SERVER_NAME" "/etc/nginx/sites-enabled/$SERVER_NAME" || true ln -s "/etc/nginx/sites-available/$SERVER_NAME" "/etc/nginx/sites-enabled/$SERVER_NAME" || true
echo "Testing NGINX configuration"
nginx -t nginx -t
echo "Reloading NGINX"
service nginx reload service nginx reload
echo "" echo ""
} }
@ -177,13 +185,19 @@ WantedBy=multi-user.target
END END
) )
echo "Creating file /etc/systemd/system/$SERVICE_NAME.service"
echo "$TEMPLATE" > "/etc/systemd/system/$SERVICE_NAME.service" echo "$TEMPLATE" > "/etc/systemd/system/$SERVICE_NAME.service"
echo "Reloading systemd service files"
systemctl daemon-reload systemctl daemon-reload
echo "Enabling $SERVICE_NAME at system boot"
systemctl enable "$SERVICE_NAME" systemctl enable "$SERVICE_NAME"
echo "Starting service $SERVICE_NAME"
systemctl start "$SERVICE_NAME" systemctl start "$SERVICE_NAME"
echo "Success! Service $SERVICE_NAME created & started." echo "Success! You can manually start the service using \`systemctl start $SERVICE_NAME\`"
echo "You can manually start the service using systemctl start $SERVICE_NAME"
echo "" echo ""
} }