From d5fd04587c41d3369bfb70a1fec6a6615f7b086a Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Fri, 24 Nov 2023 23:07:15 +0800 Subject: [PATCH] net-fs/ksmbd-tools: new package, add 3.5.1 --- net-fs/ksmbd-tools/Manifest | 1 + net-fs/ksmbd-tools/files/confd | 5 ++ net-fs/ksmbd-tools/files/initd | 32 +++++++++ net-fs/ksmbd-tools/files/ksmbd.confd | 8 +++ net-fs/ksmbd-tools/files/ksmbd.initd | 41 +++++++++++ net-fs/ksmbd-tools/ksmbd-tools-3.5.1.ebuild | 75 +++++++++++++++++++++ net-fs/ksmbd-tools/metadata.xml | 16 +++++ 7 files changed, 178 insertions(+) create mode 100644 net-fs/ksmbd-tools/Manifest create mode 100644 net-fs/ksmbd-tools/files/confd create mode 100644 net-fs/ksmbd-tools/files/initd create mode 100644 net-fs/ksmbd-tools/files/ksmbd.confd create mode 100644 net-fs/ksmbd-tools/files/ksmbd.initd create mode 100644 net-fs/ksmbd-tools/ksmbd-tools-3.5.1.ebuild create mode 100644 net-fs/ksmbd-tools/metadata.xml diff --git a/net-fs/ksmbd-tools/Manifest b/net-fs/ksmbd-tools/Manifest new file mode 100644 index 0000000..d1fb959 --- /dev/null +++ b/net-fs/ksmbd-tools/Manifest @@ -0,0 +1 @@ +DIST ksmbd-tools-3.5.1.tar.gz 91503 BLAKE2B d6de1ee2ed3a24232c1152b66306e285c80309c17d058585eafa9f11e9c4f33f30471da440274ef4a4072853298bc1ed4a409eebddb6502dbffcbb5d5fc6c378 SHA512 817824e434a840245300a1db16e01ead180ff6b5157589fec03a72f7a342d1646268a6316ba4cb5fd99b84a45927c8f34fdf7480ab6ee8f07727492e97067904 diff --git a/net-fs/ksmbd-tools/files/confd b/net-fs/ksmbd-tools/files/confd new file mode 100644 index 0000000..8124846 --- /dev/null +++ b/net-fs/ksmbd-tools/files/confd @@ -0,0 +1,5 @@ +# /etc/conf.d/ksmbd: config file for /etc/init.d/ksmbd +# + +# Full path to config file. /etc/ksmbd/smb.conf is default if not set. +#KSMBD_CONF="/etc/ksmbd/smb.conf" diff --git a/net-fs/ksmbd-tools/files/initd b/net-fs/ksmbd-tools/files/initd new file mode 100644 index 0000000..f65770e --- /dev/null +++ b/net-fs/ksmbd-tools/files/initd @@ -0,0 +1,32 @@ +#!/sbin/openrc-run +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +KSMBD_CONF="${KSMBD_CONF:-/etc/ksmbd/smb.conf}" + +depend() { + need localmount + use net +} + +description="ksmbd userspace daemon" + +command="/sbin/ksmbd.mountd" +command_control="/sbin/ksmbd.control" +command_args="-s" + +required_files="${KSMBD_CONF}" + +start_pre() { + /sbin/modprobe ksmbd || return 1 +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + "${command_control}" -s + eend $? +} + +stop_post() { + /sbin/modprobe -r -q ksmbd || return 0 +} diff --git a/net-fs/ksmbd-tools/files/ksmbd.confd b/net-fs/ksmbd-tools/files/ksmbd.confd new file mode 100644 index 0000000..cc014a0 --- /dev/null +++ b/net-fs/ksmbd-tools/files/ksmbd.confd @@ -0,0 +1,8 @@ +# /etc/conf.d/ksmbd: config file for /etc/init.d/ksmbd +# + +# Full path to config file. /etc/ksmbd/ksmbd.conf is default if not set. +#KSMBD_CONF="/etc/ksmbd/ksmbd.conf" + +# Extra options to pass to ksmbd.mountd(8) at startup +#KSMBD_OPTS="" diff --git a/net-fs/ksmbd-tools/files/ksmbd.initd b/net-fs/ksmbd-tools/files/ksmbd.initd new file mode 100644 index 0000000..86feb90 --- /dev/null +++ b/net-fs/ksmbd-tools/files/ksmbd.initd @@ -0,0 +1,41 @@ +#!/sbin/openrc-run +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +KSMBD_CONF="${KSMBD_CONF:-/etc/ksmbd/ksmbd.conf}" +KSMBD_OPTS="${KSMBD_OPTS:-}" + +depend() { + need localmount + use net +} + +description="ksmbd userspace daemon" + +command="/sbin/ksmbd.mountd" +command_control="/sbin/ksmbd.control" +command_args="--config=${KSMBD_CONF} ${KSMBD_OPTS}" + +extra_started_commands="reload" + +required_files="${KSMBD_CONF}" + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + "${command_control}" --reload + eend $? +} + +start_pre() { + /sbin/modprobe -q ksmbd || return 0 +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + "${command_control}" --shutdown + eend $? +} + +stop_post() { + /sbin/modprobe -r -q ksmbd || return 0 +} diff --git a/net-fs/ksmbd-tools/ksmbd-tools-3.5.1.ebuild b/net-fs/ksmbd-tools/ksmbd-tools-3.5.1.ebuild new file mode 100644 index 0000000..1d3b506 --- /dev/null +++ b/net-fs/ksmbd-tools/ksmbd-tools-3.5.1.ebuild @@ -0,0 +1,75 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools linux-info systemd + +DESCRIPTION="cifsd/ksmbd kernel server userspace utilities" +HOMEPAGE="https://github.com/cifsd-team/ksmbd-tools" +SRC_URI="https://github.com/cifsd-team/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv" + +DEPEND=" + dev-libs/glib:2 + dev-libs/libnl:3 +" + +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +pkg_setup() { + # we don't want to die() here to be able to build binpkgs + kernel_is -lt 5 15 && eerror "kernel >= 5.15 required for ${PN}" + CONFIG_CHECK="~SMB_SERVER" + ERROR_SMB_SERVER="CONFIG_SMB_SERVER is not set: ksmbd is not enabled in kernel, ${PN} will not work" + # use krb5 && CONFIG_CHECK+=" ~SMB_SERVER_KERBEROS5" + linux-info_pkg_setup +} + +src_prepare() { + eautoreconf + default +} + +src_configure() { + # TODO: add kerberos support, explicitly disable for now + # tools are expected to reside in /sbin, not /usr/sbin + econf \ + --prefix="${EPREFIX:-}" \ + --enable-krb5=no \ + --libexecdir="${EPREFIX}/usr/libexec" \ + --with-rundir="${EPREFIX}/run" \ + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" +} + +src_install() { + default + + local DOCS=( README.md ksmbd.conf.example ) + einstalldocs + + insinto /etc/ksmbd + doins ksmbd.conf.example + + newinitd "${FILESDIR}/ksmbd.initd" ksmbd + newconfd "${FILESDIR}/ksmbd.confd" ksmbd + + dosym ksmbd.addshare /sbin/smbshareadd + dosym ksmbd.adduser /sbin/smbuseradd +} + +pkg_postinst() { + local ver + for ver in ${REPLACING_VERSIONS}; do + if ver_test ${ver} -lt 3.4.6; then + ewarn "Upgrade from version <${CATEGORY}/${PN}-3.4.6 detected" + ewarn "${PN} config file moved to ${EPREFIX}/etc/ksmbd/ksmbd.conf" + ewarn "Please migrate from old ${EPREFIX}/etc/ksmbd/smb.conf" + fi + done + unset ver +} diff --git a/net-fs/ksmbd-tools/metadata.xml b/net-fs/ksmbd-tools/metadata.xml new file mode 100644 index 0000000..191c21a --- /dev/null +++ b/net-fs/ksmbd-tools/metadata.xml @@ -0,0 +1,16 @@ + + + + + gyakovlev@gentoo.org + Georgy Yakovlev + + + cifsd-team/ksmbd-tools + + + KSMBD is a linux kernel server which implements SMB3 protocol in kernel space for sharing files over network. + ksmbd.mountd is userspace process to transfer user account and password that are registered using ksmbd.adduser (part of this package). + Further it allows sharing information parameters that parsed from smb.conf to ksmbd in kernel. + +