SUMMARY = "Example recipe for using inherit useradd" DESCRIPTION = "This recipe serves as an example for using features from useradd.bbclass" SECTION = "examples" PR = "r1" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SRC_URI = "file://dot.bashrc \ file://dot.profile \ " S = "${WORKDIR}" #PACKAGES =+ "${PN}-user3 ${PN}-root" 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}" #USERADD_PACKAGES = "${PN} ${PN}-user3 ${PN}-root" # You must also set USERADD_PARAM and/or GROUPADD_PARAM when # you inherit useradd. # 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 1000 -m -d /home/avs -r -s /bin/bash -P 'avs123!@#' avs" # user3 will be managed in the useradd-example-user3 pacakge: # As an example, we use the -P option to set clear text password for user3 #USERADD_PARAM_${PN}-user3 = "-u 1202 -d /home/user3 -r -s /bin/bash -P 'user3' user3" # root will be managed in the useradd-root pacakge: # As an example, we use the -P option to set clear text password for root #USERADD_PARAM_${PN}-root = "-u 0 -d /home/root -r -s /bin/bash -P '123321' root" # 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} = "-g 881 group1; -g 890 group2" # Likewise, we'll manage group3 in the useradd-example-user3 package: #GROUPADD_PARAM_${PN}-user3 = "-g 900 group3" # Likewise, we'll manage group3 in the useradd-example-root package: #GROUPADD_PARAM_${PN}-root = "-g 0 root" do_install_append() { install -m 0755 -o root -g root -d ${D}/home/root/ install -m 0755 -o root -g root ${S}/dot.bashrc ${D}/home/root/.bashrc install -m 0755 -o root -g root ${S}/dot.profile ${D}/home/root/.profile install -d -m 755 ${D}/home/avs/ install -m 0755 -o avs -g avs ${S}/dot.bashrc ${D}/home/avs/.bashrc install -m 0755 -o avs -g avs ${S}/dot.profile ${D}/home/avs/.profile } # ALLOW_EMPTY_${PN} = "1" FILES_${PN} = "/home/root/.bashrc /home/root/.profile /home/avs/.bashrc /home/avs/.profile" # Prevents do_package failures with: # debugsources.list: No such file or directory: INHIBIT_PACKAGE_DEBUG_SPLIT = "1"