From 93132a17c8288eb2381cdc24a17f595909ad4cd5 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Fri, 13 Mar 2026 19:36:51 +0200 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ check-version.sh | 11 +++++ pkg.info | 97 ++++++++++++++++++++++++++++++++++++++ source-files/samba.esv | 6 +++ source.sh | 104 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 221 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 pkg.info create mode 100644 source-files/samba.esv create mode 100644 source.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..1667727 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +URL="https://www.samba.org/ftp/samba" + +# Get version number from FTP server +VERSION=$(curl -s -L "$URL" | grep -o -E 'samba-[0-9]{1,}\.[0-9]{1,}(\.[0-9]{1,})?.tar.gz' | cut -d '-' -f2 | sort -V | tail -n1) + +# Remove '.tar.gz' suffix from VERSION variable +VERSION=${VERSION//.tar.gz/} + +echo "$VERSION" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..8a493da --- /dev/null +++ b/pkg.info @@ -0,0 +1,97 @@ +name: samba +description: SMB Fileserver and AD Domain server +version: 4.23.6 +revision: 1 +url: https://archlinux.org/packages/extra/x86_64/samba/ +license: GPL3-or-later +maintainers: + - enumdev@enumerated.dev +architecture: any +type: source +make_depends: + - acl + - dbus + - docbook-xsl-nons + - glusterfs + - gnutls + - icu + - jansson + - krb5 + - libbsd + - libcap + - libcups + - libnsl + - libtirpc + - liburing + - lmdb + - openldap + - pam + - perl-json + - perl-parse-yapp + - popt + - python3 + - python-dnspython + - python-markdown + - readline + - rpcsvc-proto + - talloc + - tdb + - tevent +downloads: + - url: https://download.samba.org/pub/samba/stable/samba-${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: e3dabd8b5e42dc97669fa0faef032510a94e496b58f7067082e5036d88f0e702 +split_packages: + - name: samba + depends: + - gnutls + - gpgme + - ldb + - libbsd + - libcap + - libcups + - liburing + - libwbclient + - popt + - smbclient + - talloc + - tdb + - tevent + optional_depends: + - python-dnspython + - python-markdown + - name: ldb + description: Schema-less, ldap like, API and database + depends: + - lmdb + - popt + - talloc + - tdb + optional_depends: + - python3:For python bindings + - name: libwbclient + description: Winbind client library + depends: + - libbsd + optional_depends: + - glusterfs + - name: smbclient + description: Tools to access a server's filespace and printers via SMB + depends: + - gnutls + - icu + - jansson + - ldb + - libarchive + - libbsd + - libcups + - libnsl + - libwbclient + - openldap + - popt + - python3 + - readline + - talloc + - tdb + - tevent diff --git a/source-files/samba.esv b/source-files/samba.esv new file mode 100644 index 0000000..125f501 --- /dev/null +++ b/source-files/samba.esv @@ -0,0 +1,6 @@ +name: samba +description: Samba SMB Daemon +type: background +start_cmd: /bin/sh -c "install -d /run/samba && exec /usr/sbin/nmbd -F -d=1 --no-process-group" +exit_method: kill +restart: true diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..37f2d49 --- /dev/null +++ b/source.sh @@ -0,0 +1,104 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + local _samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2 + local _samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4 + local _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4 + + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --libexecdir=/usr/libexec/samba \ + --localstatedir=/var \ + --with-configdir=/etc/samba \ + --with-lockdir=/var/cache/samba \ + --with-sockets-dir=/run/samba \ + --with-piddir=/run \ + --with-ads \ + --with-ldap \ + --with-winbind \ + --with-acl-support \ + --with-pam \ + --with-pammodulesdir=/usr/lib/security \ + --without-systemd \ + --enable-fhs \ + --private-libraries='!ldb' \ + --bundled-libraries='!tdb,!talloc,!pytalloc-util,!tevent,!popt,!pyldb-util' \ + --with-shared-modules="${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules},vfs_io_uring" \ + --disable-rpath-install \ + --with-profiling-data + + make +} + +_pick() { + local p="$1" f d; shift + for f; do + [ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; } + d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}" + mkdir -p "$(dirname "$d")" + mv "$f" "$d" + rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")" + done +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package_samba() { + make DESTDIR="$BPM_OUTPUT" install + + cd "$BPM_OUTPUT" + + # Move ldb files into split package + local site_packages=$(python -c "import site; print(site.getsitepackages()[0])") + _pick ldb usr/bin/ldb* + _pick ldb usr/lib/libldb* + _pick ldb usr/lib/samba/ldb + _pick ldb usr/lib/pkgconfig/ldb.pc + _pick ldb usr/include/samba-4.0/ldb* + _pick ldb ./${site_packages}/{_ldb_text.py,ldb.cpython-$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')-$CARCH-linux-gnu.so} + _pick ldb usr/share/man/man1/ldb* + _pick ldb usr/share/man/man3 + + # Move libwbclient files into split package + _pick libwbclient usr/lib/libwbclient.so* + _pick libwbclient usr/lib/pkgconfig/wbclient.pc + _pick libwbclient usr/include/samba-4.0/wbclient.h + + # Move smbclient files into split package + _pick smbclient usr/bin/{smbclient,rpcclient,smbspool,smbtree,smbcacls,smbcquotas,smbget,net,nmblookup,smbtar} + _pick smbclient usr/lib/lib*.so* + _pick smbclient usr/lib/samba/lib*.so + _pick smbclient usr/lib/pkgconfig/{smbclient,netapi}.pc + _pick smbclient usr/include/samba-4.0/{libsmbclient,netapi}.h + _pick smbclient usr/share/man/man1/{smbclient,rpcclient,smbtree,smbcacls,smbcquotas,smbget,nmblookup,smbtar}.1 + _pick smbclient usr/share/man/man7/libsmbclient.7 + _pick smbclient usr/share/man/man8/{smbspool,net}.8 + + # Install esvm service + install -Dm644 "$BPM_WORKDIR"/samba.esv "$BPM_OUTPUT"/etc/esvm/services/samba.esv + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/samba/COPYING +} + +package_ldb() { + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/ldb/COPYING +} + +package_libwbclient() { + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/libwbclient/COPYING +} + +package_smbclient() { + install -d "$BPM_OUTPUT"/usr/lib/cups/backend + ln -sf /usr/bin/smbspool "$BPM_OUTPUT"/usr/lib/cups/backend/smb + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/smbclient/COPYING +}