From b82359d96ce6bae778fab9b24cfe69e93e41aa7b Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verison.net>
Date: Tue, 6 Apr 2010 02:34:13 +0000
Subject: transmission-cli: automate the web interface setup

---
 abs/extra-testing/community/transmission-cli/PKGBUILD     |  7 +++++--
 .../community/transmission-cli/transmission-cli.install   |  7 +++++--
 .../community/transmission-cli/transmission.include       | 15 +++++++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)
 create mode 100644 abs/extra-testing/community/transmission-cli/transmission.include

diff --git a/abs/extra-testing/community/transmission-cli/PKGBUILD b/abs/extra-testing/community/transmission-cli/PKGBUILD
index 6bbb809..5a25df8 100644
--- a/abs/extra-testing/community/transmission-cli/PKGBUILD
+++ b/abs/extra-testing/community/transmission-cli/PKGBUILD
@@ -4,7 +4,7 @@
 
 pkgname=transmission-cli
 pkgver=1.92
-pkgrel=2
+pkgrel=3
 pkgdesc="Fast, easy, and free BitTorrent client (CLI tools, daemon and web client)"
 arch=('i686' 'x86_64')
 url="http://www.transmissionbt.com/"
@@ -17,6 +17,7 @@ install=transmission-cli.install
 source=(http://mirrors.m0k.org/transmission/files/transmission-$pkgver.tar.bz2
         run.transmissiond
         transmission-cli.install
+        transmission.include
         transmissiond.conf)
 
 build() {
@@ -30,9 +31,11 @@ build() {
   mkdir -p -m777 "$pkgdir/myth/transmission" || return 1
   install -D -m755 "$srcdir/run.transmissiond" "$pkgdir/etc/sv/transmissiond/run" || return 1
   install -D -m644 "$srcdir/transmissiond.conf" "$pkgdir/etc/conf.d/transmissiond" || return 1
+  install -D -m644 "$srcdir/transmission.include" "$pkgdir/etc/transmission/transmission.include" || return 1
   install -D -m644 COPYING "$pkgdir/usr/share/licenses/transmission-cli/COPYING" || return 1
 }
 md5sums=('561357621331f294c87f78e22783a283'
          'b91534aaf2e403331c611c615ab2c03d'
-         'd4d664448983db3c9e8acd08f1bdc798'
+         'ff22c13dbd52565f9e88b1de22514eb9'
+         'b5a49ea375333cd0fee40f70dbac4c2e'
          'd05567c7a4f9df9f28602d1356d5c05c')
diff --git a/abs/extra-testing/community/transmission-cli/transmission-cli.install b/abs/extra-testing/community/transmission-cli/transmission-cli.install
index f64fe65..088ecc6 100644
--- a/abs/extra-testing/community/transmission-cli/transmission-cli.install
+++ b/abs/extra-testing/community/transmission-cli/transmission-cli.install
@@ -1,12 +1,15 @@
 post_install() {
+  /bin/echo 'include "/etc/transmission/transmission.include"' >> /etc/lighttpd/conf.include
+  killall -HUP lighttpd  
+
   add_service.sh transmissiond
 
   cat << _EOF
 
   You can edit the user and options in /etc/conf.d/transmissiond.
 
-  To set up a web interface proxy with lighttpd visit:
-  http://trac.transmissionbt.com/wiki/WebProxy
+  To access the web interface:
+  http://localhost/transmission
 
   Configuration file editing information can be found at:
   http://trac.transmissionbt.com/wiki/ConfigFiles
diff --git a/abs/extra-testing/community/transmission-cli/transmission.include b/abs/extra-testing/community/transmission-cli/transmission.include
new file mode 100644
index 0000000..5cbf399
--- /dev/null
+++ b/abs/extra-testing/community/transmission-cli/transmission.include
@@ -0,0 +1,15 @@
+#Redirect from /transmission to /transmission/web
+url.rewrite-once += ( "^/transmission[/]?$" => "/transmission/web" )
+$HTTP["url"] =~ "^/transmission/" {
+  #Serve static files from /usr/share/transmission
+  server.document-root = "/usr/share/"
+  #Forward RPC requests to the Transmission daemon
+  proxy.server = (
+    "/transmission/rpc" => (
+      (
+        "host" => "127.0.0.1",
+        "port" => 9091
+      )
+    )
+  )
+}
-- 
cgit v0.12