![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package mcstrans for openSUSE:Factory checked in at 2014-09-09 19:00:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mcstrans (Old) and /work/SRC/openSUSE:Factory/.mcstrans.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "mcstrans" Changes: -------- --- /work/SRC/openSUSE:Factory/mcstrans/mcstrans.changes 2012-12-14 09:43:54.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.mcstrans.new/mcstrans.changes 2014-09-09 19:00:14.000000000 +0200 @@ -1,0 +2,8 @@ +Mon Sep 8 08:07:00 UTC 2014 - jsegitz@suse.com + +- altered package to use systemd. Removed + mcstrans-0.3.3-initscript.patch since it's no longer necessary +- added mcstrans-0.3.3-writepid.patch to write pid files to the + correct location + +------------------------------------------------------------------- Old: ---- mcstrans-0.3.3-initscript.patch New: ---- mcstrans-0.3.3-writepid.patch mcstransd.service ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mcstrans.spec ++++++ --- /var/tmp/diff_new_pack.FJm16A/_old 2014-09-09 19:00:16.000000000 +0200 +++ /var/tmp/diff_new_pack.FJm16A/_new 2014-09-09 19:00:16.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package mcstrans # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,14 +24,18 @@ License: GPL-2.0+ Group: System/Management Source: %{name}-%{version}.tgz -Patch0: %{name}-%{version}-initscript.patch +Source1: mcstransd.service +Patch0: %{name}-%{version}-writepid.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build +Requires: aaa_base +BuildRequires: aaa_base BuildRequires: libcap-devel BuildRequires: libselinux-devel >= 1.30.3 BuildRequires: libsepol-devel-static BuildRequires: pcre-devel +BuildRequires: systemd +%{?systemd_requires} Provides: setransd -PreReq: %insserv_prereq %fillup_prereq %description Security-enhanced Linux is a feature of the Linux® kernel and a number @@ -49,7 +53,7 @@ %prep %setup -q -%patch0 +%patch0 -p1 %build export CFLAGS="$RPM_OPT_FLAGS" @@ -58,29 +62,33 @@ %install mkdir -p $RPM_BUILD_ROOT/%{_lib} mkdir -p $RPM_BUILD_ROOT/%{_libdir} +mkdir -p $RPM_BUILD_ROOT/%{_unitdir} make DESTDIR="$RPM_BUILD_ROOT" LIBDIR="$RPM_BUILD_ROOT%{_libdir}" SHLIBDIR="$RPM_BUILD_ROOT/%{_lib}" install rm -f $RPM_BUILD_ROOT%{_sbindir}/* rm -f $RPM_BUILD_ROOT%{_libdir}/*.a -install -D -m 0755 $RPM_BUILD_ROOT/etc/rc.d/init.d/mcstrans $RPM_BUILD_ROOT/etc/init.d/mcstrans +rm $RPM_BUILD_ROOT/etc/rc.d/init.d/mcstrans +install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/ rm -rf $RPM_BUILD_ROOT/etc/rc.d mkdir -p $RPM_BUILD_ROOT%{_sbindir} -ln -sf ../../etc/init.d/mcstrans $RPM_BUILD_ROOT%{_sbindir}/rcmcstrans +ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcmcstransd %post -%fillup_and_insserv mcstrans +%service_add_post mcstransd.service %preun -%stop_on_removal mcstrans +%service_del_preun mcstransd.service %postun -%restart_on_update mcstrans -%insserv_cleanup +%service_del_postun mcstransd.service + +%pre +%service_add_pre mcstransd.service %files %defattr(-,root,root) -%{_sysconfdir}/init.d/mcstrans -%{_sbindir}/rcmcstrans +%{_unitdir}/mcstransd.service /sbin/mcstransd +/usr/sbin/rcmcstransd %{_mandir}/man8/mcs.8* %{_mandir}/man8/mcstransd.8* %{_mandir}/man8/setrans.conf.8* ++++++ mcstrans-0.3.3-writepid.patch ++++++ diff -up mcstrans-0.3.2/src/mcstransd.c.writepid mcstrans-0.3.2/src/mcstransd.c --- mcstrans-0.3.2/src/mcstransd.c.writepid 2011-01-05 10:32:25.000000000 -0500 +++ mcstrans-0.3.2/src/mcstransd.c 2012-02-01 16:14:02.085806490 -0500 @@ -4,6 +4,7 @@ #include <sys/socket.h> #include <sys/poll.h> #include <sys/stat.h> +#include <fcntl.h> #include <sys/un.h> #include <errno.h> #include <stdint.h> @@ -556,6 +557,30 @@ void dropprivs(void) cap_free(new_caps); } +static const char *pidfile = "/var/run/mcstransd.pid"; + +static int write_pid_file(void) +{ + int pidfd, len; + char val[16]; + + len = snprintf(val, sizeof(val), "%u\n", getpid()); + if (len < 0) { + syslog(LOG_ERR, "Pid error (%s)", strerror(errno)); + pidfile = 0; + return 1; + } + pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644); + if (pidfd < 0) { + syslog(LOG_ERR, "Unable to set pidfile (%s)", strerror(errno)); + pidfile = 0; + return 1; + } + (void)write(pidfd, val, (unsigned int)len); + close(pidfd); + return 0; +} + int main(int UNUSED(argc), char *argv[]) { @@ -582,6 +607,8 @@ main(int UNUSED(argc), char *argv[]) } #endif + write_pid_file(); + syslog(LOG_NOTICE, "%s initialized", argv[0]); process_connections(); ++++++ mcstransd.service ++++++ [Unit] Description= Daemon used to translate SELinux MCS/MLS labels to human readable form After=syslog.target [Service] Type=forking PIDFile=/run/mcstransd.pid ExecStartPre=/usr/bin/mkdir -p /var/run/setrans ExecStart=/sbin/mcstransd [Install] WantedBy=multi-user.target -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org