(brew_prefix): New variable; use it instead of "/usr/local".
authorMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 18 Jul 2012 15:02:39 +0000 (00:02 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Wed, 18 Jul 2012 15:02:39 +0000 (00:02 +0900)
- Add code to detect location of homebrew.mxcl.canna.plist.

bootstrap.homebrew

index ea8d7f8..017215e 100755 (executable)
@@ -9,22 +9,26 @@ brew -v install berkeley-db
 brew -v install xaw3d
 brew -v install gettext
 
+brew_prefix=`brew --prefix`
+
 if [ -f /Library/LaunchDaemons/homebrew.mxcl.canna.plist ]
 then
     sudo launchctl unload -w /Library/LaunchDaemons/homebrew.mxcl.canna.plist
 fi
-if [ -x /usr/local/sbin/cannakill ]
+if [ -x ${brew_prefix}/sbin/cannakill ]
 then
-    sudo /usr/local/sbin/cannakill
+    sudo ${brew_prefix}/sbin/cannakill
 fi
 
-(cd `brew --prefix` ; git pull https://github.com/chise/homebrew/)
+(cd ${brew_prefix}; git pull https://github.com/chise/homebrew/)
 
 brew -v install canna
 brew upgrade
 
 sudo sh -c "sed 's/rc\.canna/rc.canna-root/' \
-    < /usr/local/Cellar/canna/3.7p3_1/homebrew.mxcl.canna.plist \
+    < ${brew_prefix}`ls -l ${brew_prefix}/sbin/cannaserver \
+                       | sed 's/^.*-> ..//' \
+                       | sed 's|/sbin/cannaserver||'`/homebrew.mxcl.canna.plist \
     > /Library/LaunchDaemons/homebrew.mxcl.canna.plist"
 sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.canna.plist