blob: 078e23c6eddb47f20377c5e5160611b0b275075e [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "An open source remote desktop protocol(rdp) server."
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://COPYING;md5=72cfbe4e7bd33a0a1de9630c91195c21 \
5"
6
Brad Bishop8410d612019-11-25 09:40:59 -05007inherit features_check autotools pkgconfig useradd systemd
Brad Bishop316dfdd2018-06-25 12:45:53 -04008
9DEPENDS = "openssl virtual/libx11 libxfixes libxrandr libpam nasm-native"
10
11REQUIRED_DISTRO_FEATURES = "x11 pam"
12
Andrew Geissler72956ed2021-01-08 16:11:14 -060013SRC_URI = "git://github.com/neutrinolabs/xrdp.git;branch=devel \
Brad Bishop316dfdd2018-06-25 12:45:53 -040014 file://xrdp.sysconfig \
Brad Bishop316dfdd2018-06-25 12:45:53 -040015 file://0001-Added-req_distinguished_name-in-etc-xrdp-openssl.con.patch \
16 file://0001-Fix-the-compile-error.patch \
Andrew Geissler72956ed2021-01-08 16:11:14 -060017 file://0001-riscv-doesn-t-require-pointers-to-be-aligned.patch \
18 file://0001-correct-the-location-of-errno.h.patch \
19 file://0001-Fixed-compiler-warnings-about-snprintf-truncations.patch \
Brad Bishop316dfdd2018-06-25 12:45:53 -040020 "
Andrew Geissler72956ed2021-01-08 16:11:14 -060021SRCREV = "1469d659dbccd6d042ac44f0afc4e1309788dc9d"
Brad Bishop316dfdd2018-06-25 12:45:53 -040022
23S = "${WORKDIR}/git"
24
25PACKAGECONFIG ??= ""
26PACKAGECONFIG[fuse] = " --enable-fuse, --disable-fuse, fuse"
27
28USERADD_PACKAGES = "${PN}"
29GROUPADD_PARAM_${PN} = "--system xrdp"
30USERADD_PARAM_${PN} = "--system --home /var/run/xrdp -g xrdp \
31 --no-create-home --shell /bin/false xrdp"
32
33FILES_${PN} += "${datadir}/dbus-1/services/*.service \
34 ${datadir}/dbus-1/accessibility-services/*.service "
35
36FILES_${PN}-dev += "${libdir}/xrdp/libcommon.so \
37 ${libdir}/xrdp/libxrdp.so \
38 ${libdir}/xrdp/libscp.so \
39 ${libdir}/xrdp/libxrdpapi.so "
40
41EXTRA_OECONF = "--enable-pam-config=suse"
42
43do_configure_prepend() {
44 cd ${S}
45 ./bootstrap
46 cd -
47}
48
49do_compile_prepend() {
50 sed -i 's/(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am/(MAKE) $(AM_MAKEFLAGS) install-exec-am/g' ${S}/keygen/Makefile.in
51}
52
53
54do_install_append() {
Andrew Geissler72956ed2021-01-08 16:11:14 -060055 install -d ${D}${sysconfdir}
Brad Bishop316dfdd2018-06-25 12:45:53 -040056 install -d ${D}${sysconfdir}/xrdp
57 install -d ${D}${sysconfdir}/xrdp/pam.d
58 install -d ${D}${sysconfdir}/sysconfig/xrdp
Andrew Geissler72956ed2021-01-08 16:11:14 -060059
Brad Bishop316dfdd2018-06-25 12:45:53 -040060 # deal with systemd unit files
61 install -d ${D}${systemd_unitdir}/system
62 install -m 0644 ${S}/instfiles/xrdp.service.in ${D}${systemd_unitdir}/system/xrdp.service
Andrew Geissler72956ed2021-01-08 16:11:14 -060063 install -m 0644 ${S}/instfiles/xrdp-sesman.service.in ${D}${systemd_unitdir}/system/xrdp-sesman.service
Brad Bishop316dfdd2018-06-25 12:45:53 -040064 sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
65 sed -i -e 's,@sysconfdir@,${sysconfdir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
66 sed -i -e 's,@sbindir@,${sbindir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
67
68 install -m 0644 ${S}/instfiles/*.ini ${D}${sysconfdir}/xrdp/
Brad Bishopb809eb92019-09-18 06:27:43 -040069 install -m 0644 ${S}/sesman/sesman.ini.in ${D}${sysconfdir}/xrdp/
Brad Bishop316dfdd2018-06-25 12:45:53 -040070 install -m 0644 ${S}/sesman/startwm.sh ${D}${sysconfdir}/xrdp/
Brad Bishopb809eb92019-09-18 06:27:43 -040071 install -m 0644 ${S}/xrdp/xrdp.ini.in ${D}${sysconfdir}/xrdp/
Brad Bishop316dfdd2018-06-25 12:45:53 -040072 install -m 0644 ${S}/xrdp/xrdp_keyboard.ini ${D}${sysconfdir}/xrdp/
Brad Bishop316dfdd2018-06-25 12:45:53 -040073 install -m 0644 ${S}/keygen/openssl.conf ${D}${sysconfdir}/xrdp/
74 install -m 0644 ${WORKDIR}/xrdp.sysconfig ${D}${sysconfdir}/sysconfig/xrdp/
75 chown xrdp:xrdp ${D}${sysconfdir}/xrdp
76}
77
78SYSTEMD_SERVICE_${PN} = "xrdp.service xrdp-sesman.service"
79
80pkg_postinst_${PN}() {
81 if test -z "$D"
82 then
83 if test -x ${bindir}/xrdp-keygen
84 then
85 ${bindir}/xrdp-keygen xrdp ${sysconfdir}/xrdp/rsakeys.ini >/dev/null
86 fi
87 if test ! -s ${sysconfdir}/xrdp/cert.pem
88 then
89 openssl req -x509 -newkey rsa:2048 -sha256 -nodes -days 3652 \
90 -keyout ${sysconfdir}/xrdp/key.pem \
91 -out ${sysconfdir}/xrdp/cert.pem \
92 -config ${sysconfdir}/xrdp/openssl.conf >/dev/null 2>&1
93 chmod 400 ${sysconfdir}/xrdp/key.pem
Andrew Geissler72956ed2021-01-08 16:11:14 -060094 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -040095 fi
96}