[oe-commits] [meta-openembedded] 29/60: adduser: always add -M option for useradd
git at git.openembedded.org
git at git.openembedded.org
Mon Oct 24 16:05:19 UTC 2016
martin_jansa pushed a commit to branch master-next
in repository meta-openembedded.
commit 9a83c342abeb242df70d55c116363094c6f0da80
Author: Jackie Huang <jackie.huang at windriver.com>
AuthorDate: Wed Oct 19 13:00:57 2016 +0800
adduser: always add -M option for useradd
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, the previous patch added -M option conditionally,
which worked but we see a confused message:
"The home directory `/home/newuser' already exists. Not copying from `/etc/skel'"
So change it to always add the -M option for useradd and let
adduser handle the home creation with its logic.
Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
meta-perl/recipes-perl/adduser/adduser_3.115.bb | 2 +-
...-M-option-for-useradd-when-no-create-home.patch | 57 ----------------------
.../files/adduser-add-M-option-for-useradd.patch | 45 +++++++++++++++++
3 files changed, 46 insertions(+), 58 deletions(-)
diff --git a/meta-perl/recipes-perl/adduser/adduser_3.115.bb b/meta-perl/recipes-perl/adduser/adduser_3.115.bb
index 312bad8..81068d6 100644
--- a/meta-perl/recipes-perl/adduser/adduser_3.115.bb
+++ b/meta-perl/recipes-perl/adduser/adduser_3.115.bb
@@ -7,7 +7,7 @@ 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.xz \
- file://adduser-add-M-option-for-useradd-when-no-create-home.patch \
+ file://adduser-add-M-option-for-useradd.patch \
"
SRC_URI[md5sum] = "6bb6d93922d281f1b56393a53f8ce5fd"
diff --git a/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch b/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch
deleted file mode 100644
index 4b0a03f..0000000
--- a/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 809f00a6ef0224b41b2e1207194c8da3cd3e3c7e Mon Sep 17 00:00:00 2001
-From: Jackie Huang <jackie.huang at windriver.com>
-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 <jackie.huang at windriver.com>
----
- 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
-
diff --git a/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd.patch b/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd.patch
new file mode 100644
index 0000000..2ecec51
--- /dev/null
+++ b/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd.patch
@@ -0,0 +1,45 @@
+From 55a0adfc416ad85dbc440eaa667d98c200a8ce62 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang at windriver.com>
+Date: Thu, 18 Dec 2014 17:23:37 +0800
+Subject: [PATCH] adduser: add -M option for useradd
+
+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 or it will try to create home twice and
+throw a confused message:
+"The home directory `/home/newuser' already exists. Not copying from `/etc/skel'"
+
+Upstream-Status: Submitted [1]
+
+[1] https://lists.alioth.debian.org/pipermail/adduser-devel/2016-October/005478.html
+
+Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
+---
+ adduser | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/adduser b/adduser
+index a5f83f3..f6cb52c 100755
+--- a/adduser
++++ b/adduser
+@@ -435,7 +435,7 @@ if ($action eq "addsysuser") {
+ $undouser = $new_name;
+ my $useradd = &which('useradd');
+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+- $shell, '-u', $new_uid, $new_name);
++ $shell, '-u', $new_uid, '-M', $new_name);
+ if(!$disabled_login) {
+ my $usermod = &which('usermod');
+ &systemcall($usermod, '-p', '*', $new_name);
+@@ -525,7 +525,7 @@ if ($action eq "adduser") {
+ $undouser = $new_name;
+ my $useradd = &which('useradd');
+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
+- $shell, '-u', $new_uid, $new_name);
++ $shell, '-u', $new_uid, '-M', $new_name);
+ &invalidate_nscd();
+
+ create_homedir (1); # copy skeleton data
+--
+1.8.5.2
+
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list