diff --git a/mgetty.spec b/mgetty.spec index 26ce672..5440152 100644 --- a/mgetty.spec +++ b/mgetty.spec @@ -17,6 +17,7 @@ Source3: logrotate.sendfax Source4: logrotate.vgetty Source5: logrotate.vm Source6: vgetty@.service +Source7: mgetty@.service Patch0: mgetty-1.1.29-config.patch Patch1: mgetty-1.1.26-policy.patch @@ -48,11 +49,10 @@ Patch27: mgetty-1.1.36-lockdev.patch License: GPLv2+ Group: Applications/Communications -Requires(post): /sbin/install-info -Requires(preun): /sbin/install-info -BuildRequires: libX11-devel, libXext-devel, texinfo-tex, texlive-dvips lockdev-devel -Requires: coreutils -Requires: /usr/sbin/sendmail +BuildRequires: libX11-devel, libXext-devel, texinfo-tex, texlive-dvips, lockdev-devel, systemd +Requires: coreutils, /sbin/sendmail +Requires(post): /sbin/install-info, systemd +Requires(preun): /sbin/install-info, systemd Conflicts: hylafax+ URL: http://mgetty.greenie.net/ @@ -62,13 +62,13 @@ Requires: mgetty = %{version} Group: Applications/Communications Requires: coreutils Requires: netpbm-progs -Requires(pre): /usr/sbin/useradd +Requires(pre): /sbin/useradd %package voice Summary: A program for using your modem and mgetty as an answering machine Requires: mgetty = %{version} -Requires(post): systemd-units -Requires(postun): systemd-units +Requires(post): systemd +Requires(postun): systemd Group: Applications/Communications %package viewfax @@ -148,79 +148,83 @@ make OPT="$RPM_OPT_FLAGS" CONFDIR=%{_sysconfdir}/mgetty+sendfax popd %install -mkdir -p $RPM_BUILD_ROOT{%{_bindir},%{_infodir},%{_libdir}/mgetty+sendfax} -mkdir -p $RPM_BUILD_ROOT{%{_mandir},%{_sbindir},/var/spool} +mkdir -p %{buildroot}{%{_bindir},%{_infodir},%{_libdir}/mgetty+sendfax} +mkdir -p %{buildroot}{%{_mandir},%{_sbindir},/var/spool} -%define instflags CFLAGS="$RPM_OPT_FLAGS -Wall -DAUTO_PPP" prefix=$RPM_BUILD_ROOT%{_prefix} spool=$RPM_BUILD_ROOT%{_var}/spool BINDIR=$RPM_BUILD_ROOT%{_bindir} SBINDIR=$RPM_BUILD_ROOT%{_sbindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/mgetty+sendfax HELPDIR=$RPM_BUILD_ROOT%{_libdir}/mgetty+sendfax CONFDIR=$RPM_BUILD_ROOT%{_sysconfdir}/mgetty+sendfax MANDIR=$RPM_BUILD_ROOT%{_mandir} MAN1DIR=$RPM_BUILD_ROOT%{_mandir}/man1 MAN4DIR=$RPM_BUILD_ROOT%{_mandir}/man4 MAN5DIR=$RPM_BUILD_ROOT%{_mandir}/man5 MAN8DIR=$RPM_BUILD_ROOT%{_mandir}/man8 INFODIR=$RPM_BUILD_ROOT%{_infodir} ECHO='echo -e' INSTALL=%{__install} +%define instflags CFLAGS="$RPM_OPT_FLAGS -Wall -DAUTO_PPP" prefix=%{buildroot}%{_prefix} spool=%{buildroot}%{_var}/spool BINDIR=%{buildroot}%{_bindir} SBINDIR=%{buildroot}%{_sbindir} LIBDIR=%{buildroot}%{_libdir}/mgetty+sendfax HELPDIR=%{buildroot}%{_libdir}/mgetty+sendfax CONFDIR=%{buildroot}%{_sysconfdir}/mgetty+sendfax MANDIR=%{buildroot}%{_mandir} MAN1DIR=%{buildroot}%{_mandir}/man1 MAN4DIR=%{buildroot}%{_mandir}/man4 MAN5DIR=%{buildroot}%{_mandir}/man5 MAN8DIR=%{buildroot}%{_mandir}/man8 INFODIR=%{buildroot}%{_infodir} ECHO='echo -e' INSTALL=%{__install} make install %instflags # the non-standard executable permissions are used due to security -install -m700 callback/callback $RPM_BUILD_ROOT%{_sbindir} +install -m700 callback/callback %{buildroot}%{_sbindir} # helper tests internally usage of suid - this is an intention -install -m4711 callback/ct $RPM_BUILD_ROOT%{_bindir} +install -m4711 callback/ct %{buildroot}%{_bindir} # this conflicts with efax -mv $RPM_BUILD_ROOT%{_mandir}/man1/fax.1 $RPM_BUILD_ROOT%{_mandir}/man1/mgetty_fax.1 +mv %{buildroot}%{_mandir}/man1/fax.1 %{buildroot}%{_mandir}/man1/mgetty_fax.1 # tools make -C tools install %instflags # voice mail extensions -mkdir -p $RPM_BUILD_ROOT%{_var}/spool/voice/{messages,incoming} +mkdir -p %{buildroot}%{_var}/spool/voice/{messages,incoming} make -C voice install %instflags # the non-standard permissions are used due to security -install -m 600 -c voice/voice.conf-dist $RPM_BUILD_ROOT%{_sysconfdir}/mgetty+sendfax/voice.conf +install -m 600 -c voice/voice.conf-dist %{buildroot}%{_sysconfdir}/mgetty+sendfax/voice.conf # don't ship documentation that is executable... find samples -type f -exec chmod 644 {} \; -make -C frontends/X11/viewfax install %instflags MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1 +make -C frontends/X11/viewfax install %instflags MANDIR=%{buildroot}%{_mandir}/man1 # install logrotate control files -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d # install unit file template for vgetty -mkdir -p $RPM_BUILD_ROOT%{_unitdir} +mkdir -p %{buildroot}%{_unitdir} -install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/mgetty -install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/sendfax -install -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/vgetty -install -m 0644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/vm -install -m 0644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/ +install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/mgetty +install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/sendfax +install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/vgetty +install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/vm +install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ +install -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/ -# remove file droppings from $RPM_BUILD_ROOT -rm -f $RPM_BUILD_ROOT%{_bindir}/cutbl +# remove file droppings from buildroot +rm -f %{buildroot}%{_bindir}/cutbl # remove file conflict with netpbm: -rm -f $RPM_BUILD_ROOT%{_bindir}/g3topbm +rm -f %{buildroot}%{_bindir}/g3topbm %post +if [ $1 -eq 1 ]; then + systemctl daemon-reload >/dev/null 2>&1 || : +fi + if [ -f %{_infodir}/mgetty.inf* ]; then - install-info %{_infodir}/mgetty.info.gz %{_infodir}/dir --entry="* mgetty: (mgetty). Package to handle faxes, voicemail and more." || : + install-info %{_infodir}/mgetty.info.gz %{_infodir}/dir \ + --entry="* mgetty: (mgetty). Package to handle faxes, voicemail and more." || : fi %preun if [ -f %{_infodir}/mgetty.inf* ]; then - install-info --delete %{_infodir}/mgetty.info.gz %{_infodir}/dir --entry="* mgetty: (mgetty). Package to handle faxes, voicemail and more." || : + install-info --delete %{_infodir}/mgetty.info.gz %{_infodir}/dir \ + --entry="* mgetty: (mgetty). Package to handle faxes, voicemail and more." || : fi +%postun +%systemd_postun + %pre sendfax getent group fax >/dev/null || groupadd -g %SENDFAX_UID -r fax -getent passwd fax >/dev/null || \ - useradd -r -u %SENDFAX_UID -g fax -d /var/spool/fax -s /sbin/nologin -c "mgetty fax spool user" fax -exit 0 +getent passwd fax >/dev/null || useradd -r -u %SENDFAX_UID -g fax -d /var/spool/fax -s /sbin/nologin -c "mgetty fax spool user" fax %post voice if [ $1 -eq 1 ]; then - systemctl daemon-reload >/dev/null 2>&1 || : + systemctl daemon-reload >/dev/null 2>&1 || : fi %postun voice -%if 0%{?fedora} > 17 - %systemd_postun -%else - systemctl daemon-reload >/dev/null 2>&1 || : -%endif +%systemd_postun %files %defattr(-,root,root) @@ -241,6 +245,7 @@ fi %config(noreplace) %{_sysconfdir}/mgetty+sendfax/mgetty.config %config(noreplace) %{_sysconfdir}/mgetty+sendfax/dialin.config %config(noreplace) %{_sysconfdir}/logrotate.d/mgetty +%{_unitdir}/mgetty@.service %files sendfax %defattr(-,root,root) @@ -290,7 +295,6 @@ fi %dir %{_var}/spool/voice %dir %{_var}/spool/voice/incoming %dir %{_var}/spool/voice/messages -%{_unitdir}/vgetty@.service %{_sbindir}/vgetty %{_bindir}/vm %{_bindir}/pvfamp @@ -349,6 +353,7 @@ fi # logrotate file name uses only sub-package name %config(noreplace) %{_sysconfdir}/logrotate.d/vgetty %config(noreplace) %{_sysconfdir}/logrotate.d/vm +%{_unitdir}/vgetty@.service %files viewfax %defattr(-,root,root) diff --git a/mgetty@.service b/mgetty@.service new file mode 100644 index 0000000..e0312f1 --- /dev/null +++ b/mgetty@.service @@ -0,0 +1,24 @@ +[Unit] +Description=mgetty on /dev/%I +Documentation=man:mgetty(8) +BindsTo=dev-%i.device +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service +After=rc-local.service +Before=getty.target +IgnoreOnIsolate=yes + +[Service] +ExecStart=-/sbin/mgetty /dev/%I +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +TTYPath=/dev/%I +KillMode=process +IgnoreSIGPIPE=no + +[Install] +WantedBy=getty@.target + + +