commit 4c6810c989890b82df44020849f98cc6fde19b16 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:04:24 2019 -0400 Package init diff --git a/mcstrans-0.3.4.tgz b/mcstrans-0.3.4.tgz new file mode 100644 index 0000000..1514e87 Binary files /dev/null and b/mcstrans-0.3.4.tgz differ diff --git a/mcstrans.spec b/mcstrans.spec new file mode 100644 index 0000000..79c9a47 --- /dev/null +++ b/mcstrans.spec @@ -0,0 +1,97 @@ +Name: mcstrans +Version: 0.3.4 +Release: 15 +Summary: SELinux Translation Daemon +License: GPL2 +Source0: https://src.fedoraproject.org/repo/pkgs/mcstrans/%{name}-%{version}.tgz +Source1: mcstransd.service + +BuildRequires: gcc systemd-units +BuildRequires: libselinux-devel >= 1.30.3-1 +BuildRequires: libcap-devel pcre-devel libsepol-devel libsepol-static +Requires: pcre +Requires(pre): systemd +Requires(post): systemd +Provides: libsetrans +Obsoletes: libsetrans +Provides: setransd + +%description +Security-enhanced Linux is a feature of the Linux® kernel and a number +of utilities with enhanced security functionality designed to add +mandatory access controls to Linux. The Security-enhanced Linux +kernel contains new architectural components originally developed to +improve the security of the Flask operating system. These +architectural components provide general support for the enforcement +of many kinds of mandatory access control policies, including those +based on the concepts of Type Enforcement®, Role-based Access +Control, and Multi-level Security. + +mcstrans provides an translation daemon to translate SELinux categories +from internal representations to user defined representation. + +%package help +Summary: Mcstrans help document + +%description help +mcstrans-help include help files for man page + +%prep +%setup -q + +%build +make clean +make CFLAGS="%{optflags} -fPIE" LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" LIBDIR="%{_libdir}" %{?_smp_mflags} + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_sysconfdir}/selinux/mls/setrans.d +mkdir -p %{buildroot}%{_usr}/share/mcstrans +mkdir -p %{buildroot}/%{_libdir} +mkdir -p %{buildroot}/%{_lib} + +make SHLIBDIR="%{buildroot}/%{_lib}" SBINDIR="%{buildroot}%{_sbindir}" DESTDIR="%{buildroot}" LIBDIR="%{buildroot}%{_libdir}" install +rm -f %{buildroot}%{_libdir}/*.a +cp -r share/* %{buildroot}%{_usr}/share/mcstrans/ +mkdir -p %{buildroot}%{_unitdir} +install -m644 %{SOURCE1} %{buildroot}%{_unitdir} +rm -rf %{buildroot}/%{_sysconfdir}/rc.d/init.d/mcstrans + +%post +if [ $1 -eq 1 ] ; then + /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + +%preun +if [ $1 -eq 0 ]; then + /usr/bin/systemctl --no-reload mcstransd.service >/dev/null 2>&1 || : + /usr/bin/systemctl stop mcstransd.service > /dev/null 2>&1 || : +fi + +%postun +/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ]; then + /usr/bin/systemctl try-restart mcstransd.service >/dev/null 2>&1 || : +fi + +%files +%dir %{_sysconfdir}/selinux/mls/setrans.d +%{_unitdir}/mcstransd.service +/usr/sbin/mcstransd +%dir %{_usr}/share/mcstrans +%defattr(0644,root,root,0755) +%dir %{_usr}/share/mcstrans/util +%dir %{_usr}/share/mcstrans/examples +%{_usr}/share/mcstrans/examples/* +%defattr(0755,root,root,0755) +%{_usr}/share/mcstrans/util/* + +%files help +%{_mandir}/man8/*.8.gz + +%changelog +* Fri Sep 27 2018 openEuler Buildteam - 0.3.4-15 +- Adjust requires + +* Wed Jul 18 2018 openEuler Buildteam - 0.3.4-14 +- Package init diff --git a/mcstransd.service b/mcstransd.service new file mode 100644 index 0000000..03fa899 --- /dev/null +++ b/mcstransd.service @@ -0,0 +1,12 @@ +[Unit] +Description= Daemon used to translate SELinux MCS/MLS labels to human readable form +After=syslog.target +ConditionPathExists=/etc/selinux/mls/setrans.d + +[Service] +Type=forking +PIDFile=/run/mcstransd.pid +ExecStart=/usr/sbin/mcstransd + +[Install] +WantedBy=multi-user.target