diff --git a/apmd.modules b/apmd.modules new file mode 100644 index 0000000..60fb9f3 --- /dev/null +++ b/apmd.modules @@ -0,0 +1,2 @@ +# Load apm.ko at boot +apm diff --git a/apmd.service b/apmd.service new file mode 100644 index 0000000..8482ce2 --- /dev/null +++ b/apmd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Apmd Battery Monitoring +After=syslog.target + +[Service] +EnvironmentFile=-/etc/sysconfig/apmd +ExecStart=/usr/sbin/apmd -p $LOGPERCENTCHANGE -w $WARNPERCENT $ADDPARAMS -P /etc/sysconfig/apm-scripts/apmscript +RemainAfterExit=yes + +[Install] +WantedBy=basic.target diff --git a/apmd.spec b/apmd.spec index 8f69bfd..20d4aba 100644 --- a/apmd.spec +++ b/apmd.spec @@ -1,12 +1,14 @@ Summary: Advanced Power Management (APM) BIOS utilities for laptops Name: apmd Version: 3.2.2 -Release: 12%{?dist} +Release: 13%{?dist} Source: ftp://ftp.debian.org/debian/pool/main/a/apmd/%{name}_%{version}.orig.tar.gz Source1: apmd.init Source2: apmscript Source3: apmd.conf Source4: laptopmode +Source5: apmd.modules +Source6: apmd.service Patch: apmd-3.2-build.patch Patch1: apmd-3.2-umask.patch Patch2: apmd-3.2-error.patch @@ -20,6 +22,12 @@ BuildRequires: libtool BuildRoot: %{_tmppath}/%{name}-%{version}-root ExclusiveArch: %{ix86} +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + %description APMD is a set of programs for controlling the Advanced Power Management daemon and utilities found in most modern laptop @@ -30,6 +38,16 @@ down the PCMCIA sockets before a suspend. Install the apmd package if you need to control the APM system on your laptop. +%package sysvinit +Group: System Environment/Daemons +Summary: SysV initscript for apmd daemon +Requires: %{name} = %{version}-%{release} +Requires(preun): /sbin/service +Requires(postun): /sbin/service + +%description sysvinit +The apmd-sysvinit contains SysV initscritps support. + %prep %setup -q -n apmd-%{version}.orig %patch -p1 -b .build @@ -45,7 +63,8 @@ make CFLAGS="$RPM_OPT_FLAGS" %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/etc/{sysconfig/apm-scripts,rc.d/init.d} +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{module-load.d,sysconfig/apm-scripts,rc.d/init.d} +mkdir -p $RPM_BUILD_ROOT/lib/systemd/system %makeinstall APMD_PROXY_DIR=$RPM_BUILD_ROOT/etc @@ -61,6 +80,8 @@ install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/apmd install -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/apm-scripts/ install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/apmd install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/apm-scripts/ +install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/module-load.d/apmd.conf +install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/lib/systemd/system rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/apmd_proxy rm -rf $RPM_BUILD_ROOT%{_bindir}/on_ac_power rm -rf $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir} @@ -69,21 +90,27 @@ rm -rf $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir} rm -rf $RPM_BUILD_ROOT %post -/sbin/chkconfig --add apmd +/bin/systemctl daemon-reload >/dev/null 2>&1 || : %preun if [ $1 = 0 ]; then - service apmd stop > /dev/null 2>&1 - /sbin/chkconfig --del apmd + /bin/systemctl disable apmd.service > /dev/null 2>&1 || : + /bin/systemctl stop apmd.service > /dev/null 2>&1 || : fi %postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : + if [ "$1" -ge "1" ]; then - service apmd condrestart > /dev/null 2>&1 + /bin/systemctl try-restart apmd.service >/dev/null 2>&1 || : fi -%triggerpostun -- apmd <= 0:3.0final-6 -/sbin/chkconfig --add apmd +%triggerun -- %{name} < 3.2.2-13 + /sbin/chkconfig --del apmd >/dev/null 2>&1 || : + /bin/systemctl try-restart apmd.service >/dev/null 2>&1 || : + +%triggerpostun -n %{name}-sysvinit -- %{name} <= 1:3.2.2-13 + /sbin/chkconfig --add apmd >/dev/null 2>&1 || : %files %defattr(-,root,root) @@ -92,12 +119,20 @@ fi %lang(fr) %{_mandir}/fr/man?/* %{_bindir}/* %{_sbindir}/* -%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/apmd %dir %{_sysconfdir}/sysconfig/apm-scripts %config(noreplace) %{_sysconfdir}/sysconfig/apmd %config(noreplace) %{_sysconfdir}/sysconfig/apm-scripts/* +%config(noreplace) %{_sysconfdir}/module-load.d/apmd.conf +/lib/systemd/system/apmd.service + +%files sysvinit +%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/apmd %changelog +* Mon Jul 18 2011 Jiri Skala - 1:3.2.2-13 +- fixes #716970 - added native unit file +- sysvinitscript moved to subpackage + * Mon Feb 07 2011 Fedora Release Engineering - 1:3.2.2-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild