From 5ed2322772c361cc8e5f902d43f8afa08a50751f Mon Sep 17 00:00:00 2001 From: Jonathan Dahan Date: Wed, 16 Dec 2015 11:31:55 -0500 Subject: [PATCH] Have install.sh use the full path to ipfs binary if detected License: MIT Signed-off-by: Jonathan Dahan --- misc/launchd/README.md | 1 - misc/launchd/install.sh | 6 +++++- misc/launchd/io.ipfs.ipfs-daemon.plist | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/misc/launchd/README.md b/misc/launchd/README.md index cd4d6207e..c9d30c9ca 100644 --- a/misc/launchd/README.md +++ b/misc/launchd/README.md @@ -2,4 +2,3 @@ A bare-bones launchd agent file for ipfs. To have launchd automatically run the ipfs daemon for you, run `./misc/launchd/install.sh` -Note that the `ipfs` binary must be on the *system* PATH for this to work. Adding a symlink in /usr/bin works well enough for me. diff --git a/misc/launchd/install.sh b/misc/launchd/install.sh index 3d18e8526..7a02d3f90 100755 --- a/misc/launchd/install.sh +++ b/misc/launchd/install.sh @@ -6,9 +6,13 @@ dest_dir="$HOME/Library/LaunchAgents" IPFS_PATH="${IPFS_PATH:-$HOME/.ipfs}" escaped_ipfs_path=$(echo $IPFS_PATH|sed 's/\//\\\//g') +IPFS_BIN=$(which ipfs || echo ipfs) +escaped_ipfs_bin=$(echo $IPFS_BIN|sed 's/\//\\\//g') + mkdir -p "$dest_dir" -sed 's/{{IPFS_PATH}}/'"$escaped_ipfs_path"'/g' \ +sed -e 's/{{IPFS_PATH}}/'"$escaped_ipfs_path"'/g' \ + -e 's/{{IPFS_BIN}}/'"$escaped_ipfs_bin"'/g' \ "$src_dir/$plist" \ > "$dest_dir/$plist" diff --git a/misc/launchd/io.ipfs.ipfs-daemon.plist b/misc/launchd/io.ipfs.ipfs-daemon.plist index e7bf9a6e3..72d4cf716 100644 --- a/misc/launchd/io.ipfs.ipfs-daemon.plist +++ b/misc/launchd/io.ipfs.ipfs-daemon.plist @@ -8,7 +8,7 @@ io.ipfs.ipfs-daemon ProgramArguments - ipfs + {{IPFS_BIN}} daemon EnvironmentVariables