Skip to contentSkip to conversation

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

PATCH New Torben Voltmer 1 participant 1 message Dec 2, 2024

lore
Share & tools
lore
#0 lore raw

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

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

---
 package/openssh/Config.in  | 10 +++++++++-
 package/openssh/openssh.mk | 12 +++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
package/openssh/Config.in +9 -1
index 25843447a7..70befd017a 100644
@@ -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"
package/openssh/openssh.mk +9 -3
index 95c059e03d..dd5946b795 100644
@@ -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
Signature · 5 lines
2.47.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot