summaryrefslogtreecommitdiff
path: root/recipes-core/useradd/useradd.bb
blob: cbc48e751783dc58246e1c064d22251f773915ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
SUMMARY = "Add mtadm user"
DESCRIPTION = "Add mtadm user for security purposes"
SECTION = "mtadm"
PR = "r1"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                    file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

S = "${WORKDIR}"

inherit useradd

# You must set USERADD_PACKAGES when you inherit useradd. This
# lists which output packages will include the user/group
# creation code.
#USERADD_PACKAGES = "${PN} ${PN}-user3"
USERADD_PACKAGES = "${PN}"

# You must also set USERADD_PARAM and/or GROUPADD_PARAM when
# you inherit useradd.

# GROUPADD_PARAM works the same way, which you set to the options
# you'd normally pass to the groupadd command. This will create
# groups group1 and group2:
GROUPADD_PARAM_${PN} = "-r  -g 27 sudo"

# USERADD_PARAM specifies command line options to pass to the
# useradd command. Multiple users can be created by separating
# the commands with a semicolon. Here we'll create two users,
# user1 and user2:
USERADD_PARAM_${PN} = "-u 50 -G sudo,disk -m -r -s /bin/bash mtadm"

do_install () {
        # If the recipe doesn't have a file, the ipk
        # is deleted, and it does nothing.
        # Create a .ssh directory for mtadm.
        install -d 0700 ${D}/home/mtadm/.ssh
	chown mtadm:mtadm ${D}/home/mtadm
	chown mtadm:mtadm ${D}/home/mtadm/.ssh
}

FILES_${PN} = "/home/mtadm/.ssh"

# Prevents do_package failures with:
# debugsources.list: No such file or directory:
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"

pkg_postinst_${PN} () {
   profile=/home/mtadm/.profile
   if ! grep 'sbin' ${profile} ; then
     Sub='${PA'
     Sub=${Sub}'TH}:/sbin:/usr/sbin'
     echo 'PATH='${Sub} >>/home/mtadm/.profile
     echo 'export PATH'  >>/home/mtadm/.profile
   fi
}