From 415856bdd4f48ab4f2732996f0bae58595092bbe Mon Sep 17 00:00:00 2001 From: Parabola Date: Tue, 5 Apr 2011 14:26:38 +0000 Subject: Tue Apr 5 14:26:38 UTC 2011 --- community/ushare/PKGBUILD | 48 +++++++++++ community/ushare/upnp-build-fix.patch | 156 ++++++++++++++++++++++++++++++++++ community/ushare/ushare | 54 ++++++++++++ community/ushare/ushare-config.patch | 22 +++++ 4 files changed, 280 insertions(+) create mode 100644 community/ushare/PKGBUILD create mode 100644 community/ushare/upnp-build-fix.patch create mode 100755 community/ushare/ushare create mode 100644 community/ushare/ushare-config.patch (limited to 'community/ushare') diff --git a/community/ushare/PKGBUILD b/community/ushare/PKGBUILD new file mode 100644 index 000000000..3fb02b760 --- /dev/null +++ b/community/ushare/PKGBUILD @@ -0,0 +1,48 @@ +# $Id: PKGBUILD 41581 2011-03-08 01:32:14Z giovanni $ +# Maintainer: Sergej Pupykin +# Maintainer: Kessia 'even' Pinheiro +# Contributor: kastor + +pkgname=ushare +pkgver=1.1a +pkgrel=10 +pkgdesc="A free UPnP A/V Media Server for Linux" +url="http://ushare.geexbox.org" +license=('GPL2') +arch=('i686' 'x86_64') +depends=('libupnp' 'libdlna') +backup=(etc/ushare/ushare.conf) +source=("http://ushare.geexbox.org/releases/${pkgname}-${pkgver}.tar.bz2" + "ushare" + "upnp-build-fix.patch" + "ushare-config.patch") +md5sums=('5bbcdbf1ff85a9710fa3d4e82ccaa251' + 'f252120bcd4362ed64111239d358851c' + '32c29f9f673e8b3a3d9e7bf5e60febbc' + '5243475c0cebc5db49296b2f3691085b') +md5sums=('5bbcdbf1ff85a9710fa3d4e82ccaa251' + 'f252120bcd4362ed64111239d358851c' + '32c29f9f673e8b3a3d9e7bf5e60febbc' + '5243475c0cebc5db49296b2f3691085b') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + sed -i -e \ + "s%^INSTALL=\"/usr/bin/install -c\"$%INSTALL=\"$(which install) -c\"%" \ + configure + patch -p1 <$srcdir/upnp-build-fix.patch + patch -p1 <$srcdir/ushare-config.patch + + ./configure --prefix=/usr --sysconfdir=/etc/ushare \ + --enable-dlna --with-libdlna-dir=/usr/include/libavformat + + make + make DESTDIR=${pkgdir} install + + rm -rf ${pkgdir}/etc/${pkgname}/init.d + install -m 0755 -D ${srcdir}/ushare ${pkgdir}/etc/rc.d/ushare + install -d -m 0755 ${pkgdir}/etc/conf.d/ + echo "PARAMS=" > ${pkgdir}/etc/conf.d/ushare + install -D -m0644 src/ushare.1 $pkgdir/usr/share/man/man1/ushare.1 +} diff --git a/community/ushare/upnp-build-fix.patch b/community/ushare/upnp-build-fix.patch new file mode 100644 index 000000000..c3ec37a32 --- /dev/null +++ b/community/ushare/upnp-build-fix.patch @@ -0,0 +1,156 @@ +diff -wbBur ushare-1.1a/src/http.c ushare-1.1a.my/src/http.c +--- ushare-1.1a/src/http.c 2007-12-09 13:03:36.000000000 +0000 ++++ ushare-1.1a.my/src/http.c 2010-10-29 11:13:07.000000000 +0000 +@@ -77,8 +77,7 @@ + info->content_type = ixmlCloneDOMString (content_type); + } + +-static int +-http_get_info (const char *filename, struct File_Info *info) ++int http_get_info (const char *filename, struct File_Info *info) + { + extern struct ushare_t *ut; + struct upnp_entry_t *entry = NULL; +@@ -197,8 +196,7 @@ + return ((UpnpWebFileHandle) file); + } + +-static UpnpWebFileHandle +-http_open (const char *filename, enum UpnpOpenFileMode mode) ++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode) + { + extern struct ushare_t *ut; + struct upnp_entry_t *entry = NULL; +@@ -251,8 +249,7 @@ + return ((UpnpWebFileHandle) file); + } + +-static int +-http_read (UpnpWebFileHandle fh, char *buf, size_t buflen) ++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen) + { + struct web_file_t *file = (struct web_file_t *) fh; + ssize_t len = -1; +@@ -286,8 +283,7 @@ + return len; + } + +-static int +-http_write (UpnpWebFileHandle fh __attribute__((unused)), ++int http_write (UpnpWebFileHandle fh __attribute__((unused)), + char *buf __attribute__((unused)), + size_t buflen __attribute__((unused))) + { +@@ -296,8 +292,7 @@ + return 0; + } + +-static int +-http_seek (UpnpWebFileHandle fh, off_t offset, int origin) ++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin) + { + struct web_file_t *file = (struct web_file_t *) fh; + off_t newpos = -1; +@@ -371,8 +366,7 @@ + return 0; + } + +-static int +-http_close (UpnpWebFileHandle fh) ++int http_close (UpnpWebFileHandle fh) + { + struct web_file_t *file = (struct web_file_t *) fh; + +@@ -402,13 +396,3 @@ + + return 0; + } +- +-struct UpnpVirtualDirCallbacks virtual_dir_callbacks = +- { +- http_get_info, +- http_open, +- http_read, +- http_write, +- http_seek, +- http_close +- }; +diff -wbBur ushare-1.1a/src/http.h ushare-1.1a.my/src/http.h +--- ushare-1.1a/src/http.h 2007-12-09 13:03:36.000000000 +0000 ++++ ushare-1.1a.my/src/http.h 2010-10-29 11:13:11.000000000 +0000 +@@ -25,6 +25,13 @@ + #include + #include + +-struct UpnpVirtualDirCallbacks virtual_dir_callbacks; ++int http_close (UpnpWebFileHandle fh); ++int http_write (UpnpWebFileHandle fh __attribute__((unused)), ++ char *buf __attribute__((unused)), ++ size_t buflen __attribute__((unused))); ++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin); ++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode); ++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen); ++int http_get_info (const char *filename, struct File_Info *info); + + #endif /* _HTTP_H_ */ +diff -wbBur ushare-1.1a/src/ushare.c ushare-1.1a.my/src/ushare.c +--- ushare-1.1a/src/ushare.c 2007-12-09 13:03:36.000000000 +0000 ++++ ushare-1.1a.my/src/ushare.c 2010-10-29 11:17:45.000000000 +0000 +@@ -188,7 +188,7 @@ + if (strcmp (request->DevUDN + 5, ut->udn)) + return; + +- ip = request->CtrlPtIPAddr.s_addr; ++ ip = (*(struct sockaddr_in*)&request->CtrlPtIPAddr).sin_addr.s_addr; + ip = ntohl (ip); + sprintf (val, "%d.%d.%d.%d", + (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF); +@@ -348,7 +348,47 @@ + + UpnpEnableWebserver (TRUE); + +- res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks); ++ res = UpnpVirtualDir_set_WriteCallback(http_write); ++ if (res != UPNP_E_SUCCESS) ++ { ++ log_error (_("Cannot set virtual directory callbacks\n")); ++ free (description); ++ return -1; ++ } ++ ++ res = UpnpVirtualDir_set_GetInfoCallback(http_get_info); ++ if (res != UPNP_E_SUCCESS) ++ { ++ log_error (_("Cannot set virtual directory callbacks\n")); ++ free (description); ++ return -1; ++ } ++ ++ res = UpnpVirtualDir_set_ReadCallback(http_read); ++ if (res != UPNP_E_SUCCESS) ++ { ++ log_error (_("Cannot set virtual directory callbacks\n")); ++ free (description); ++ return -1; ++ } ++ ++ res = UpnpVirtualDir_set_OpenCallback(http_open); ++ if (res != UPNP_E_SUCCESS) ++ { ++ log_error (_("Cannot set virtual directory callbacks\n")); ++ free (description); ++ return -1; ++ } ++ ++ res = UpnpVirtualDir_set_SeekCallback(http_seek); ++ if (res != UPNP_E_SUCCESS) ++ { ++ log_error (_("Cannot set virtual directory callbacks\n")); ++ free (description); ++ return -1; ++ } ++ ++ res = UpnpVirtualDir_set_CloseCallback(http_close); + if (res != UPNP_E_SUCCESS) + { + log_error (_("Cannot set virtual directory callbacks\n")); diff --git a/community/ushare/ushare b/community/ushare/ushare new file mode 100755 index 000000000..0e920ae0a --- /dev/null +++ b/community/ushare/ushare @@ -0,0 +1,54 @@ +#!/bin/bash + +DESC="uShare UPnP A/V Media Server" + +. /etc/rc.conf +. /etc/rc.d/functions +[ -r "/etc/ushare/ushare.conf" ] && . /etc/ushare/ushare.conf +[ -r "/etc/conf.d/ushare" ] && . /etc/conf.d/ushare + +# abort if no executable exists +#[ -x $DAEMON ] || stat_fail + +# abort if no shared directory is defined +#[ -z "$USHARE_DIR" ] && stat_fail + +#set -e + +#checkpid() { +# [ -e $PIDFILE ] || touch $PIDFILE +#} + +PID=`pidof -o %PPID /usr/bin/ushare` +case "$1" in + start) + stat_busy "Starting $DESC" + [ -z "$PID" ] && /usr/bin/ushare -D -x $PARAMS + if [ $? -gt 0 ]; then + stat_fail + else + PID=`pidof -o %PPID /usr/bin/ushare` + echo $PID > /var/run/ushare.pid + add_daemon ushare + stat_done + fi + ;; + stop) + stat_busy "Stopping $DESC" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm /var/run/ushare.pid + rm_daemon ushare + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac diff --git a/community/ushare/ushare-config.patch b/community/ushare/ushare-config.patch new file mode 100644 index 000000000..d064db890 --- /dev/null +++ b/community/ushare/ushare-config.patch @@ -0,0 +1,22 @@ +--- ushare-1.1a/scripts/ushare.conf 2007-12-09 07:03:36.000000000 -0600 ++++ b/scripts/ushare.conf 2010-11-15 12:09:45.000000000 -0600 +@@ -31,15 +31,15 @@ USHARE_DIR= + USHARE_OVERRIDE_ICONV_ERR= + + # Enable Web interface (yes/no) +-ENABLE_WEB= ++USHARE_ENABLE_WEB= + + # Enable Telnet control interface (yes/no) +-ENABLE_TELNET= ++USHARE_ENABLE_TELNET= + + # Use XboX 360 compatibility mode (yes/no) +-ENABLE_XBOX= ++USHARE_ENABLE_XBOX= + + # Use DLNA profile (yes/no) + # This is needed for PlayStation3 to work (among other devices) +-ENABLE_DLNA= ++USHARE_ENABLE_DLNA= + -- cgit v1.2.3-54-g00ecf