summaryrefslogtreecommitdiffstats
path: root/meta-perl
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2016-10-19 13:00:57 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2016-10-25 15:31:17 +0200
commitccec146c5218e27688262dc86c659301d8e1dee6 (patch)
tree7280f0e4bfb6ddaefcf6d6aa15665572e23430e1 /meta-perl
parentdd2748da79385e1b7280c0034f6128aabfd5a7dc (diff)
downloadmeta-openembedded-ccec146c5218e27688262dc86c659301d8e1dee6.tar.gz
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@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-perl')
-rw-r--r--meta-perl/recipes-perl/adduser/adduser_3.115.bb2
-rw-r--r--meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch57
-rw-r--r--meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd.patch45
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 312bad8d8..81068d600 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"
7LIC_FILES_CHKSUM = "file://debian/copyright;md5=caed49ab166f22ef31bf1127f558d0ef" 7LIC_FILES_CHKSUM = "file://debian/copyright;md5=caed49ab166f22ef31bf1127f558d0ef"
8 8
9SRC_URI = "http://ftp.de.debian.org/debian/pool/main/a/${BPN}/${BPN}_${PV}.tar.xz \ 9SRC_URI = "http://ftp.de.debian.org/debian/pool/main/a/${BPN}/${BPN}_${PV}.tar.xz \
10 file://adduser-add-M-option-for-useradd-when-no-create-home.patch \ 10 file://adduser-add-M-option-for-useradd.patch \
11" 11"
12 12
13SRC_URI[md5sum] = "6bb6d93922d281f1b56393a53f8ce5fd" 13SRC_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 4b0a03f02..000000000
--- a/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd-when-no-create-home.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 809f00a6ef0224b41b2e1207194c8da3cd3e3c7e Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 18 Dec 2014 17:23:37 +0800
4Subject: [PATCH] adduser: add -M option for useradd when --no-create-home is specified
5
6The useradd (from package passwd) in debian based system sets -M (--no-create-home) by default,
7but the one we are using (from package shadow) sets -m (--create-home) by default, so we
8need to explicitly add -M option for useradd call when --no-create-home is specified for adduser.
9
10Upstream-Status: Pending
11
12Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
13---
14 adduser | 20 ++++++++++++++++----
15 1 files changed, 16 insertions(+), 4 deletions(-)
16
17diff --git a/adduser b/adduser
18index c3bd8b0..9a07f9f 100755
19--- a/adduser
20+++ b/adduser
21@@ -434,8 +434,14 @@ if ($action eq "addsysuser") {
22 $shell = $special_shell || '/bin/false';
23 $undouser = $new_name;
24 my $useradd = &which('useradd');
25- &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
26- $shell, '-u', $new_uid, $new_name);
27+ if ($no_create_home) {
28+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
29+ $shell, '-u', $new_uid, '-M', $new_name);
30+ }
31+ else {
32+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
33+ $shell, '-u', $new_uid, $new_name);
34+ }
35 if(!$disabled_login) {
36 my $usermod = &which('usermod');
37 &systemcall($usermod, '-p', '*', $new_name);
38@@ -524,8 +530,14 @@ if ($action eq "adduser") {
39 $shell = $special_shell || $config{"dshell"};
40 $undouser = $new_name;
41 my $useradd = &which('useradd');
42- &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
43- $shell, '-u', $new_uid, $new_name);
44+ if ($no_create_home) {
45+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
46+ $shell, '-u', $new_uid, '-M', $new_name);
47+ }
48+ else {
49+ &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
50+ $shell, '-u', $new_uid, $new_name);
51+ }
52 &invalidate_nscd();
53
54 create_homedir (1); # copy skeleton data
55--
561.7.1
57
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 000000000..2ecec512f
--- /dev/null
+++ b/meta-perl/recipes-perl/adduser/files/adduser-add-M-option-for-useradd.patch
@@ -0,0 +1,45 @@
1From 55a0adfc416ad85dbc440eaa667d98c200a8ce62 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 18 Dec 2014 17:23:37 +0800
4Subject: [PATCH] adduser: add -M option for useradd
5
6The useradd (from package passwd) in debian based system sets -M (--no-create-home) by default,
7but the one we are using (from package shadow) sets -m (--create-home) by default, so we
8need to explicitly add -M option for useradd call or it will try to create home twice and
9throw a confused message:
10"The home directory `/home/newuser' already exists. Not copying from `/etc/skel'"
11
12Upstream-Status: Submitted [1]
13
14[1] https://lists.alioth.debian.org/pipermail/adduser-devel/2016-October/005478.html
15
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17---
18 adduser | 4 ++--
19 1 file changed, 2 insertions(+), 2 deletions(-)
20
21diff --git a/adduser b/adduser
22index a5f83f3..f6cb52c 100755
23--- a/adduser
24+++ b/adduser
25@@ -435,7 +435,7 @@ if ($action eq "addsysuser") {
26 $undouser = $new_name;
27 my $useradd = &which('useradd');
28 &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
29- $shell, '-u', $new_uid, $new_name);
30+ $shell, '-u', $new_uid, '-M', $new_name);
31 if(!$disabled_login) {
32 my $usermod = &which('usermod');
33 &systemcall($usermod, '-p', '*', $new_name);
34@@ -525,7 +525,7 @@ if ($action eq "adduser") {
35 $undouser = $new_name;
36 my $useradd = &which('useradd');
37 &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
38- $shell, '-u', $new_uid, $new_name);
39+ $shell, '-u', $new_uid, '-M', $new_name);
40 &invalidate_nscd();
41
42 create_homedir (1); # copy skeleton data
43--
441.8.5.2
45