[autodir/f17] fix FTBFS, enable systemd

Tom Callaway spot at fedoraproject.org
Fri Mar 9 18:23:17 UTC 2012


commit e3fff4a2bd3153a54d451c5cae94d8b5ed31dd11
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Fri Mar 9 13:23:14 2012 -0500

    fix FTBFS, enable systemd

 autodir-0.99.9-system-getsubopt.patch |   36 +++++++++++++
 autodir.spec                          |   91 ++++++++++++++++++--------------
 autogroup.target                      |   13 +++++
 autohome.target                       |   11 ++++
 4 files changed, 111 insertions(+), 40 deletions(-)
---
diff --git a/autodir-0.99.9-system-getsubopt.patch b/autodir-0.99.9-system-getsubopt.patch
new file mode 100644
index 0000000..d26f7bd
--- /dev/null
+++ b/autodir-0.99.9-system-getsubopt.patch
@@ -0,0 +1,36 @@
+diff -up autodir-0.99.9/src/modules/autogroup.c.fix autodir-0.99.9/src/modules/autogroup.c
+--- autodir-0.99.9/src/modules/autogroup.c.fix	2012-03-09 13:13:44.274304936 -0500
++++ autodir-0.99.9/src/modules/autogroup.c	2012-03-09 13:13:50.866276551 -0500
+@@ -98,7 +98,7 @@ void module_clean( void );
+ 
+ 
+ 
+-int getsubopt (char **, const char* const *, char **);
++/* int getsubopt (char **, const char* const *, char **); */
+ 
+ module_info autogroup_info = { MODULE_NAME, MODULE_PROTOCOL };
+ 
+diff -up autodir-0.99.9/src/modules/autohome.c.fix autodir-0.99.9/src/modules/autohome.c
+--- autodir-0.99.9/src/modules/autohome.c.fix	2012-03-09 13:13:11.324474680 -0500
++++ autodir-0.99.9/src/modules/autohome.c	2012-03-09 13:13:31.182331027 -0500
+@@ -119,7 +119,7 @@ module_info autohome_info = { MODULE_NAM
+ #define READ_BUF_SIZE			8000
+ #define SKEL_FILE_MAX_COPY		(1024*1024) /*1MB*/
+ 
+-int getsubopt (char **, const char* const *, char **);
++/* int getsubopt (char **, const char* const *, char **); */
+ 
+ /*module sub-option values*/
+ static struct {
+diff -up autodir-0.99.9/src/modules/automisc.c.fix autodir-0.99.9/src/modules/automisc.c
+--- autodir-0.99.9/src/modules/automisc.c.fix	2012-03-09 13:12:45.993752086 -0500
++++ autodir-0.99.9/src/modules/automisc.c	2012-03-09 13:12:50.257705404 -0500
+@@ -95,7 +95,7 @@ void module_clean( void );
+ 
+ 
+ 
+-int getsubopt (char **, const char* const *, char **);
++/* int getsubopt (char **, const char* const *, char **); */
+ 
+ /*module option values*/
+ static struct {
diff --git a/autodir.spec b/autodir.spec
index fba604a..f016175 100644
--- a/autodir.spec
+++ b/autodir.spec
@@ -1,99 +1,110 @@
 Summary: Creates user directories on demand
 Name: autodir
 Version: 0.99.9
-Release: 11%{?dist}
+Release: 12%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 URL: http://www.intraperson.com/autodir/
 Source0: http://downloads.sf.net/intraperson/autodir-%{version}.tar.gz
-Source1: autogroup.init
-Source2: autohome.init
+Source1: autogroup.target
+Source2: autohome.target
 Source3: autogroup.sysconfig
 Source4: autohome.sysconfig
 Patch0: autodir-0.96.0-cflags.patch
 Patch1: autodir-0.99.8-auto_fs4.patch
 Patch2: autodir-0.99.9-noskeldirmodforce.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/service, /sbin/chkconfig
-Requires(postun): /sbin/service
+Patch3: autodir-0.99.9-system-getsubopt.patch
 BuildRequires: libcap-devel, libtool, libtool-ltdl-devel
+BuildRequires: systemd-units
+Requires(post): systemd-units
+Requires(post): systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 Autodir offers a simple and effective means to create directories like home
 directories in a transparent manner. It relies on the autofs protocol for its
 operation.
 
-
 %prep
 %setup -q
 %patch0 -p1 -b .cflags
 %patch1 -p1 -b .auto_fs4
 %patch2 -p1 -b .noskeldirmodforce
-
+%patch3 -p1 -b .system-getsubopt
 
 %build
-%configure
-%{__make} %{?_smp_mflags}
+%configure --disable-static
+make %{?_smp_mflags}
 
 
 %install
-%{__rm} -rf %{buildroot}
-%{__make} install DESTDIR=%{buildroot}
+make install DESTDIR=%{buildroot}
 
-%{__install} -D -m 0755 %{SOURCE1} \
-    %{buildroot}%{_sysconfdir}/rc.d/init.d/autogroup
-%{__install} -D -m 0755 %{SOURCE2} \
-    %{buildroot}%{_sysconfdir}/rc.d/init.d/autohome
+mkdir -p %{buildroot}%{_unitdir}
+install -D -m 0755 %{SOURCE1} %{buildroot}%{_unitdir}/
+install -D -m 0755 %{SOURCE2} %{buildroot}%{_unitdir}/
 
-%{__install} -D -m 0644 %{SOURCE3} \
+install -D -m 0644 %{SOURCE3} \
     %{buildroot}%{_sysconfdir}/sysconfig/autogroup
-%{__install} -D -m 0644 %{SOURCE4} \
+install -D -m 0644 %{SOURCE4} \
     %{buildroot}%{_sysconfdir}/sysconfig/autohome
 # Fix for lib64
 %{__perl} -pi -e 's|/usr/lib/autodir|%{_libdir}/autodir|g' \
     %{buildroot}%{_sysconfdir}/sysconfig/*
 
-
-%clean
-%{__rm} -rf %{buildroot}
-
-
 %post
-if [ $1 -eq 1 ]; then
-    /sbin/chkconfig --add autogroup
-    /sbin/chkconfig --add autohome
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
 
 %preun
-if [ $1 -eq 0 ]; then
-    /sbin/service autogroup stop &>/dev/null || :
-    /sbin/service autohome stop &>/dev/null || :
-    /sbin/chkconfig --del autogroup
-    /sbin/chkconfig --del autohome
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable autogroup.service > /dev/null 2>&1 || :
+    /bin/systemctl --no-reload disable autohome.service > /dev/null 2>&1 || :
+    /bin/systemctl stop autogroup.service > /dev/null 2>&1 || :
+    /bin/systemctl stop autohome.service > /dev/null 2>&1 || :
 fi
 
 %postun
-if [ $1 -ge 1 ]; then
-    /sbin/service autogroup condrestart &>/dev/null || :
-    /sbin/service autohome condrestart &>/dev/null || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart autogroup.service >/dev/null 2>&1 || :
+    /bin/systemctl try-restart autohome.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- autodir < 0.99.9-12
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply autogroup
+# && systemd-sysv-convert --apply autohome
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save autogroup >/dev/null 2>&1 ||:
+/usr/bin/systemd-sysv-convert --save autohome >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del autogroup >/dev/null 2>&1 || :
+/sbin/chkconfig --del autohome >/dev/null 2>&1 || :
+/bin/systemctl try-restart autogroup.service >/dev/null 2>&1 || :
+/bin/systemctl try-restart autohome.service >/dev/null 2>&1 || :
 
 %files
-%defattr(-,root,root,-)
 %doc AUTHORS ChangeLog COPYING NEWS README
 %config(noreplace) %{_sysconfdir}/sysconfig/autogroup
 %config(noreplace) %{_sysconfdir}/sysconfig/autohome
-%{_sysconfdir}/rc.d/init.d/autogroup
-%{_sysconfdir}/rc.d/init.d/autohome
+%{_unitdir}/autogroup.target
+%{_unitdir}/autohome.target
 %{_sbindir}/autodir
 %{_libdir}/autodir/
-%exclude %{_libdir}/autodir/*.a
 %exclude %{_libdir}/autodir/*.la
 
-
 %changelog
+* Fri Mar  9 2012 Tom Callaway <spot at fedoraproject.org> - 0.99.9-12
+- convert to systemd
+- fix FTBFS
+
 * Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.99.9-11
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/autogroup.target b/autogroup.target
new file mode 100644
index 0000000..e888813
--- /dev/null
+++ b/autogroup.target
@@ -0,0 +1,13 @@
+[Unit]
+Description=Autogroup Creating User Home Directories On Demand
+Requires=autohome.service
+After=local-fs.target autohome.service
+
+[Service]
+Type=forking
+PIDFile=/run/autogroup.pid
+ExecStart=/usr/sbin/autodir -d /group -m /usr/lib64/autodir/autogroup.so -o realpath=/autogroup,level=2,nopriv=false,mode=02070 -t 300
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/autohome.target b/autohome.target
new file mode 100644
index 0000000..28cdda1
--- /dev/null
+++ b/autohome.target
@@ -0,0 +1,11 @@
+[Unit]
+Description=Autohome Creating User Home Directories On Demand
+After=local-fs.target
+
+[Service]
+Type=forking
+PIDFile=/run/autohome.pid
+ExecStart=/usr/sbin/autodir -d /home -m /usr/lib64/autodir/autohome.so -o realpath=/autohome,level=2,skel=/etc/skel,mode=0700 -t 660
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list