diff --git a/packages/sysutils/samba/build b/packages/sysutils/samba/build new file mode 100755 index 0000000000..414214b8b1 --- /dev/null +++ b/packages/sysutils/samba/build @@ -0,0 +1,47 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/build toolchain +$SCRIPTS/build libiconv + +export samba_cv_HAVE_GETTIMEOFDAY_TZ=yes +export samba_cv_USE_SETEUID=yes +export samba_cv_HAVE_IFACE_IFCONF=yes +export SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=no +export samba_cv_have_longlong=yes + +cd $PKG_BUILD/source +./configure --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --localstatedir=/var \ + --with-configdir=/etc \ + --with-privatedir=/etc \ + --disable-pie \ + --disable-cups \ + --without-smbmount \ + --with-cifsmount \ + --without-ldap \ + --without-winbind \ + --with-included-popt \ + --with-libsmbclient \ + --without-ads \ + --without-quotas \ + --without-sys-quotas \ + --with-syslog \ + --with-libiconv=$LIB_PREFIX \ + +make include/proto.h +make bin/mount.cifs \ + bin/smbtree \ + bin/libsmbclient.so +[ "$SAMBA_SERVER" = yes ] && make \ + bin/smbd + +mkdir -p $SYSROOT_PREFIX/usr/lib +cp bin/libsmbclient.so $SYSROOT_PREFIX/usr/lib + +mkdir -p $SYSROOT_PREFIX/usr/include +cp include/libsmbclient.h $SYSROOT_PREFIX/usr/include +cp include/libmsrpc.h $SYSROOT_PREFIX/usr/include diff --git a/packages/sysutils/samba/config/smb.conf b/packages/sysutils/samba/config/smb.conf new file mode 100644 index 0000000000..8f6ce9f301 --- /dev/null +++ b/packages/sysutils/samba/config/smb.conf @@ -0,0 +1,26 @@ +[global] + server string = GeeXboX(%i) + security = share + guest account = root + socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 + wins support = no + syslog only = yes + +[root] + path = / + available = yes + browsable = yes + public = yes + writable = yes + +# To add a writable share of a disk under /mnt uncomment and edit the +# following share declaration +# 'mydisk' is the disk name as seen by GeeXboX +;[mydisk] +; path = /mnt/mydisk +; available = yes +; browsable = yes +; public = yes +; writable = yes +; root preexec = /usr/bin/rw /mnt/mydisk +; root postexec = /usr/bin/ro /mnt/mydisk diff --git a/packages/sysutils/samba/init.d/58_samba b/packages/sysutils/samba/init.d/58_samba new file mode 100755 index 0000000000..4beb9d3a8a --- /dev/null +++ b/packages/sysutils/samba/init.d/58_samba @@ -0,0 +1,26 @@ +#!/bin/sh +# +# mount samba shares +# +# +# runlevels: geexbox, debug, configure + +if test -x /usr/bin/mount.cifs -a -f /etc/network; then + echo "### Mounting Samba shares ###" + + . /etc/network + + automount_samba static >/dev/null 2>&1 & + automount_samba dynamic >/dev/null 2>&1 & + + if [ -n "$NET_RESCAN_DELAY" -a $NET_RESCAN_DELAY -gt 0 ]; then + echo -e "*/$NET_RESCAN_DELAY * * * *\t/usr/bin/automount_samba dynamic > /dev/null 2>&1" >> /var/spool/cron/crontabs/root + fi +fi + +if test -x /usr/bin/smbd -a "$SAMBA_SERVER" = yes; then + echo "### Starting Samba server ###" + /usr/bin/smbd +fi + +exit 0 diff --git a/packages/sysutils/samba/install b/packages/sysutils/samba/install new file mode 100755 index 0000000000..913f1701f4 --- /dev/null +++ b/packages/sysutils/samba/install @@ -0,0 +1,20 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/install libiconv + + mkdir -p $INSTALL/usr/lib + cp $PKG_BUILD/source/bin/libsmbclient.so $INSTALL/usr/lib/libsmbclient.so.0 + ln -s libsmbclient.so.0 $INSTALL/usr/lib/libsmbclient.so + +# mkdir -p $INSTALL/usr/bin +# cp $BUILD/$1*/source/bin/mount.cifs $INSTALL/usr/bin +# cp $BUILD/$1*/source/bin/smbtree $INSTALL/usr/bin +# cp $PACKAGES/$1/scripts/automount_samba $INSTALL/usr/bin +# if [ "$SAMBA_SERVER" = yes ]; then +# mkdir -p $INSTALL/usr/bin +# cp $BUILD/$1*/source/bin/smbd $INSTALL/usr/bin +# mkdir -p $INSTALL/etc +# cp $PACKAGES/$1/config/smb.conf $INSTALL/etc/ +# fi diff --git a/packages/sysutils/samba/patches/10_debug-no-msg.diff b/packages/sysutils/samba/patches/10_debug-no-msg.diff new file mode 100644 index 0000000000..16f384570e --- /dev/null +++ b/packages/sysutils/samba/patches/10_debug-no-msg.diff @@ -0,0 +1,71 @@ +diff -Naur samba-3.0.25.orig/source/include/debug.h samba-3.0.25/source/include/debug.h +--- samba-3.0.25.orig/source/include/debug.h 2007-05-17 12:28:16.000000000 +0200 ++++ samba-3.0.25/source/include/debug.h 2007-05-17 12:31:32.000000000 +0200 +@@ -162,54 +162,18 @@ + * will remove the extra conditional test. + */ + +-#define DEBUGLVL( level ) \ +- ( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) +- +- +-#define DEBUGLVLC( dbgc_class, level ) \ +- ( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) +- +- +-#define DEBUG( level, body ) \ +- (void)( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ +- && (dbgtext body) ) +- +-#define DEBUGC( dbgc_class, level, body ) \ +- (void)( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && (dbghdr( level, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ +- && (dbgtext body) ) +- +-#define DEBUGADD( level, body ) \ +- (void)( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && (dbgtext body) ) +- +-#define DEBUGADDC( dbgc_class, level, body ) \ +- (void)( ((level) <= MAX_DEBUG_LEVEL) && \ +- ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ +- (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ +- DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ +- && (dbgtext body) ) +- +-/* Print a separator to the debug log. */ +-#define DEBUGSEP(level)\ +- DEBUG((level),("===============================================================\n")) ++#define DEBUGLVL( level ) (0) ++ ++#define DEBUGLVLC( dbgc_class, level ) (0) ++ ++#define DEBUG( level, body ) ((void)0) ++ ++#define DEBUGC( dbgc_class, level, body ) ((void)0) ++ ++#define DEBUGADD( level, body ) ((void)0) ++ ++#define DEBUGADDC( dbgc_class, level, body ) ((void)0) ++ ++#define DEBUGSEP( level ) ((void)0) + + #endif diff --git a/packages/sysutils/samba/patches/11_error-msg.diff b/packages/sysutils/samba/patches/11_error-msg.diff new file mode 100644 index 0000000000..be47398640 --- /dev/null +++ b/packages/sysutils/samba/patches/11_error-msg.diff @@ -0,0 +1,12 @@ +diff -Naur samba-3.0.25.orig/source/libsmb/clierror.c samba-3.0.25/source/libsmb/clierror.c +--- samba-3.0.25.orig/source/libsmb/clierror.c 2007-05-17 12:28:16.000000000 +0200 ++++ samba-3.0.25/source/libsmb/clierror.c 2007-05-17 12:32:35.000000000 +0200 +@@ -159,7 +159,7 @@ + if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) { + NTSTATUS status = NT_STATUS(IVAL(cli->inbuf,smb_rcls)); + +- return nt_errstr(status); ++ return "NT_STATUS_UNSUCCESSFUL"; + } + + cli_dos_error(cli, &errclass, &errnum); diff --git a/packages/sysutils/samba/patches/20_crosscompile.diff b/packages/sysutils/samba/patches/20_crosscompile.diff new file mode 100644 index 0000000000..ffa1d46bc8 --- /dev/null +++ b/packages/sysutils/samba/patches/20_crosscompile.diff @@ -0,0 +1,16 @@ +diff -Naur samba-3.0.20.orig/source/configure samba-3.0.20/source/configure +--- samba-3.0.20.orig/source/configure 2005-08-19 22:09:01.000000000 +0300 ++++ samba-3.0.20/source/configure 2005-08-23 13:51:06.000000000 +0300 +@@ -18731,11 +18731,7 @@ + *linux*) + # glibc <= 2.3.2 has a broken getgrouplist + if test "$cross_compiling" = yes; then +- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&5 +-echo "$as_me: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&2;} +- { (exit 1); exit 1; }; } ++ linux_getgrouplist_ok=no + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ diff --git a/packages/sysutils/samba/patches/30_smbtree-diskonly.diff b/packages/sysutils/samba/patches/30_smbtree-diskonly.diff new file mode 100644 index 0000000000..cfd258e301 --- /dev/null +++ b/packages/sysutils/samba/patches/30_smbtree-diskonly.diff @@ -0,0 +1,73 @@ +diff -Naur samba-3.0.28a/source/utils/smbtree.c samba-3.0.28a.edit/source/utils/smbtree.c +--- samba-3.0.28a/source/utils/smbtree.c 2008-04-05 16:11:02.000000000 +0200 ++++ samba-3.0.28a.edit/source/utils/smbtree.c 2008-04-05 16:10:17.000000000 +0200 +@@ -181,16 +181,18 @@ + } + + +-static BOOL get_shares(char *server_name, struct user_auth_info *user_info) ++static BOOL get_shares(char *server_name, struct in_addr *server_ip, struct user_auth_info *user_info) + { + struct cli_state *cli; + + if (!(cli = get_ipc_connect(server_name, NULL, user_info))) + return False; + ++ *server_ip = cli->dest_ip; ++ + if (get_rpc_shares(cli, add_name, &shares)) + return True; +- ++ + if (!cli_RNetShareEnum(cli, add_name, &shares)) + return False; + +@@ -200,7 +202,8 @@ + static BOOL print_tree(struct user_auth_info *user_info) + { + struct name_list *wg, *sv, *sh; +- ++ struct in_addr server_ip; ++ + /* List workgroups */ + + if (!get_workgroups(user_info)) +@@ -208,8 +211,6 @@ + + for (wg = workgroups; wg; wg = wg->next) { + +- printf("%s\n", wg->name); +- + /* List servers */ + + free_name_list(servers); +@@ -221,21 +222,23 @@ + + for (sv = servers; sv; sv = sv->next) { + +- printf("\t\\\\%-15s\t\t%s\n", +- sv->name, sv->comment); +- + /* List shares */ + + free_name_list(shares); + shares = NULL; + + if (level == LEV_SERVER || +- !get_shares(sv->name, user_info)) ++ !get_shares(sv->name, &server_ip, user_info)) + continue; + + for (sh = shares; sh; sh = sh->next) { +- printf("\t\t\\\\%s\\%-15s\t%s\n", +- sv->name, sh->name, sh->comment); ++ if (sh->server_type == STYPE_DISKTREE && ++ sh->name[strlen(sh->name)-1] != '$') { ++ printf("%s/%s/%s\n", ++ sv->name, inet_ntoa(server_ip), ++ sh->name); ++ fflush(stdout); ++ } + } + } + } diff --git a/packages/sysutils/samba/patches/40_oplocks.diff b/packages/sysutils/samba/patches/40_oplocks.diff new file mode 100644 index 0000000000..ace93f7a42 --- /dev/null +++ b/packages/sysutils/samba/patches/40_oplocks.diff @@ -0,0 +1,17 @@ +--- SAMBA_3_2/source/modules/vfs_default.c (revision 23961) ++++ SAMBA_3_2/source/modules/vfs_default.c (revision 23962) +@@ -826,10 +826,11 @@ + + START_PROFILE(syscall_linux_setlease); + +-#ifdef LINUX ++#ifdef HAVE_KERNEL_OPLOCKS_LINUX + /* first set the signal handler */ +- if(linux_set_lease_sighandler(fd) == -1) ++ if(linux_set_lease_sighandler(fd) == -1) { + return -1; ++ } + + result = linux_setlease(fd, leasetype); + #else + diff --git a/packages/sysutils/samba/scripts/automount_samba b/packages/sysutils/samba/scripts/automount_samba new file mode 100755 index 0000000000..9fa8013ae3 --- /dev/null +++ b/packages/sysutils/samba/scripts/automount_samba @@ -0,0 +1,62 @@ +#!/bin/sh + +# +# Samba AutoMounter +# + +MOUNT_POINT=/mnt/shares + +mount_samba () { + user=$1 + pass=$2 + name=$3 + ip=$4 + shift 4 + while [ $# -gt 0 ]; do + dir="$MOUNT_POINT/$name/$1" + if [ ! -e "$dir" ]; then + mkdir -p "$dir" + mount "//$ip/$1" "$dir" -t cifs -o "ro,iocharset=utf8,user=$user,pass=$pass" || mount.cifs "//$name/$1" "$dir" -o "ro,iocharset=utf8,ip=$ip,username=$user,passwd=$pass" || rmdir -p "$dir" + fi + shift + done +} + +do_static_mount () { + for STATIC_SMB in `sed -n "s/^STATIC_SMB=\"\(.*\)\"/\1/p" /etc/network`; do + ( + USER=`echo $STATIC_SMB | sed "s/<%>.*//"` + PASS=`echo $STATIC_SMB | sed -e "s/.*<%>//" -e "s/<@>.*//"` + IP=`echo $STATIC_SMB | sed -e "s/.*<@>//" -e "s/<&>.*//"` + NAME=`echo $STATIC_SMB | sed -e "s/.*<&>//" -e "s/<#>.*//"` + MOUNTS="`echo $STATIC_SMB | sed "s/.*$NAME<#>//" | sed "s/<#>/ /g"`" + mount_samba "$USER" "$PASS" "$NAME" "$IP" $MOUNTS + )& + done +} + +do_dynamic_mount () { + . /etc/network + OPT="-N" + test -n "$SMB_USER" && OPT="-U$SMB_USER%$SMB_PWD" + saveifs=$IFS + smbtree "$OPT" | while read mounts; do + ( + IFS=/ + mount_samba "$SMB_USER" "$SMB_PWD" $mounts + IFS=$saveifs + )& + done +} + +. /etc/network.scripts + +wait_for_network + +if [ "$1" = static ]; then + do_static_mount +else + do_dynamic_mount +fi + +exit 0 diff --git a/packages/sysutils/samba/unpack b/packages/sysutils/samba/unpack new file mode 100755 index 0000000000..6e37bf489e --- /dev/null +++ b/packages/sysutils/samba/unpack @@ -0,0 +1,6 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/fixconfigtools $PKG_BUILD/source +mkdir "`ls -d $PKG_BUILD/source`/bin" diff --git a/packages/sysutils/samba/url b/packages/sysutils/samba/url new file mode 100644 index 0000000000..94d5bda48a --- /dev/null +++ b/packages/sysutils/samba/url @@ -0,0 +1 @@ +http://us1.samba.org/samba/ftp/stable/samba-3.0.33.tar.gz