diff mbox

[2/2] Provide PAM default configuration files when building linux-pam package

Message ID 1345001603-16774-2-git-send-email-golubovsky@gmail.com
State Superseded
Headers show

Commit Message

Dimitry Golubovsky Aug. 15, 2012, 3:33 a.m. UTC
Signed-off-by: Dmitry <golubovsky@gmail.com>
---
 package/linux-pam/default      |    8 ++++++++
 package/linux-pam/linux-pam.mk |    8 ++++++++
 package/linux-pam/login        |    9 +++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 package/linux-pam/default
 create mode 100644 package/linux-pam/login

Comments

Arnout Vandecappelle Aug. 23, 2012, 9:22 p.m. UTC | #1
On 08/15/12 05:33, Dmitry wrote:
> +define LINUX_PAM_CONFFILES
> +	mkdir -p $(TARGET_DIR)/etc/pam.d
> +	cp $($(PKG)_DIR_PREFIX)/$(RAWNAME)/default $(TARGET_DIR)/etc/pam.d
> +	cp $($(PKG)_DIR_PREFIX)/$(RAWNAME)/login $(TARGET_DIR)/etc/pam.d
> +endef

  We normally hard-code the directory name: the build is always executed from
the buildroot directory, and the package directory normally doesn't change.
So:
	cp package/linux-pam/default $(TARGET_DIR)/etc/pam.d
This will also allow you to do it in the post-install hook.

  Also, I would use $(INSTALL) instead of cp (but that's personal preference,
cp is used in other places as well):
	$(INSTALL) -D -m 0644 package/linux-pam/default $(TARGET_DIR)/etc/pam.d/default
(since it uses -D, the mkdir can be removed).

  Regards,
  Arnout
Dimitry Golubovsky Aug. 23, 2012, 10:33 p.m. UTC | #2
Arnout,

On Thu, Aug 23, 2012 at 5:22 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>  We normally hard-code the directory name: the build is always executed from
> the buildroot directory, and the package directory normally doesn't change.
> So:
>         cp package/linux-pam/default $(TARGET_DIR)/etc/pam.d
> This will also allow you to do it in the post-install hook.

I try to avoid any hardcoding. Would it be better to make RAWNAME also
available at the install phase?

>
>  Also, I would use $(INSTALL) instead of cp (but that's personal preference,
> cp is used in other places as well):
>         $(INSTALL) -D -m 0644 package/linux-pam/default
> $(TARGET_DIR)/etc/pam.d/default
> (since it uses -D, the mkdir can be removed).

Thanks for the suggestion. I hope to also get Thomas' opinion and if
there are further improvement suggestions I'll try to incorporate
yours as well.

Thanks.
diff mbox

Patch

diff --git a/package/linux-pam/default b/package/linux-pam/default
new file mode 100644
index 0000000..0bd5ba0
--- /dev/null
+++ b/package/linux-pam/default
@@ -0,0 +1,8 @@ 
+#
+# default; standard UN*X access
+#
+auth     required       pam_unix.so
+account  required       pam_unix.so
+password required       pam_unix.so
+session  required       pam_unix.so
+
diff --git a/package/linux-pam/linux-pam.mk b/package/linux-pam/linux-pam.mk
index 48cb073..99161c6 100644
--- a/package/linux-pam/linux-pam.mk
+++ b/package/linux-pam/linux-pam.mk
@@ -24,4 +24,12 @@  ifeq ($(BR2_PACKAGE_LIBINTL),y)
 	LINUX_PAM_MAKE_OPT += LIBS=-lintl
 endif
 
+define LINUX_PAM_CONFFILES
+	mkdir -p $(TARGET_DIR)/etc/pam.d
+	cp $($(PKG)_DIR_PREFIX)/$(RAWNAME)/default $(TARGET_DIR)/etc/pam.d
+	cp $($(PKG)_DIR_PREFIX)/$(RAWNAME)/login $(TARGET_DIR)/etc/pam.d
+endef
+
+LINUX_PAM_POST_PATCH_HOOKS = LINUX_PAM_CONFFILES
+
 $(eval $(autotools-package))
diff --git a/package/linux-pam/login b/package/linux-pam/login
new file mode 100644
index 0000000..d65a9d4
--- /dev/null
+++ b/package/linux-pam/login
@@ -0,0 +1,9 @@ 
+#
+# login: allow local logins to users with entries in /etc/passwd and
+# /etc/shadow even with null password
+#
+auth      required       pam_unix.so nullok
+account   required       pam_unix.so nullok
+password  required       pam_unix.so nullok
+session   required       pam_unix.so nullok
+