package/zsh: add /bin/zsh to /etc/shells
authorRomain Naour <romain.naour@smile.fr>
Fri, 19 Jan 2018 10:15:06 +0000 (11:15 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Thu, 3 May 2018 21:15:06 +0000 (23:15 +0200)
When zsh is selected, /bin/zsh is not added to /etc/shells
(see man shells). So, login tools like dropbear reject the ssh
connections for users using zsh as shell in /etc/passwd.

buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/zsh/zsh.mk

index a45c61b9313db98a54e3118bd033ecc8e4864f56..e7988389226ec71d35c16548dd3941d517428390 100644 (file)
@@ -35,6 +35,14 @@ else
 ZSH_CONF_OPTS += --disable-pcre
 endif
 
+# Add /bin/zsh to /etc/shells otherwise some login tools like dropbear
+# can reject the user connection. See man shells.
+define ZSH_ADD_ZSH_TO_SHELLS
+       grep -qsE '^/bin/zsh$$' $(TARGET_DIR)/etc/shells \
+               || echo "/bin/zsh" >> $(TARGET_DIR)/etc/shells
+endef
+ZSH_TARGET_FINALIZE_HOOKS += ZSH_ADD_ZSH_TO_SHELLS
+
 # Remove versioned zsh-x.y.z binary taking up space
 define ZSH_TARGET_INSTALL_FIXUPS
        rm -f $(TARGET_DIR)/bin/zsh-$(ZSH_VERSION)