Update hash-bash and echo statements to work under Linux

parent 5c832613
#!/bin/sh
#!/bin/bash
set -e
......@@ -77,8 +77,8 @@ ask() {
# Prints out a link to the Better app on the App Store on premature exits.
#
exitPS(){
echo "PS. You can purchase and install Better from the App Store at:\nhttps://itunes.apple.com/us/app/better-by-ind.ie/id1080964978?mt=8\n"
echo "Laura, Osky, and I (Aral) appreciate your support! :)\nhttps://ind.ie/team\n"
echo -e "PS. You can purchase and install Better from the App Store at:\nhttps://itunes.apple.com/us/app/better-by-ind.ie/id1080964978?mt=8\n"
echo -e "Laura, Osky, and I (Aral) appreciate your support! :)\nhttps://ind.ie/team\n"
}
#
......@@ -115,8 +115,8 @@ $prompt "
1 ) optionInstallEverything=true; humanNameOfThingToInstall="iOS App, etc.,"; break;;
2 ) optionInstallEverything=false; humanNameOfThingToInstall="Inspector"; break;;
$(( ${#options[@]}+1 )) ) echo "\nSee you later! :)\n"; exitPS; exit;;
*) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
$(( ${#options[@]}+1 )) ) echo -e "\nSee you later! :)\n"; exitPS; exit;;
*) echo -e "\nOops, I only understand numbers between 1 and 3.";continue;;
esac
......@@ -127,7 +127,7 @@ $prompt "
prompt="▶ "
options=("Use my forks." "Use canonical repositories.")
echo "$title"
echo -e "$title"
PS3="
$prompt "
select opt in "${options[@]}" "I have second thoughts about all this, get me out of here!"; do
......@@ -137,8 +137,8 @@ $prompt "
1 ) optionFork=true; break;;
2 ) optionFork=false; break;;
$(( ${#options[@]}+1 )) ) echo "\nNo worries, we all get cold feet sometimes. Bye! :)\n"; exitPS; exit;;
*) echo "\nOops, I only understand numbers between 1 and 3.";continue;;
$(( ${#options[@]}+1 )) ) echo -e "\nNo worries, we all get cold feet sometimes. Bye! :)\n"; exitPS; exit;;
*) echo -e "\nOops, I only understand numbers between 1 and 3.";continue;;
esac
......@@ -175,12 +175,12 @@ To continue:
#
# Summarise.
#
echo "\nThank you! :)\n\nI’m going to: \n"
echo -e "\nThank you! :)\n\nI’m going to: \n"
if [ $optionInstallEverything = true ]; then
echo "• Install everything (iOS App, Safari Extension, Inspector).\n"
echo -e "• Install everything (iOS App, Safari Extension, Inspector).\n"
else
echo "• Install only Better Inspector (and its dependencies).\n"
echo -e "• Install only Better Inspector (and its dependencies).\n"
fi
if [ $optionFork = true ]; then
......@@ -188,7 +188,7 @@ To continue:
# Get the account name.
optionAccountName=$(accountName)
echo "• Use (and create, if necessary) your own forks on your\n ${optionAccountName} GitLab account on source.ind.ie."
echo -e "• Use (and create, if necessary) your own forks on your\n ${optionAccountName} GitLab account on source.ind.ie."
else
echo "• Using the canonical repositories (read-only unless you have commit access)."
fi
......@@ -203,14 +203,14 @@ To continue:
# Confirm.
#
if ask "\nMay I proceed?" Y; then
echo "\nThank you, proceeding with the installation."
echo -e "\nThank you, proceeding with the installation."
if [ $optionInstallEverything = true ]; then
installEverything
else
installInspector
fi
else
echo "\nSure, no problem, maybe some other time. Bye! :)\n"
echo -e "\nSure, no problem, maybe some other time. Bye! :)\n"
exit
fi
}
......@@ -241,11 +241,11 @@ indentOutput(){
installEverything(){
if [ $optionFork = true ]; then
echo "\nEnsuring forks exist:\n"
echo -e "\nEnsuring forks exist:\n"
ensureForksExistForEverything
fi
echo "\nInstalling everything:"
echo -e "\nInstalling everything:"
# 1. Install the Better iOS App (which will, in turn, install its dependencies, the Inspector and Builder)
install "app" "Better iOS App"
......@@ -257,11 +257,11 @@ installEverything(){
installInspector(){
if [ $optionFork = true ]; then
echo "\nForking inspector (and builder)…"
echo -e "\nForking inspector (and builder)…"
ensureForksExistForInspector
fi
echo "\nInstalling inspector."
echo -e "\nInstalling inspector."
install "inspector" "Better Inspector"
}
......@@ -275,14 +275,14 @@ install(){
# Check if a Better Builder installation exists.
if [ -d $componentToInstall ]; then
echo "\n • Error: Existing ${humanName} found.\n\nPlease remove this if you want to reinstall it. You can uninstall existing Better components and data using the ./uninstall script.\n\nExiting.\n"
echo -e "\n • Error: Existing ${humanName} found.\n\nPlease remove this if you want to reinstall it. You can uninstall existing Better components and data using the ./uninstall script.\n\nExiting.\n"
exit 1
fi
echo "\n • Cloning ${humanName}…"
echo -e "\n • Cloning ${humanName}…"
git clone --quiet git@source.ind.ie:${optionAccountName}/${componentToInstall}.git
echo "\n • Running installation script for ${humanName}…"
echo -e "\n • Running installation script for ${humanName}…"
cd $componentToInstall
indentOutput "./install" ' '
cd ..
......@@ -295,7 +295,7 @@ install(){
fi
# OK
echo "\n${humanName} installed."
echo -e "\n${humanName} installed."
}
#
......
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