Unverified Commit 9947545f authored by Aral Balkan's avatar Aral Balkan
Browse files

Update the installation script to run under Linux

parent 44ded33c
#!/bin/sh
#!/bin/bash
################################################################################
#
......@@ -89,14 +89,14 @@ setUpGeneratedRepository(){
bareRepositoryDirectory="${privateFolder}/data/${repositoryName}.git"
if [ -d $bareRepositoryDirectory ]; then
echo "Skipping bare repository creation for ${repositoryName}"
echo -e "Skipping bare repository creation for ${repositoryName}"
else
mkdir -p $bareRepositoryDirectory
runIn $bareRepositoryDirectory "git init --bare"
fi
if [ -d $sourceDirectory ]; then
echo "Skipping working directory creation. ${sourceDirectory} already exists."
echo -e "Skipping working directory creation. ${sourceDirectory} already exists."
else
# Create the working directory
mkdir -p $sourceDirectory
......@@ -124,7 +124,7 @@ setUpRepository(){
# Clone the remote repository to a local bare repository (if it doesn’t already exist).
#
if [ -d $localBareRepositoryPath ]; then
echo "Skipping clone: $localBareRepositoryPath bare repository already exists."
echo -e "Skipping clone: $localBareRepositoryPath bare repository already exists."
else
# Clone the live content repository as a bare repository
# and disable pushes so we don’t accidentally push dev content
......@@ -144,7 +144,7 @@ setUpRepository(){
# Clone the local bare repository to a local working copy (if it doesn’t already exist).
#
if [ -d $workingCopyPath ]; then
echo "Skipped clone: $workingCopyPath working copy already exists."
echo -e "Skipped clone: $workingCopyPath working copy already exists."
else
# Clone the local bare content repository so we have the working copy that
# the builder will use.
......@@ -162,7 +162,7 @@ setUpRepository(){
ensureCoffeeScriptExists(){
if hash coffee 2>/dev/null; then
echo "CoffeeScript already installed, skipping installation.\n"
echo -e "CoffeeScript already installed, skipping installation.\n"
else
npm install -g coffee-script
fi
......@@ -171,7 +171,7 @@ ensureCoffeeScriptExists(){
ensureNodemonExists(){
if hash nodemon 2>/dev/null; then
echo "Global module nodemon already installed, skipping installation.\n"
echo -e "Global module nodemon already installed, skipping installation.\n"
else
npm install -g nodemon
fi
......@@ -180,7 +180,7 @@ ensureNodemonExists(){
ensureNExists(){
if hash n 2>/dev/null; then
echo "Global module n already installed, skipping installation.\n"
echo -e "Global module n already installed, skipping installation.\n"
else
npm install -g n
fi
......@@ -194,14 +194,14 @@ ensureNodeIsTheCorrectVersion(){
#
set +e
n 6.11.3
[[ $? -ne 0 ]] && echo "Installing node requires root permissions on this system. Retrying with sudo…" && sudo n 6.11.3 || echo "Node successfully installed."
[[ $? -ne 0 ]] && echo -e "Installing node requires root permissions on this system. Retrying with sudo…" && sudo n 6.11.3 || echo -e "Node successfully installed."
set -e
}
addDeploymentRemote(){
# Add deployment remote
echo '\nAdding live git remote for deployments if necessary (use ./deploy)…'
echo -e '\nAdding live git remote for deployments if necessary (use ./deploy)…'
git remote -v | grep live > /dev/null 2>&1 || git remote add live dokku@builder.better.fyi:builder.better.fyi
}
......@@ -298,7 +298,7 @@ configureLocalEnvironment(){
siteLocalPath="${privateFolder}/site-local"
if [ -d $siteLocalPath ]; then
echo "Skipping clone: ${siteLocalPath} already exists."
echo -e "Skipping clone: ${siteLocalPath} already exists."
else
# Clone the local site server
runIn $privateFolder "git clone git@source.ind.ie:better/site-local.git"
......@@ -361,7 +361,7 @@ testAndPopulateLocalRepositories(){
# Test & initially populate the local repositories.
#
echo "\nWaiting for initial build to finish…\n"
echo -e "\nWaiting for initial build to finish…\n"
# Start the builder in the background.
coffee Main.coffee &
......@@ -373,7 +373,7 @@ testAndPopulateLocalRepositories(){
: # Nothing
done
echo "\nBuild script is finished. Terminating it."
echo -e "\nBuild script is finished. Terminating it."
# Kill the launched subprocesses (builder and its child processes).
killGroup
......@@ -390,16 +390,16 @@ getAccountName(){
accountName=$(cat "${persistedAccountName}")
if [ $accountName = 'better' ]; then
echo " • Will clone from the canonical Better repository."
echo -e " • Will clone from the canonical Better repository."
else
echo " • Will clone from your custom fork in the ${acccountName} account."
echo -e " • Will clone from your custom fork in the ${acccountName} account."
fi
fi
}
greetings(){
echo "Setting up the Better Builder development environment."
echo -e "Setting up the Better Builder development environment."
}
......@@ -415,7 +415,7 @@ flagEnd(){
}
goodbye(){
echo "Better Builder successfully installed."
echo -e "Better Builder successfully installed."
exit 0
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment