diff mbox series

[1/1] package/openssh: split install of sshd and sftp-server

Message ID 20241202172344.3843005-1-mail@t-voltmer.net
State New
Headers show
Series [1/1] package/openssh: split install of sshd and sftp-server | expand

Commit Message

Torben Voltmer Dec. 2, 2024, 5:23 p.m. UTC
When using an ssh daemon other then the one provided by OpenSSH,
having the ability to install sftp-server separately can be useful.
For instance the Dropbear ssh daemon relies on an external sftp-server
implementation for sftp functionality.

So far, sshd, sshd-session and sftp-server could only be selected
together as BR2_PACKAGE_OPENSSH_SERVER.
By splitting the installation of the server components, installing
just the sftp-server executable is possible.

In order to not break existing configurations two steps were taken:
- BR2_PACKAGE_OPENSSH_SERVER was explicitly not renamed
- BR2_PACKAGE_OPENSSH_SERVER selects the new
  BR2_PACKAGE_OPENSSH_SFTP_SERVER config

Signed-off-by: Torben Voltmer <mail@t-voltmer.net>
---
 package/openssh/Config.in  | 10 +++++++++-
 package/openssh/openssh.mk | 12 +++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/package/openssh/Config.in b/package/openssh/Config.in
index 25843447a7..70befd017a 100644
--- a/package/openssh/Config.in
+++ b/package/openssh/Config.in
@@ -23,8 +23,16 @@  config BR2_PACKAGE_OPENSSH_SERVER
 	bool "server"
 	default y
 	select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_PACKAGE_OPENSSH_SFTP_SERVER
 	help
-	  Server programs: sshd, sftp-server
+	  Server programs: sshd, sshd-session
+
+config BR2_PACKAGE_OPENSSH_SFTP_SERVER
+	bool "sftp-server"
+	default y
+	select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  Server programs: sftp-server
 
 config BR2_PACKAGE_OPENSSH_KEY_UTILS
 	bool "key utilities"
diff --git a/package/openssh/openssh.mk b/package/openssh/openssh.mk
index 95c059e03d..dd5946b795 100644
--- a/package/openssh/openssh.mk
+++ b/package/openssh/openssh.mk
@@ -115,12 +115,11 @@  OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_CLIENT_PROGRAMS
 endif
 
 ifeq ($(BR2_PACKAGE_OPENSSH_SERVER),y)
-define OPENSSH_INSTALL_SERVER_PROGRAMS
+define OPENSSH_INSTALL_SSHD_SERVER_PROGRAMS
 	$(INSTALL) -D -m 0755 $(@D)/sshd $(TARGET_DIR)/usr/sbin/sshd
 	$(INSTALL) -D -m 0755 $(@D)/sshd-session $(TARGET_DIR)/usr/libexec/sshd-session
-	$(INSTALL) -D -m 0755 $(@D)/sftp-server $(TARGET_DIR)/usr/libexec/sftp-server
 endef
-OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_SERVER_PROGRAMS
+OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_SSHD_SERVER_PROGRAMS
 
 define OPENSSH_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 644 package/openssh/sshd.service \
@@ -134,6 +133,13 @@  define OPENSSH_INSTALL_INIT_SYSV
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_OPENSSH_SFTP_SERVER),y)
+define OPENSSH_INSTALL_SFTP_SERVER
+	$(INSTALL) -D -m 0755 $(@D)/sftp-server $(TARGET_DIR)/usr/libexec/sftp-server
+endef
+OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_SFTP_SERVER
+endif
+
 ifeq ($(BR2_PACKAGE_OPENSSH_KEY_UTILS),y)
 define OPENSSH_INSTALL_KEY_UTILS
 	$(INSTALL) -D -m 0755 $(@D)/ssh-keygen $(TARGET_DIR)/usr/bin/ssh-keygen