From fee74246afcd6c4db82dc6e55f4358131ece33ef Mon Sep 17 00:00:00 2001
From: Carl Baldwin <carl@ecbaldwin.net>
Date: Fri, 12 Feb 2010 16:57:08 -0700
Subject: [PATCH] Try to find the rip_dvd script automatically.

---
 rip_dvd.conf.dist |  5 +++--
 rip_dvd.wrap      | 12 ++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/rip_dvd.conf.dist b/rip_dvd.conf.dist
index 6f6b80f..74e6522 100644
--- a/rip_dvd.conf.dist
+++ b/rip_dvd.conf.dist
@@ -6,8 +6,9 @@
 # NOTE: You can override ANY of the global variables listed in the top of rip_dvd here
 ###########################################################################################
 
-# specify the path to the rip_dvd script
-ripcmd="/myth/video/bin/rip_dvd"
+# specify the path to the rip_dvd script (no need to do this if rip_dvd is in
+# the same directory as the rip_dvd.wrap script (which is likely).
+# ripcmd="/myth/video/bin/rip_dvd"
 
 # Specify the device path to the DVD drive
 dev=/dev/dvd
diff --git a/rip_dvd.wrap b/rip_dvd.wrap
index fdfee25..e9e8544 100755
--- a/rip_dvd.wrap
+++ b/rip_dvd.wrap
@@ -16,6 +16,18 @@ if [ -z "$dvdtype" ]; then
   usage
 fi
 
+mydir=$(cd $(dirname $0) && pwd)
+if [ -z "$ripcmd" ]
+then
+  if [ -x "$mydir/rip_dvd" ]
+  then
+    ripcmd="$mydir/rip_dvd"
+  else
+    echo >&2 "Cannot find your rip_dvd command!"
+    exit 1
+  fi
+fi
+
 ##############################################################################
 # Local Machine Settings:
 # Sources both the "default" conf file tracked by GIT (rip_dvd.conf.dist)
-- 
2.34.1