Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | SUMMARY = "An open source remote desktop protocol(rdp) server." |
| 2 | |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=72cfbe4e7bd33a0a1de9630c91195c21 \ |
| 5 | " |
| 6 | |
| 7 | inherit distro_features_check autotools pkgconfig useradd systemd |
| 8 | |
| 9 | DEPENDS = "openssl virtual/libx11 libxfixes libxrandr libpam nasm-native" |
| 10 | |
| 11 | REQUIRED_DISTRO_FEATURES = "x11 pam" |
| 12 | |
| 13 | SRC_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 | |
| 21 | SRCREV = "c295dd61b882e8b56677cf12791f43634f9190b5" |
| 22 | |
| 23 | PV = "0.9.4+git${SRCPV}" |
| 24 | |
| 25 | S = "${WORKDIR}/git" |
| 26 | |
| 27 | PACKAGECONFIG ??= "" |
| 28 | PACKAGECONFIG[fuse] = " --enable-fuse, --disable-fuse, fuse" |
| 29 | |
| 30 | USERADD_PACKAGES = "${PN}" |
| 31 | GROUPADD_PARAM_${PN} = "--system xrdp" |
| 32 | USERADD_PARAM_${PN} = "--system --home /var/run/xrdp -g xrdp \ |
| 33 | --no-create-home --shell /bin/false xrdp" |
| 34 | |
| 35 | FILES_${PN} += "${datadir}/dbus-1/services/*.service \ |
| 36 | ${datadir}/dbus-1/accessibility-services/*.service " |
| 37 | |
| 38 | FILES_${PN}-dev += "${libdir}/xrdp/libcommon.so \ |
| 39 | ${libdir}/xrdp/libxrdp.so \ |
| 40 | ${libdir}/xrdp/libscp.so \ |
| 41 | ${libdir}/xrdp/libxrdpapi.so " |
| 42 | |
| 43 | EXTRA_OECONF = "--enable-pam-config=suse" |
| 44 | |
| 45 | do_configure_prepend() { |
| 46 | cd ${S} |
| 47 | ./bootstrap |
| 48 | cd - |
| 49 | } |
| 50 | |
| 51 | do_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 | |
| 56 | do_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 | |
| 81 | SYSTEMD_SERVICE_${PN} = "xrdp.service xrdp-sesman.service" |
| 82 | |
| 83 | pkg_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 | } |