Patchwork [08/12] busybox: provide -passwd and -shadow packages

login
register
mail settings
Submitter Bernhard Reutner-Fischer
Date Jan. 3, 2011, 8:02 p.m.
Message ID <1294084926-3115-8-git-send-email-rep.dot.nop@gmail.com>
Download mbox | patch
Permalink /patch/161/
State Accepted
Headers show

Comments

Bernhard Reutner-Fischer - Jan. 3, 2011, 8:02 p.m.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 recipes/busybox/busybox.inc      |   28 ++++++++++++++++++++++++++++
 recipes/busybox/busybox_1.1x.inc |    2 ++
 recipes/busybox/files/passwd     |   11 +++++++++++
 recipes/busybox/files/shadow     |   11 +++++++++++
 4 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 recipes/busybox/files/passwd
 create mode 100644 recipes/busybox/files/shadow
Roman Khimov - Jan. 3, 2011, 9:01 p.m.
? ????????? ?? ??????????? 03 ?????? 2011 23:02:02 ????? Bernhard Reutner-
Fischer ???????:
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
> ---
>  recipes/busybox/busybox.inc      |   28 ++++++++++++++++++++++++++++
>  recipes/busybox/busybox_1.1x.inc |    2 ++
>  recipes/busybox/files/passwd     |   11 +++++++++++
>  recipes/busybox/files/shadow     |   11 +++++++++++
>  4 files changed, 52 insertions(+), 0 deletions(-)
>  create mode 100644 recipes/busybox/files/passwd
>  create mode 100644 recipes/busybox/files/shadow

