blob: 3ef7c9853f6dbe2a7f20bff6b317b456f65b472b [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
7inherit distro_features_check autotools pkgconfig useradd systemd
8
9DEPENDS = "openssl virtual/libx11 libxfixes libxrandr libpam nasm-native"
10
11REQUIRED_DISTRO_FEATURES = "x11 pam"
12
13SRC_URI = "git://github.com/neutrinolabs/xrdp.git \
14 file://xrdp.sysconfig \
15 file://0001-Fix-sesman.ini-and-xrdp.ini.patch \
16 file://0001-Added-req_distinguished_name-in-etc-xrdp-openssl.con.patch \
17 file://0001-Fix-the-compile-error.patch \
18 file://0001-Fix-of-CVE-2017-16927.patch \
19 "
20
21SRCREV = "c295dd61b882e8b56677cf12791f43634f9190b5"
22
23PV = "0.9.4+git${SRCPV}"
24
25S = "${WORKDIR}/git"
26
27PACKAGECONFIG ??= ""
28PACKAGECONFIG[fuse] = " --enable-fuse, --disable-fuse, fuse"
29
30USERADD_PACKAGES = "${PN}"
31GROUPADD_PARAM_${PN} = "--system xrdp"
32USERADD_PARAM_${PN} = "--system --home /var/run/xrdp -g xrdp \
33 --no-create-home --shell /bin/false xrdp"
34
35FILES_${PN} += "${datadir}/dbus-1/services/*.service \
36 ${datadir}/dbus-1/accessibility-services/*.service "
37
38FILES_${PN}-dev += "${libdir}/xrdp/libcommon.so \
39 ${libdir}/xrdp/libxrdp.so \
40 ${libdir}/xrdp/libscp.so \
41 ${libdir}/xrdp/libxrdpapi.so "
42
43EXTRA_OECONF = "--enable-pam-config=suse"
44
45do_configure_prepend() {
46 cd ${S}
47 ./bootstrap
48 cd -
49}
50
51do_compile_prepend() {
52 sed -i 's/(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am/(MAKE) $(AM_MAKEFLAGS) install-exec-am/g' ${S}/keygen/Makefile.in
53}
54
55
56do_install_append() {
57 install -d ${D}${sysconfdir}
58 install -d ${D}${sysconfdir}/xrdp
59 install -d ${D}${sysconfdir}/xrdp/pam.d
60 install -d ${D}${sysconfdir}/sysconfig/xrdp
61
62 # deal with systemd unit files
63 install -d ${D}${systemd_unitdir}/system
64 install -m 0644 ${S}/instfiles/xrdp.service.in ${D}${systemd_unitdir}/system/xrdp.service
65 install -m 0644 ${S}/instfiles/xrdp-sesman.service.in ${D}${systemd_unitdir}/system/xrdp-sesman.service
66 sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
67 sed -i -e 's,@sysconfdir@,${sysconfdir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
68 sed -i -e 's,@sbindir@,${sbindir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
69
70 install -m 0644 ${S}/instfiles/*.ini ${D}${sysconfdir}/xrdp/
71 install -m 0644 ${S}/sesman/sesman.ini ${D}${sysconfdir}/xrdp/
72 install -m 0644 ${S}/sesman/startwm.sh ${D}${sysconfdir}/xrdp/
73 install -m 0644 ${S}/xrdp/xrdp.ini ${D}${sysconfdir}/xrdp/
74 install -m 0644 ${S}/xrdp/xrdp_keyboard.ini ${D}${sysconfdir}/xrdp/
75 install -m 0644 ${S}/instfiles/xrdp.sh ${D}${sysconfdir}/xrdp/
76 install -m 0644 ${S}/keygen/openssl.conf ${D}${sysconfdir}/xrdp/
77 install -m 0644 ${WORKDIR}/xrdp.sysconfig ${D}${sysconfdir}/sysconfig/xrdp/
78 chown xrdp:xrdp ${D}${sysconfdir}/xrdp
79}
80
81SYSTEMD_SERVICE_${PN} = "xrdp.service xrdp-sesman.service"
82
83pkg_postinst_${PN}() {
84 if test -z "$D"
85 then
86 if test -x ${bindir}/xrdp-keygen
87 then
88 ${bindir}/xrdp-keygen xrdp ${sysconfdir}/xrdp/rsakeys.ini >/dev/null
89 fi
90 if test ! -s ${sysconfdir}/xrdp/cert.pem
91 then
92 openssl req -x509 -newkey rsa:2048 -sha256 -nodes -days 3652 \
93 -keyout ${sysconfdir}/xrdp/key.pem \
94 -out ${sysconfdir}/xrdp/cert.pem \
95 -config ${sysconfdir}/xrdp/openssl.conf >/dev/null 2>&1
96 chmod 400 ${sysconfdir}/xrdp/key.pem
97 fi
98 fi
99}