Have install.sh use the full path to ipfs binary if detected
License: MIT Signed-off-by: Jonathan Dahan <jonathan@jonathan.is>
Jonathan Dahan committed
Dec 16, 2015 at 11:31 UTC
5ed2322772c361cc8e5f902d43f8afa08a50751f
3 files changed
+6
-3
misc/launchd/README.md
-1
@@ -2,4 +2,3 @@
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`
4
5
-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.
misc/launchd/install.sh
+5
-1
@@ -6,9 +6,13 @@ dest_dir="$HOME/Library/LaunchAgents"
6
IPFS_PATH="${IPFS_PATH:-$HOME/.ipfs}"
7
escaped_ipfs_path=$(echo $IPFS_PATH|sed 's/\//\\\//g')
8
9
+IPFS_BIN=$(which ipfs || echo ipfs)
10
+escaped_ipfs_bin=$(echo $IPFS_BIN|sed 's/\//\\\//g')
11
+
12
mkdir -p "$dest_dir"
13
11
-sed 's/{{IPFS_PATH}}/'"$escaped_ipfs_path"'/g' \
14
+sed -e 's/{{IPFS_PATH}}/'"$escaped_ipfs_path"'/g' \
15
+ -e 's/{{IPFS_BIN}}/'"$escaped_ipfs_bin"'/g' \
16
"$src_dir/$plist" \
17
> "$dest_dir/$plist"
18
misc/launchd/io.ipfs.ipfs-daemon.plist
+1
-1
@@ -8,7 +8,7 @@
8
<string>io.ipfs.ipfs-daemon</string>
9
<key>ProgramArguments</key>
10
<array>
11
- <string>ipfs</string>
11
+ <string>{{IPFS_BIN}}</string>
12
<string>daemon</string>
13
</array>
14
<key>EnvironmentVariables</key>