diff options
| author | Robert Shaw | 2010-03-11 17:18:34 -0800 |
|---|---|---|
| committer | Adam Vandenberg | 2010-05-12 09:49:34 -0700 |
| commit | 4895330069c51a156d652ac95e674ffae9674779 (patch) | |
| tree | 80d76aec8783230c215d5f0647f850e0361833a7 /Library/Formula | |
| parent | 184624e85ec470ec1320fb9aac2b7663d4cec082 (diff) | |
| download | homebrew-4895330069c51a156d652ac95e674ffae9674779.tar.bz2 | |
New formula: sleepwatcher
Formula for SleepWatcher version 2.1
Signed-off-by: Robert Shaw <robert@or.homeip.net>
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/sleepwatcher.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Library/Formula/sleepwatcher.rb b/Library/Formula/sleepwatcher.rb new file mode 100644 index 000000000..201c98e24 --- /dev/null +++ b/Library/Formula/sleepwatcher.rb @@ -0,0 +1,55 @@ +require 'formula' + +class Sleepwatcher <Formula + url 'http://www.bernhard-baehr.de/sleepwatcher_2.1.tgz' + homepage 'http://www.bernhard-baehr.de/' + md5 'd4ace64e2e978f4f289ca4dddd21c6f2' + + def install + # Adjust Makefile to build native binary only + inreplace "sources/Makefile" do |s| + s.gsub! /^(CFLAGS)_PPC.*$/, "\\1 = #{ENV['CFLAGS']} -prebind" + s.gsub! /^(CFLAGS_X86)/, "#\\1" + s.change_make_var! "BINDIR", "$(PREFIX)/sbin" + s.change_make_var! "MANDIR", "$(PREFIX)/share/man" + s.gsub! /^(.*?)CFLAGS_PPC(.*?)[.]ppc/, "\\1CFLAGS\\2" + s.gsub! /^(.*?CFLAGS_X86.*?[.]x86)/, "#\\1" + s.gsub! /^(\t(lipo|rm).*?[.](ppc|x86))/, "#\\1" + s.gsub! "-o root -g wheel", "" + end + + # Build and install binary + Dir.chdir "sources" do + system "mv", "../sleepwatcher.8", "." + system "make", "install", "PREFIX=#{prefix}" + end + + # Write the usage ReadMe + prefix.install "ReadMe.rtf" + + # Write the sleep/wakeup scripts + (prefix + 'etc/sleepwatcher').install Dir["config/rc.*"] + + # Write the launchd scripts + inreplace Dir["config/*.plist"] do |s| + s.gsub! "/etc", (etc + 'sleepwatcher') + s.gsub! "/usr/local/sbin", (HOMEBREW_PREFIX + 'sbin') + end + prefix.install Dir["config/*.plist"] + end + + def caveats; <<-EOS.undent + For SleepWatcher to work, you will need to read the following: + + #{prefix}/ReadMe.rtf + + Ignore information about installing the binary and man page, + but read information regarding setup of the launchd files which + are installed here: + + #{Dir[(prefix + '*.plist')].join("\n ")} + + These are the examples provided by the author. + EOS + end +end |
