From 34071e633f7c7edd69fb9df2f1608789259aafb3 Mon Sep 17 00:00:00 2001 From: Kyle Neideck Date: Fri, 29 Apr 2016 13:18:52 +1000 Subject: [PATCH] Add an install "one-liner" to the README. Also fix a bug when running build_and_install.sh from a directory other than the root of the project. --- README.md | 29 ++++++++++++++++++++++++----- build_and_install.sh | 6 +++--- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bebfa21..1efa510 100644 --- a/README.md +++ b/README.md @@ -47,18 +47,37 @@ Background Music Device. You can create the aggregate device using the Audio MID ## Install -No binaries yet, but building should take less than a minute. To build and install everything do the following: +No binaries yet (working on it) but building should take less than a minute. + + + + +
⚠️Unfortunately, it won't build if you don't have Xcode installed because xcodebuild doesn't work on its own anymore. If you don't mind a 4GB download, you can get Xcode here.
+ +If you're comfortable with it, you can just paste the following at a Terminal prompt. + +[//]: # (Uses /bin/bash instead of just bash on the off chance that someone has a non standard Bash in their $PATH, but) +[//]: # (it doesn't do that for Tar or cURL because I'm fairly sure any versions of them should work here. That said,) +[//]: # (build_and_install.sh doesn't call things by absolute paths (yet?) anyway.) +[//]: # ( ) +[//]: # (Uses "gzcat - | tar x" instead of "tar xz" because gzcat will also check the file's integrity. (Gzip files) +[//]: # (include a checksum.)) +```shell +(set -eo pipefail; URL='https://github.com/kyleneideck/BackgroundMusic/archive/master.tar.gz'; \ + cd $(mktemp -d); echo Downloading $URL to $(pwd); curl -qfL# $URL | gzcat - | tar x && \ + /bin/bash BackgroundMusic-master/build_and_install.sh && rm -rf BackgroundMusic-master) +``` + +Otherwise, to build and install everything, do the following: - Clone or [download](https://github.com/kyleneideck/BackgroundMusic/archive/master.zip) the project - If the project is in a zip, unzip it - [Go to the folder of the project](https://github.com/0nn0/terminal-mac-cheatsheet/wiki/Terminal-Cheatsheet-for-Mac-(-basics-)#core-commands) on your terminal -- Run the following the command: `./build_and_install.sh`. - -Unfortunately, **it won't build if you don't have Xcode installed** because xcodebuild doesn't work on its own anymore. +- Run the following the command: `/bin/bash build_and_install.sh`. The script restarts the system audio process (coreaudiod) at the end of the installation, so you might want to pause any apps playing audio. -Additional detailed installation instructions can be found in the Wiki: https://github.com/kyleneideck/BackgroundMusic/wiki +Additional detailed installation instructions can be found on [the Wiki](https://github.com/kyleneideck/BackgroundMusic/wiki/Installation). ## Uninstall diff --git a/build_and_install.sh b/build_and_install.sh index 22e82d8..ff0fe4a 100755 --- a/build_and_install.sh +++ b/build_and_install.sh @@ -32,6 +32,9 @@ IFS=$'\n\t' # Subshells and function inherit the ERR trap set -o errtrace +# Go to the project directory. +cd "$( dirname "${BASH_SOURCE[0]}" )" + error_handler() { local LAST_COMMAND="${BASH_COMMAND}" LAST_COMMAND_EXIT_STATUS=$? @@ -369,9 +372,6 @@ log_debug_info() { # Register our handler so we can print a message and clean up if there's an error. trap 'error_handler ${LINENO}' ERR -# Go to the project directory. -cd "$( dirname "${BASH_SOURCE[0]}" )" - parse_options "$@" # Warn if running as root.