Unverified Commit d7a590e9 authored by Aral Balkan's avatar Aral Balkan
Browse files

Update hash-bash and echo statements to work under Linux

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