I don't quite understand why is it needed. We have base-passwd for passwd (and 
group) and missing shadow usually is not an issue (if my memory serves me 
right, it'll be created on first usage). Then, speaking of base-passwd that 
needs to be updated to use alternatives if this goes in.
Bernhard Reutner-Fischer - Jan. 3, 2011, 9:13 p.m.
On Tue, Jan 04, 2011 at 12:01:24AM +0300, Roman I Khimov wrote:
>? ????????? ?? ??????????? 03 ?????? 2011 23:02:02 ????? Bernhard Reutner-
>Fischer ???????:
>> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
>> ---
>>  recipes/busybox/busybox.inc      |   28 ++++++++++++++++++++++++++++
>>  recipes/busybox/busybox_1.1x.inc |    2 ++
>>  recipes/busybox/files/passwd     |   11 +++++++++++
>>  recipes/busybox/files/shadow     |   11 +++++++++++
>>  4 files changed, 52 insertions(+), 0 deletions(-)
>>  create mode 100644 recipes/busybox/files/passwd
>>  create mode 100644 recipes/busybox/files/shadow
>
>I don't quite understand why is it needed. We have base-passwd for passwd (and 
>group) and missing shadow usually is not an issue (if my memory serves me 
>right, it'll be created on first usage). Then, speaking of base-passwd that 
>needs to be updated to use alternatives if this goes in.

I intend to use busybox-passwd as replacement for micro-image (will send
that as an RFC later tonight). I want micro-image to just contain the
bare minimum (and all of it provided by busybox).

Patch

diff --git a/recipes/busybox/busybox.inc b/recipes/busybox/busybox.inc
index eda5f95..97d6f78 100644
--- a/recipes/busybox/busybox.inc
+++ b/recipes/busybox/busybox.inc
@@ -23,6 +23,8 @@  SRC_URI = "\
   file://hwclock-default \
   file://ifupdown-spurious-environ.patch \
   file://mount.busybox \
+  file://passwd \
+  file://shadow \
   file://syslog \
   file://syslog.conf \
   file://udhcpscript.patch \
@@ -34,6 +36,7 @@  SRC_URI_append_nylon = " file://xargs-double-size.patch"
 export EXTRA_CFLAGS = "${CFLAGS}"
 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
 PACKAGES =+ "${PN}-mountall ${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
+PACKAGES =+ "${PN}-passwd ${PN}-shadow"
 
 # We need this RRECOMMENDS_${PN} because libc dlopens libgcc
 # and shlib mechanism can not detect it because its not
@@ -47,6 +50,8 @@  RDEPENDS_${PN} += "${PN}-mountall"
 RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
 
 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
+FILES_${PN}-passwd = "${sysconfdir}/passwd.${PN}"
+FILES_${PN}-shadow = "${sysconfdir}/shadow.${PN}"
 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog.${PN} ${sysconfdir}/syslog.conf"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 
@@ -64,6 +69,8 @@  CONFFILES_${PN}-syslog = "${sysconfdir}/syslog.conf"
 INITSCRIPT_PARAMS_${PN}-syslog_slugos = "start 20 ."
 
 RDEPENDS_${PN}-httpd += "${PN}"
+RDEPENDS_${PN}-passwd += "${PN}"
+RDEPENDS_${PN}-shadow += "${PN}-passwd"
 RDEPENDS_${PN}-syslog += "${PN}"
 RDEPENDS_${PN}-udhcpd += "${PN}"
 
@@ -177,6 +184,12 @@  do_install () {
 		fi
 	fi
 
+	if grep -q "CONFIG_PASSWD=y" ${WORKDIR}/defconfig; then
+	    install -m 0644 ${WORKDIR}/passwd ${D}${sysconfdir}/passwd.${PN}
+	    if grep -q "CONFIG_FEATURE_SHADOWPASSWDS=y" ${WORKDIR}/defconfig; then
+	        install -m 0640 ${WORKDIR}/shadow ${D}${sysconfdir}/shadow.${PN}
+            fi
+	fi
 	if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${PN}
 		install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
@@ -260,6 +273,21 @@  pkg_prerm_${PN}-mountall () {
 	update-alternatives --remove default_mountall mountall.${PN}
 }
 
+pkg_postinst_${PN}-passwd () {
+	update-alternatives --install ${sysconfdir}/passwd default_passwd passwd.${PN} 50
+}
+pkg_prerm_${PN}-passwd () {
+	update-alternatives --remove default_passwd passwd.${PN}
+}
+
+pkg_postinst_${PN}-shadow () {
+	update-alternatives --install ${sysconfdir}/shadow default_shadow shadow.${PN} 50
+}
+pkg_prerm_${PN}-shadow () {
+	update-alternatives --remove default_shadow shadow.${PN}
+}
+
+
 pkg_postinst_${PN}-syslog () {
 	update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
 
diff --git a/recipes/busybox/busybox_1.1x.inc b/recipes/busybox/busybox_1.1x.inc
index 079c784..4dbc3d9 100644
--- a/recipes/busybox/busybox_1.1x.inc
+++ b/recipes/busybox/busybox_1.1x.inc
@@ -17,6 +17,8 @@  SRC_URI = "\
   file://hwclock-default \
   file://mount.busybox \
   file://mountall \
+  file://passwd \
+  file://shadow \
   file://syslog \
   file://syslog.conf \
   file://umount.busybox \
diff --git a/recipes/busybox/files/passwd b/recipes/busybox/files/passwd
new file mode 100644
index 0000000..64c9ab6
--- /dev/null
+++ b/recipes/busybox/files/passwd
@@ -0,0 +1,11 @@ 
+root:x:0:0:root:/root:/bin/sh
+daemon:x:1:1:daemon:/usr/sbin:/bin/sh
+bin:x:2:2:bin:/bin:/bin/sh
+sys:x:3:3:sys:/dev:/bin/sh
+sync:x:4:65534:sync:/bin:/bin/sync
+man:x:6:12:man:/var/cache/man:/bin/sh
+mail:x:8:8:mail:/var/mail:/bin/sh
+www-data:x:33:33:www-data:/var/www:/bin/sh
+backup:x:34:34:backup:/var/backups:/bin/sh
+irc:x:39:39:ircd:/var/run/ircd:/bin/sh
+nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
diff --git a/recipes/busybox/files/shadow b/recipes/busybox/files/shadow
new file mode 100644
index 0000000..25df693
--- /dev/null
+++ b/recipes/busybox/files/shadow
@@ -0,0 +1,11 @@ 
+root::14741:0:99999:7:::
+daemon:*:14741:0:99999:7:::
+bin:*:14741:0:99999:7:::
+sys:*:14741:0:99999:7:::
+sync:*:14741:0:99999:7:::
+man:*:14741:0:99999:7:::
+mail:*:14741:0:99999:7:::
+www-data:*:14741:0:99999:7:::
+backup:*:14741:0:99999:7:::
+irc:*:14741:0:99999:7:::
+nobody:*:14741:0:99999:7:::