Skip to contentSkip to conversation

adduser: add new recipe

PATCH Superseded [email protected] 2 participants 3 messages Dec 19, 2014 – Jan 12, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adduser: add new recipe

From: Jackie Huang <[email protected]>

This is a utility from debain to add users/groups to the system, which is actually a perl wrapper of the useradd/groupadd command.

We want this to replace the same commands provided by busybox.

Homepage: https://alioth.debian.org/projects/adduser

---
 .../recipes-perl/adduser/adduser_3.113+nmu3.bb     | 53 ++++++++++++++++++++
 ...-M-option-for-useradd-when-no-create-home.patch | 57 ++++++++++++++++++++++
 2 files changed, 110 insertions(+)
 create mode 100644 meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb
 create mode 100644 meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +53 -0
new file mode 100644
index 0000000..2ba74b0
@@ -0,0 +1,53 @@
+SUMMARY = "a utility to add users/groups to the system"
+DESCRIPTION = "adduser, addgroup - add a user or group to the system"
+HOMEPAGE = "http://alioth.debian.org/projects/adduser/"
+SECTION = "base/utils"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=caed49ab166f22ef31bf1127f558d0ef"
+
+SRC_URI = "http://ftp.de.debian.org/debian/pool/main/a/${BPN}/${BPN}_${PV}.tar.gz \
+           file://adduser-add-M-option-for-useradd-when-no-create-home.patch \
+"
+
+SRC_URI[md5sum] = "ccb5864bde56683182c89c44474e7182"
+SRC_URI[sha256sum] = "02682be3f51f3e732121f20a3e4922bb8bef15cfacb8767fc250a01d09502122"
+
+inherit cpan-base update-alternatives
+
+do_install() {
+	install -d ${D}${sbindir}
+	install -m 0755 ${S}/adduser ${D}${sbindir}
+	install -m 0755 ${S}/deluser ${D}${sbindir}
+
+	install -d ${D}${libdir}/perl/${PERLVERSION}/Debian
+	install -m 0644 ${S}/AdduserCommon.pm ${D}${libdir}/perl/${PERLVERSION}/Debian
+	sed -i -e "s/VERSION/${PV}/" ${D}${sbindir}/*
+
+	install -d ${D}/${sysconfdir}
+	install -m 0644 ${S}/*.conf ${D}/${sysconfdir}
+
+	install -d ${D}${mandir}/man5
+	install -m 0644 ${S}/doc/*.conf.5 ${D}${mandir}/man5
+	install -d ${D}${mandir}/man8
+	install -m 0644 ${S}/doc/*.8 ${D}${mandir}/man8
+	install -d ${D}${docdir}/${BPN}
+	cp -rf ${S}/examples ${D}${docdir}/${BPN}
+}
+
+RDEPENDS_${PN} += "\
+	shadow \
+	perl-module-getopt-long \
+	perl-module-overloading \
+	perl-module-file-find \
+	perl-module-file-temp \
+"
+
+ALTERNATIVE_${PN} = "adduser deluser addgroup delgroup"
+ALTERNATIVE_PRIORITY = "60"
+ALTERNATIVE_LINK_NAME[adduser] = "${sbindir}/adduser"
+ALTERNATIVE_LINK_NAME[deluser] = "${sbindir}/deluser"
+ALTERNATIVE_LINK_NAME[addgroup] = "${sbindir}/addgroup"
+ALTERNATIVE_LINK_NAME[delgroup] = "${sbindir}/delgroup"
+ALTERNATIVE_TARGET[addgroup] = "${sbindir}/adduser.${BPN}"
+ALTERNATIVE_TARGET[delgroup] = "${sbindir}/deluser.${BPN}"
meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 49 lines · On Fri, Dec 19, 2014 at 02:14:56PM +0800, [email protected] wrote:

From: Jackie Huang <[email protected]>

This is a utility from debain to add users/groups to the system, which is actually a perl wrapper of the useradd/groupadd command.

We want this to replace the same commands provided by busybox.

Homepage: https://alioth.debian.org/projects/adduser

---
 .../recipes-perl/adduser/adduser_3.113+nmu3.bb     | 53 ++++++++++++++++++++
 ...-M-option-for-useradd-when-no-create-home.patch | 57 ++++++++++++++++++++++
 2 files changed, 110 insertions(+)
 create mode 100644 meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb
 create mode 100644 meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +26 -0
new file mode 100644
index 0000000..2ba74b0
@@ -0,0 +1,53 @@
+SUMMARY = "a utility to add users/groups to the system"
+DESCRIPTION = "adduser, addgroup - add a user or group to the system"
+HOMEPAGE = "http://alioth.debian.org/projects/adduser/"
+SECTION = "base/utils"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=caed49ab166f22ef31bf1127f558d0ef"
+
+SRC_URI = "http://ftp.de.debian.org/debian/pool/main/a/${BPN}/${BPN}_${PV}.tar.gz \
+           file://adduser-add-M-option-for-useradd-when-no-create-home.patch \
+"
+
+SRC_URI[md5sum] = "ccb5864bde56683182c89c44474e7182"
+SRC_URI[sha256sum] = "02682be3f51f3e732121f20a3e4922bb8bef15cfacb8767fc250a01d09502122"
+
+inherit cpan-base update-alternatives
+
+do_install() {
+	install -d ${D}${sbindir}
+	install -m 0755 ${S}/adduser ${D}${sbindir}
+	install -m 0755 ${S}/deluser ${D}${sbindir}
+
+	install -d ${D}${libdir}/perl/${PERLVERSION}/Debian
+	install -m 0644 ${S}/AdduserCommon.pm ${D}${libdir}/perl/${PERLVERSION}/Debian
+	sed -i -e "s/VERSION/${PV}/" ${D}${sbindir}/*
+

meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb line 36

Quoted 10 lines
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +10 -0
+	install -d ${D}/${sysconfdir}
+	install -m 0644 ${S}/*.conf ${D}/${sysconfdir}
+
+	install -d ${D}${mandir}/man5
+	install -m 0644 ${S}/doc/*.conf.5 ${D}${mandir}/man5
+	install -d ${D}${mandir}/man8
+	install -m 0644 ${S}/doc/*.8 ${D}${mandir}/man8
+	install -d ${D}${docdir}/${BPN}
+	cp -rf ${S}/examples ${D}${docdir}/${BPN}
+}

Use 4 spaces for indentation.

Quoted 88 lines
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +17 -0
+
+RDEPENDS_${PN} += "\
+	shadow \
+	perl-module-getopt-long \
+	perl-module-overloading \
+	perl-module-file-find \
+	perl-module-file-temp \
+"
+
+ALTERNATIVE_${PN} = "adduser deluser addgroup delgroup"
+ALTERNATIVE_PRIORITY = "60"
+ALTERNATIVE_LINK_NAME[adduser] = "${sbindir}/adduser"
+ALTERNATIVE_LINK_NAME[deluser] = "${sbindir}/deluser"
+ALTERNATIVE_LINK_NAME[addgroup] = "${sbindir}/addgroup"
+ALTERNATIVE_LINK_NAME[delgroup] = "${sbindir}/delgroup"
+ALTERNATIVE_TARGET[addgroup] = "${sbindir}/adduser.${BPN}"
+ALTERNATIVE_TARGET[delgroup] = "${sbindir}/deluser.${BPN}"
meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch new file +57 -0
new file mode 100644
index 0000000..4b0a03f
@@ -0,0 +1,57 @@
+From 809f00a6ef0224b41b2e1207194c8da3cd3e3c7e Mon Sep 17 00:00:00 2001
+From: Jackie Huang <[email protected]>
+Date: Thu, 18 Dec 2014 17:23:37 +0800
+Subject: [PATCH] adduser: add -M option for useradd when --no-create-home is specified
+
+The useradd (from package passwd) in debian based system sets -M (--no-create-home) by default,
+but the one we are using (from package shadow) sets -m (--create-home) by default, so we
+need to explicitly add -M option for useradd call when --no-create-home is specified for adduser.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jackie Huang <[email protected]>
+---
+ adduser |   20 ++++++++++++++++----
+ 1 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/adduser b/adduser
+index c3bd8b0..9a07f9f 100755
+--- a/adduser
++++ b/adduser
+@@ -434,8 +434,14 @@ if ($action eq "addsysuser") {
+     $shell = $special_shell || '/bin/false';
+     $undouser = $new_name;
+     my $useradd = &which('useradd');
+-    &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+-		$shell, '-u', $new_uid, $new_name);
++    if ($no_create_home) {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++		    $shell, '-u', $new_uid, '-M', $new_name);
++    }
++    else {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++                    $shell, '-u', $new_uid, $new_name);
++    }
+     if(!$disabled_login) {
+         my $usermod = &which('usermod');
+         &systemcall($usermod, '-p', '*', $new_name);
+@@ -524,8 +530,14 @@ if ($action eq "adduser") {
+ 	$shell = $special_shell || $config{"dshell"};
+     $undouser = $new_name;
+     my $useradd = &which('useradd');
+-    &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+-		$shell, '-u', $new_uid, $new_name);
++    if ($no_create_home) {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++	    	    $shell, '-u', $new_uid, '-M', $new_name);
++    }
++    else {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++	    	    $shell, '-u', $new_uid, $new_name);
++    }
+     &invalidate_nscd();
+ 
+     create_homedir (1); # copy skeleton data
+-- 
+1.7.1
+
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw
Quoted 67 lines

-----Original Message-----
From: [email protected] [mailto:openembedded-devel- [email protected]] On Behalf Of Martin Jansa
Sent: Monday, January 05, 2015 8:23 PM
To: [email protected]
Subject: Re: [oe] [meta-perl][PATCH] adduser: add new recipe

Quoted 57 lines · On Fri, Dec 19, 2014 at 02:14:56PM +0800, [email protected] wrote:

From: Jackie Huang <[email protected]>

This is a utility from debain to add users/groups to the system, which is actually a perl wrapper of the useradd/groupadd command.

We want this to replace the same commands provided by busybox.

Homepage: https://alioth.debian.org/projects/adduser

---
 .../recipes-perl/adduser/adduser_3.113+nmu3.bb     | 53 ++++++++++++++++++++
 ...-M-option-for-useradd-when-no-create-home.patch | 57
++++++++++++++++++++++
 2 files changed, 110 insertions(+)
 create mode 100644
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb
 create mode 100644

meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd- when-no-create-home.patch

meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +29 -0
new file mode 100644
index 0000000..2ba74b0
@@ -0,0 +1,53 @@
+SUMMARY = "a utility to add users/groups to the system"
+DESCRIPTION = "adduser, addgroup - add a user or group to the system"
+HOMEPAGE = "http://alioth.debian.org/projects/adduser/"
+SECTION = "base/utils"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=caed49ab166f22ef31bf1127f558d0ef"
+
+SRC_URI = "http://ftp.de.debian.org/debian/pool/main/a/${BPN}/${BPN}_${PV}.tar.gz \
+
+file://adduser-add-M-option-for-useradd-when-no-create-home.patch \ "
+
+SRC_URI[md5sum] = "ccb5864bde56683182c89c44474e7182"
+SRC_URI[sha256sum] = "02682be3f51f3e732121f20a3e4922bb8bef15cfacb8767fc250a01d09502122"
+
+inherit cpan-base update-alternatives
+
+do_install() {
+	install -d ${D}${sbindir}
+	install -m 0755 ${S}/adduser ${D}${sbindir}
+	install -m 0755 ${S}/deluser ${D}${sbindir}
+
+	install -d ${D}${libdir}/perl/${PERLVERSION}/Debian
+	install -m 0644 ${S}/AdduserCommon.pm ${D}${libdir}/perl/${PERLVERSION}/Debian
+	sed -i -e "s/VERSION/${PV}/" ${D}${sbindir}/*
+
+	install -d ${D}/${sysconfdir}
+	install -m 0644 ${S}/*.conf ${D}/${sysconfdir}
+
Quoted 8 lines

meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb

Quoted 6 lines
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +6 -0
+	install -d ${D}${mandir}/man5
+	install -m 0644 ${S}/doc/*.conf.5 ${D}${mandir}/man5
+	install -d ${D}${mandir}/man8
+	install -m 0644 ${S}/doc/*.8 ${D}${mandir}/man8
+	install -d ${D}${docdir}/${BPN}
+	cp -rf ${S}/examples ${D}${docdir}/${BPN} }

Use 4 spaces for indentation.

Sure, I will change and send v2.

Thanks,
Jackie

Quoted 100 lines
Quoted 29 lines
meta-perl/recipes-perl/adduser/adduser_3.113+nmu3.bb new file +17 -0
+
+RDEPENDS_${PN} += "\
+	shadow \
+	perl-module-getopt-long \
+	perl-module-overloading \
+	perl-module-file-find \
+	perl-module-file-temp \
+"
+
+ALTERNATIVE_${PN} = "adduser deluser addgroup delgroup"
+ALTERNATIVE_PRIORITY = "60"
+ALTERNATIVE_LINK_NAME[adduser] = "${sbindir}/adduser"
+ALTERNATIVE_LINK_NAME[deluser] = "${sbindir}/deluser"
+ALTERNATIVE_LINK_NAME[addgroup] = "${sbindir}/addgroup"
+ALTERNATIVE_LINK_NAME[delgroup] = "${sbindir}/delgroup"
+ALTERNATIVE_TARGET[addgroup] = "${sbindir}/adduser.${BPN}"
+ALTERNATIVE_TARGET[delgroup] = "${sbindir}/deluser.${BPN}"

diff --git a/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-userad d-when-no-create-home.patch b/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-userad d-when-no-create-home.patch
new file mode 100644
index 0000000..4b0a03f

meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-us new file +1 -0
+++ eradd-when-no-create-home.patch

meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-us line 10

Quoted 10 lines
meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-us new file +10 -0
@@ -0,0 +1,57 @@
+From 809f00a6ef0224b41b2e1207194c8da3cd3e3c7e Mon Sep 17 00:00:00
+2001
+From: Jackie Huang <[email protected]>
+Date: Thu, 18 Dec 2014 17:23:37 +0800
+Subject: [PATCH] adduser: add -M option for useradd when
+--no-create-home is specified
+
+The useradd (from package passwd) in debian based system sets -M
+(--no-create-home) by default, but the one we are using (from package
+shadow) sets -m (--create-home) by default, so we need to explicitly add -M option for useradd

call when --no-create-home is specified for adduser.

Quoted 52 lines
meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-us new file +49 -1
+
+Upstream-Status: Pending
+
+Signed-off-by: Jackie Huang <[email protected]>
+---
+ adduser |   20 ++++++++++++++++----
+ 1 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/adduser b/adduser
+index c3bd8b0..9a07f9f 100755
+--- a/adduser
++++ b/adduser
+@@ -434,8 +434,14 @@ if ($action eq "addsysuser") {
+     $shell = $special_shell || '/bin/false';
+     $undouser = $new_name;
+     my $useradd = &which('useradd');
+-    &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+-		$shell, '-u', $new_uid, $new_name);
++    if ($no_create_home) {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++		    $shell, '-u', $new_uid, '-M', $new_name);
++    }
++    else {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++                    $shell, '-u', $new_uid, $new_name);
++    }
+     if(!$disabled_login) {
+         my $usermod = &which('usermod');
+         &systemcall($usermod, '-p', '*', $new_name); @@ -524,8
++530,14 @@ if ($action eq "adduser") {
+ 	$shell = $special_shell || $config{"dshell"};
+     $undouser = $new_name;
+     my $useradd = &which('useradd');
+-    &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+-		$shell, '-u', $new_uid, $new_name);
++    if ($no_create_home) {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++	    	    $shell, '-u', $new_uid, '-M', $new_name);
++    }
++    else {
++        &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
++	    	    $shell, '-u', $new_uid, $new_name);
++    }
+     &invalidate_nscd();
+
+     create_homedir (1); # copy skeleton data
+--
+1.7.1
+
--

1.9.1

Quoted 5 lines

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]