jobextra/samba/PKGBUILD

234 lines
9.9 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=samba
pkgname=('libwbclient' 'smbclient' 'samba')
pkgver=4.18.2
pkgrel=02
url="https://www.samba.org"
makedepends=('python' 'python-markdown' 'python-dnspython' 'docbook-xsl' 'pkg-config' 'libbsd' 'popt' 'libcups'
'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb' 'krb5' 'pam'
'gnutls' 'talloc' 'tdb' 'dbus'
'perl-parse-yapp' 'libnsl' 'libtirpc' 'rpcsvc-proto' 'jansson'
'liburing' 'perl-json' 'glusterfs')
optdepends=( 'python-dnspython: samba_dnsupdate and samba_upgradedns in AD setup'
'python-markdown: for samba-tool domain schemeupgrade'
'glusterfs: for vfs_glusterfs support')
# us1 is a US only mirror the official download site is listed here, different than ARCH's mirror source
source=(https://download.samba.org/samba/ftp/stable/${pkgbase}-${pkgver}.tar{.gz,.asc}
samba.logrotate
samba.pam
samba.sysconfig
samba.tmpfiles)
### UNINSTALL dmapi package before building!!!
#prepare() {
# cd samba-${pkgver}
# patch -Np1 -i ${srcdir}/samba-4.17.0-15195.patch
#}
# Use samba-pkg as a staging directory for the split packages
# (This is so RPATHS and symlinks are generated correctly via
# make install, but the otherwise unsplit pieces can be split)
build() {
_pkgsrc="${srcdir}"/samba-pkg
rm -rf ${_pkgsrc}
_samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
_samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
_samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
cd samba-${pkgver}
./configure --enable-fhs \
--prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/bin \
--libdir=/usr/lib \
--libexecdir=/usr/lib/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 \
--without-systemd \
--with-pam \
--with-pammodulesdir=/usr/lib/security \
--bundled-libraries=!tdb,!talloc,!pytalloc-util,!tevent,!popt,!ldb,!pyldb-util \
--with-shared-modules=${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules},vfs_io_uring \
--disable-rpath-install \
--with-profiling-data \
--enable-fhs
# Add this to the options once it's working...
#--with-system-mitkrb5 /opt/heimdal
make
make DESTDIR="${_pkgsrc}/" install
# This gets skipped somehow
if [ ! -e "${_pkgsrc}"/usr/bin/smbtar ]; then
install -m755 "${srcdir}"/samba-${pkgver}/source3/script/smbtar "${_pkgsrc}"/usr/bin/
fi
}
package_libwbclient() {
pkgdesc="winbind client library w/o systemd"
depends=('libbsd')
_pkgsrc="${srcdir}"/samba-pkg
install -d -m755 "${pkgdir}"/usr/lib
for lib in "${_pkgsrc}"/usr/lib/libwbclient.so*; do
mv ${lib} "${pkgdir}"/usr/lib/
done
install -d -m755 "${pkgdir}"/usr/lib/pkgconfig
mv "${_pkgsrc}"/usr/lib/pkgconfig/wbclient.pc "${pkgdir}"/usr/lib/pkgconfig/
install -d -m755 "${pkgdir}"/usr/include/samba-4.0
mv "${_pkgsrc}"/usr/include/samba-4.0/wbclient.h "${pkgdir}"/usr/include/samba-4.0/
}
package_smbclient() {
pkgdesc="Tools to access a server's filespace and printers via SMB w/o systemd"
depends=('popt' 'cifs-utils' 'tdb' 'ldb'
'tevent' 'python' 'talloc' 'readline' 'gnutls'
'libbsd' 'libldap' 'libcups' 'libarchive' 'libnsl' 'jansson'
'libldb.so' 'libtdb.so' 'libtevent.so' 'libreadline.so' 'icu')
_smbclient_bins=('smbclient' 'rpcclient' 'smbspool'
'smbtree' 'smbcacls' 'smbcquotas' 'smbget' 'net'
'nmblookup' 'smbtar')
_pkgsrc="${srcdir}"/samba-pkg
install -d -m755 "${pkgdir}"/usr/bin
for bin in ${_smbclient_bins[@]}; do
mv "${_pkgsrc}"/usr/bin/${bin} "${pkgdir}"/usr/bin/
done
# smbclient binaries link to the majority of the samba
# libs, so this is a shortcut instead of resolving the
# whole dependency tree by hand
install -d -m755 "${pkgdir}"/usr/lib
for lib in "${_pkgsrc}"/usr/lib/lib*.so*; do
mv ${lib} "${pkgdir}"/usr/lib/
done
install -d -m755 "${pkgdir}"/usr/lib/samba
for lib in "${_pkgsrc}"/usr/lib/samba/lib*.so*; do
mv ${lib} "${pkgdir}"/usr/lib/samba/
done
install -d -m755 "${pkgdir}"/usr/lib/pkgconfig
mv "${_pkgsrc}"/usr/lib/pkgconfig/smbclient.pc "${pkgdir}"/usr/lib/pkgconfig/
mv "${_pkgsrc}"/usr/lib/pkgconfig/netapi.pc "${pkgdir}"/usr/lib/pkgconfig/
# mv "${_pkgsrc}"/usr/lib/pkgconfig/wbclient.pc "${pkgdir}"/usr/lib/pkgconfig/
install -d -m755 "${pkgdir}"/usr/share/man/man1
install -d -m755 "${pkgdir}"/usr/share/man/man7
install -d -m755 "${pkgdir}"/usr/share/man/man8
for bin in ${_smbclient_bins[@]}; do
if [ -e "${_pkgsrc}"/usr/share/man/man1/${bin}.1 ]; then
mv "${_pkgsrc}"/usr/share/man/man1/${bin}.1 "${pkgdir}"/usr/share/man/man1/
fi
if [ -e "${_pkgsrc}"/usr/share/man/man8/${bin}.8 ]; then
mv "${_pkgsrc}"/usr/share/man/man8/${bin}.8 "${pkgdir}"/usr/share/man/man8/
fi
done
mv "${_pkgsrc}"/usr/share/man/man7/libsmbclient.7 "${pkgdir}"/usr/share/man/man7/
install -d -m755 "${pkgdir}"/usr/include/samba-4.0
mv "${_pkgsrc}"/usr/include/samba-4.0/libsmbclient.h "${pkgdir}"/usr/include/samba-4.0/
mv "${_pkgsrc}"/usr/include/samba-4.0/netapi.h "${pkgdir}"/usr/include/samba-4.0/
# mv "${_pkgsrc}"/usr/include/samba-4.0/wbclient.h "${pkgdir}"/usr/include/samba-4.0/
mkdir -p "${pkgdir}"/usr/lib/cups/backend
ln -sf /usr/bin/smbspool "${pkgdir}"/usr/lib/cups/backend/smb
}
package_samba() {
pkgdesc="SMB Fileserver and AD Domain server w/o systemd"
depends=('popt' 'libcups' 'libcap>=2.16' 'gnutls>=2.4.1'
'talloc' 'ldb' 'libbsd' 'python' 'iniparser' 'tdb' 'perl-parse-yapp' "smbclient>=$pkgver" 'gpgme'
'libldb.so' 'libtdb.so' 'libtevent.so' 'liburing' 'libunwind' 'libwbclient' )
optdepends=('python-dnspython: netads_dns.py, dnsresolver.py and traffic_packets.py '
'python-markdown: ms_schema_markdown.py and ms_forest_updates_markdown.py'
"python-cryptography: lockout_tests.py gp_cert_auto_enroll_ext.py \
gpo.py and kcrypto.py")
backup=(etc/logrotate.d/samba
etc/pam.d/samba
etc/conf.d/samba)
install=samba.install
# Everything that libwbclient and smbclient didn't install goes
# into the samba package...
mv "${_pkgsrc}"/* "${pkgdir}"
rmdir "${_pkgsrc}"
# Make admin scripts look in the right place for the samba python module
for script in bin/samba_dnsupdate bin/samba_kcc bin/samba_spnupdate \
bin/samba_upgradedns bin/samba-tool
do
sed -i "/^sys\.path\.insert/ a\
sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \
"${pkgdir}"/usr/${script}
done
## packaging/wscript_build to use /etc/conf.d
#sed -i -e '/^EnvironmentFile/ s/sysconfig/conf.d/' "${pkgdir}"/usr/lib/systemd/system/*.service
install -d -m755 "${pkgdir}"/etc/conf.d
install -m644 "${srcdir}"/samba.sysconfig "${pkgdir}"/etc/conf.d/samba
# create ephemeral dirs via tmpfiles rather than shipping them in package
install -D -m644 "${srcdir}"/samba.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/samba.conf
# create config dir
install -d -m755 "${pkgdir}"/etc/samba
mkdir -p "${pkgdir}"/etc/samba/private
chmod 700 "${pkgdir}"/etc/samba/private
install -D -m644 "${srcdir}"/samba.logrotate "${pkgdir}"/etc/logrotate.d/samba
install -D -m644 "${srcdir}"/samba.pam "${pkgdir}"/etc/pam.d/samba
# spool directory
install -d -m1777 "${pkgdir}"/var/spool/samba
rm -rf "${pkgdir}"/run
rm -rf "${pkgdir}"/var/run
rm -rf "${pkgdir}"/etc/sysconfig
# copy ldap example
install -D -m644 "$srcdir"/samba-$pkgver/examples/LDAP/samba.schema "$pkgdir"/usr/share/doc/samba/examples/LDAP/samba.schema
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL3')
validpgpkeys=('81F5E2832BD2545A1897B713AA99442FB680B620') #Samba Distribution Verification Key <samba-bugs@samba.org>
sha256sums=(5bf87e179616cd12a52d85fb8b26eec709f13709a2b67fe42b1fb0213f7e8106 # samba-4.18.2.tar.gz
ac2136b397ccc6b1504f8c46b382eb7a1510da4282f6695dc78e4b42527d2b45 # samba-4.18.2.tar.asc
0b570570ea49f82e6f9da47b1cce3b441859f52de105b54d4d79b873b924623f # samba.logrotate
57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5 # samba.pam
f2d11032015ef917f4af50f3933d432fa744b5f846ab4d980247e329e52d34bc # samba.sysconfig
5398a42ccb36ac3b87cfa42c8050b535efc2ca38ab3b9354a52f4e0fe71b5800) # samba.tmpfiles
sha512sums=('e13f1313ae23c65580f3d9eec8ba556f77327d4876f09387a1701dc62df5c7c18955ed42a50250c0ebd53d90afcfdea2743dc6776b63c900c47239afacfa4aba'
'SKIP'
'2ba0691ded467e4d6e40821f6de58c00f8962209efe2e60284c0c87756ab471c22c3d63b77d506e48c90ed0d852a2a24e41be1d499cf74a73cb99da0b503c858'
'1e6183ab0eb812b3ef687ac2c26ce78f7cb30540f606d20023669ac00ba04075487fb72e4dc89cc05dab0269ff6aca98fc1167cc75669c225b88b592482fbf67'
SKIP
SKIP)
## ef60025198d1965cf929de4001adbf140038997f4a13c201429191a432e3ae7c libwbclient-4.18.2-02-x86_64.pkg.tar.lz
## 68eddf852075e972c16622e22fc8694dab4a6826f70af82b10150ada65bf35fc samba-4.18.2-02-x86_64.pkg.tar.lz
## 1ca9de58a43daa4edc5986a04f59c44a58e4adc0e1b452ee644b1544467d42ab smbclient-4.18.2-02-x86_64.pkg.tar.lz