diff options
author | root <root@rshg054.dnsready.net> | 2013-08-13 01:33:19 -0700 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2013-08-13 01:33:19 -0700 |
commit | 7a65a910b77ad191d69881098c47f9b0c852d92e (patch) | |
tree | 9564e611af1442f8952a8cbddb3b0ad25ed71aab /community/ushare | |
parent | 60da6abff6c9577a783d72865f11de7a585e912e (diff) |
Tue Aug 13 01:31:08 PDT 2013
Diffstat (limited to 'community/ushare')
-rw-r--r-- | community/ushare/PKGBUILD | 53 | ||||
-rw-r--r-- | community/ushare/segfault.patch | 61 | ||||
-rw-r--r-- | community/ushare/upnp-build-fix.patch | 156 | ||||
-rw-r--r-- | community/ushare/ushare-config.patch | 22 | ||||
-rw-r--r-- | community/ushare/ushare.install | 17 | ||||
-rw-r--r-- | community/ushare/ushare.service | 11 |
6 files changed, 320 insertions, 0 deletions
diff --git a/community/ushare/PKGBUILD b/community/ushare/PKGBUILD new file mode 100644 index 000000000..09a8ffa37 --- /dev/null +++ b/community/ushare/PKGBUILD @@ -0,0 +1,53 @@ +# $Id: PKGBUILD 90735 2013-05-13 14:41:02Z spupykin $ +# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> +# Maintainer: Kessia 'even' Pinheiro <kessiapinheiro at gmail.com> +# Contributor: kastor <kastor@fobos.org.ar> + +pkgname=ushare +pkgver=1.1a +pkgrel=19 +pkgdesc="A free UPnP A/V Media Server for Linux" +url="http://ushare.geexbox.org" +license=('GPL2') +arch=('i686' 'x86_64') +depends=('libupnp' 'libdlna' 'sudo') +backup=('etc/ushare/ushare.conf' + 'etc/conf.d/ushare') +install=ushare.install +source=("http://ushare.geexbox.org/releases/${pkgname}-${pkgver}.tar.bz2" + "upnp-build-fix.patch" + "ushare-config.patch" + "segfault.patch" + "ushare.service") +md5sums=('5bbcdbf1ff85a9710fa3d4e82ccaa251' + '32c29f9f673e8b3a3d9e7bf5e60febbc' + '5243475c0cebc5db49296b2f3691085b' + '0b0fbf5d103f0ebb72716cbad0b28ffa' + 'db6187257b4623ef155b5575526d5d87') + +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 + patch -p1 <$srcdir/segfault.patch + ./configure --prefix=/usr --sysconfdir=/etc/ushare \ + --enable-dlna --with-libdlna-dir=/usr/include/libavformat + make +} + +package() { + cd ${srcdir}/${pkgname}-${pkgver} + make DESTDIR=${pkgdir} install + rm -rf ${pkgdir}/etc/${pkgname}/init.d + install -dm0755 ${pkgdir}/etc/conf.d/ + cat >${pkgdir}/etc/conf.d/ushare <<EOF +#PARAMS="-c /tmp -i eth0" +PARAMS= +USHARE_USER=ushare +EOF + install -Dm0644 src/ushare.1 $pkgdir/usr/share/man/man1/ushare.1 + install -Dm0644 $srcdir/ushare.service $pkgdir/usr/lib/systemd/system/ushare.service +} diff --git a/community/ushare/segfault.patch b/community/ushare/segfault.patch new file mode 100644 index 000000000..f46f9f1f4 --- /dev/null +++ b/community/ushare/segfault.patch @@ -0,0 +1,61 @@ +--- ushare-1.1a/src/cds.c 2007-12-09 16:03:36.000000000 +0300 ++++ ushare-1.1a.my/src/cds.c 2012-01-26 05:14:03.317360310 +0400 +@@ -20,6 +20,8 @@ + */ + + #include <stdlib.h> ++#include <string.h> ++#include <stdio.h> + #include <upnp/upnp.h> + #include <upnp/upnptools.h> + +--- ushare-1.1a/src/cms.c 2007-12-09 16:03:36.000000000 +0300 ++++ ushare-1.1a.my/src/cms.c 2012-01-26 05:15:33.236991387 +0400 +@@ -20,6 +20,7 @@ + */ + + #include <stdlib.h> ++#include <string.h> + #include <upnp/upnp.h> + #include <upnp/upnptools.h> + +--- ushare-1.1a/src/http.c 2012-01-26 05:27:44.073992912 +0400 ++++ ushare-1.1a.my/src/http.c 2012-01-26 05:17:31.756505126 +0400 +@@ -25,6 +25,7 @@ + #include <errno.h> + #include <stdio.h> + #include <stdlib.h> ++#include <string.h> + #include <unistd.h> + #include <errno.h> + +--- ushare-1.1a/src/presentation.c 2007-12-09 16:03:36.000000000 +0300 ++++ ushare-1.1a.my/src/presentation.c 2012-01-26 05:19:41.635972259 +0400 +@@ -19,6 +19,8 @@ + */ + + #include <stdlib.h> ++#include <string.h> ++#include <stdio.h> + + #if HAVE_LANGINFO_CODESET + # include <langinfo.h> +--- ushare-1.1a/src/mime.c 2007-12-09 16:03:36.000000000 +0300 ++++ ushare-1.1a.my/src/mime.c 2012-01-26 05:23:54.251602492 +0400 +@@ -21,6 +21,7 @@ + + #include <stdlib.h> + #include <string.h> ++#include <stdio.h> + + #include "mime.h" + #include "ushare.h" +--- ushare-1.1a/src/services.c 2007-12-09 16:03:36.000000000 +0300 ++++ ushare-1.1a.my/src/services.c 2012-01-26 05:21:28.572200186 +0400 +@@ -20,6 +20,7 @@ + */ + + #include <stdlib.h> ++#include <string.h> + #include <upnp/upnp.h> + #include <upnp/upnptools.h> 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 <upnp/upnp.h> + #include <upnp/upnptools.h> + +-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-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= + diff --git a/community/ushare/ushare.install b/community/ushare/ushare.install new file mode 100644 index 000000000..38d710156 --- /dev/null +++ b/community/ushare/ushare.install @@ -0,0 +1,17 @@ +post_install() { + if [ -z "`grep '^ushare:' /etc/group`" ]; then + groupadd -r ushare + fi + if [ -z "`grep '^ushare:' /etc/passwd`" ]; then + useradd -r -d /var/empty -g ushare -s /sbin/nologin ushare + fi +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + userdel ushare + groupdel ushare +} diff --git a/community/ushare/ushare.service b/community/ushare/ushare.service new file mode 100644 index 000000000..ba6719b8b --- /dev/null +++ b/community/ushare/ushare.service @@ -0,0 +1,11 @@ +[Unit] +Description=ushare +After=network.target + +[Service] +EnvironmentFile=/etc/conf.d/ushare +ExecStart=/usr/bin/ushare -D -x --cfg=/etc/ushare/ushare.conf +Type=forking + +[Install] +WantedBy=multi-user.target |