aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-installer/anaconda-init/anaconda-init.bb
blob: 61e31900accaf3acab87d0664e107c41a29747e2 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
DESCRIPTION = "Simple Init Script for Anaconda"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"

SRC_URI = "file://anaconda-init \
           file://anaconda-init.service \
           file://anaconda-init-screen@.service \
           file://anaconda-init.target \
           file://Xusername \
           file://COPYING"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

# For nm-online
#RDEPENDS_${PN} = "networkmanager-tests"

# For mount -oloop=/dev/loopX, busybox's mount doesn't support this.
RDEPENDS:${PN} = "util-linux"

# While systemd, we need screen to control anaconda-init first boot
RDEPENDS:${PN} += " \
    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'screen', '', d)} \
"

inherit systemd

SYSTEMD_SERVICE:${PN} = "anaconda-init.service \
                         anaconda-init-screen@.service \
                         anaconda-init.target \
"

CLEANBROKEN = "1"

do_install() {
    install -d ${D}/${sbindir}
    install -m 0755 ${WORKDIR}/anaconda-init ${D}${sbindir}/anaconda-init
    if [ -n "${EULA_DIR}" ]; then
        sed -i "s#@EULA_DIR@#${EULA_DIR}#g" ${D}${sbindir}/anaconda-init
    else
        bbwarn "EULA_DIR is NULL, please set it in a local conf"
        bbwarn "The EULA_DIR helps user to locate End User License Agreement during image installation"
        sed -i "s#@EULA_DIR@##g" ${D}${sbindir}/anaconda-init
    fi
    install -d ${D}/${sysconfdir}
    install -d ${D}/${sysconfdir}/init.d
    ln -sf ${sbindir}/anaconda-init ${D}/${sysconfdir}/init.d/anaconda-init
    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/anaconda-init.service \
                    ${WORKDIR}/anaconda-init-screen@.service \
                    ${WORKDIR}/anaconda-init.target \
               ${D}${systemd_unitdir}/system


    sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@ROOT_HOME@,${ROOT_HOME},g' ${D}${systemd_unitdir}/system/anaconda-init.service \
                                                                           ${D}${systemd_unitdir}/system/anaconda-init-screen@.service
    if [ "${ROOTLESS_X}" = "1" ] ; then
        install -d ${D}/etc/X11
        install Xusername ${D}/etc/X11
    fi
}

inherit update-rc.d useradd

INITSCRIPT_NAME = "anaconda-init"
INITSCRIPT_PARAMS = "start 30 2 3 4 5 . stop 20 0 1 6 ."

# Use fixed Xusername of xuser for now, this will need to be
# fixed if the Xusername changes from xuser
USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "--create-home \
                       --groups video,tty,audio \
                       --user-group xuser"

# Location of End User License Agreement
EULA_DIR ??= ""