Browse code

Added saslauthd service to systemd.

Change-Id: Ifa1d09cc9bee42511599958095517b0ebf4b531d
Reviewed-on: http://photon-jenkins.eng.vmware.com/117
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Sharath George

xiaolin-vmware authored on 2015/11/12 05:08:08
Showing 2 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Cyrus Simple Authentication Service Layer (SASL) library
2 2
 Name:		cyrus-sasl
3 3
 Version:	2.1.26
4
-Release:	3%{?dist}
4
+Release:	4%{?dist}
5 5
 License:	Custom
6 6
 URL:		http://cyrusimap.web.cmu.edu/
7 7
 Group:		System Environment/Security
... ...
@@ -9,14 +9,14 @@ Vendor:		VMware, Inc.
9 9
 Distribution: 	Photon
10 10
 Source0:	ftp://ftp.cyrusimap.org/cyrus-sasl/%{name}-%{version}.tar.gz
11 11
 %define sha1 cyrus-sasl=d6669fb91434192529bd13ee95737a8a5040241c
12
-Source1:	http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-20140919.tar.bz2
13
-%define sha1 blfs-bootscripts=762b68f79f84463a6b1dabb69e9dbdc2c43f32d8
14 12
 Patch0:		http://www.linuxfromscratch.org/patches/blfs/svn/cyrus-sasl-2.1.26-fixes-3.patch
15 13
 Requires:	openssl
16 14
 Requires:	krb5 >= 1.12
15
+Requires:       Linux-PAM
17 16
 BuildRequires:	openssl-devel
18 17
 BuildRequires:  krb5 >= 1.12
19 18
 BuildRequires:  e2fsprogs-devel
19
+BuildRequires:  Linux-PAM
20 20
 %description
21 21
 The Cyrus SASL package contains a Simple Authentication and Security 
22 22
 Layer, a method for adding authentication support to 
... ...
@@ -28,7 +28,6 @@ protocol and the connection.
28 28
 %prep
29 29
 %setup -q
30 30
 %patch0 -p1
31
-tar xf %{SOURCE1}
32 31
 %build
33 32
 autoreconf -fi
34 33
 pushd saslauthd
... ...
@@ -43,7 +42,7 @@ popd
43 43
 	--sysconfdir=/etc \
44 44
 	--with-plugindir=%{_libdir}/sasl2 \
45 45
     --without-dblib \
46
-    --without-saslauthd \
46
+    --with-saslauthd=/run/saslauthd \
47 47
     --without-authdaemond \
48 48
     --disable-macos-framework \
49 49
     --disable-sample \
... ...
@@ -64,28 +63,58 @@ make
64 64
 make DESTDIR=%{buildroot} install
65 65
 find %{buildroot}/%{_libdir} -name '*.la' -delete
66 66
 install -D -m644 COPYING %{buildroot}/usr/share/licenses/%{name}/LICENSE
67
-#	daemonize
68
-pushd blfs-bootscripts-20140919
69
-make DESTDIR=%{buildroot} install-saslauthd
70
-popd
71 67
 %{_fixperms} %{buildroot}/*
68
+
69
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
70
+cat << EOF >> %{buildroot}/%{_sysconfdir}/sysconfig/saslauthd
71
+# Directory in which to place saslauthd's listening socket, pid file, and so
72
+# on.  This directory must already exist.
73
+SOCKETDIR=/run/saslauthd
74
+
75
+# Mechanism to use when checking passwords.  Run "saslauthd -v" to get a list
76
+# of which mechanism your installation was compiled with the ablity to use.
77
+MECH=pam
78
+
79
+# Additional flags to pass to saslauthd on the command line.  See saslauthd(8)
80
+# for the list of accepted flags.
81
+FLAGS=
82
+EOF
83
+
84
+mkdir -p %{buildroot}/lib/systemd/system
85
+cat << EOF >> %{buildroot}/lib/systemd/system/saslauthd.service
86
+[Unit]
87
+Description=SASL authentication daemon.
88
+
89
+[Service]
90
+Type=forking
91
+PIDFile=/run/saslauthd/saslauthd.pid
92
+EnvironmentFile=/etc/sysconfig/saslauthd
93
+ExecStart=/usr/sbin/saslauthd -m \$SOCKETDIR -a \$MECH \$FLAGS
94
+RuntimeDirectory=saslauthd
95
+
96
+[Install]
97
+WantedBy=multi-user.target
98
+EOF
99
+
72 100
 %check
73 101
 make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
74
-%post	-p /sbin/ldconfig
102
+%post
103
+%{_sbindir}/ldconfig 
104
+if [ $1 -eq 1 ] ; then
105
+    # Initial installation
106
+    # Enabled by default per "runs once then goes away" exception
107
+    /bin/systemctl preset saslauthd.service  >/dev/null 2>&1 || :
108
+fi
75 109
 %postun	-p /sbin/ldconfig
110
+%preun
111
+/bin/systemctl disable saslauthd.service
112
+
76 113
 %clean
77 114
 rm -rf %{buildroot}/*
78 115
 %files
79 116
 %defattr(-,root,root)
80
-/etc/rc.d/init.d/saslauthd
81
-/etc/rc.d/rc0.d/K49saslauthd
82
-/etc/rc.d/rc1.d/K49saslauthd
83
-/etc/rc.d/rc2.d/S24saslauthd
84
-/etc/rc.d/rc3.d/S24saslauthd
85
-/etc/rc.d/rc4.d/S24saslauthd
86
-/etc/rc.d/rc5.d/S24saslauthd
87
-/etc/rc.d/rc6.d/K49saslauthd
88 117
 /etc/sysconfig/saslauthd
118
+/lib/systemd/system/saslauthd.service
89 119
 %{_includedir}/*
90 120
 %{_libdir}/*.so*
91 121
 %{_libdir}/pkgconfig/*
... ...
@@ -93,7 +122,10 @@ rm -rf %{buildroot}/*
93 93
 %{_sbindir}/*
94 94
 %{_mandir}/man3/*
95 95
 %{_datadir}/licenses/%{name}/LICENSE
96
+%{_mandir}/man8/saslauthd.8.gz
96 97
 %changelog
98
+*   Wed Nov 11 2015 Xiaolin Li <xiaolinl@vmware.com> 2.1.26-4
99
+-   Add saslauthd service to systemd.
97 100
 *	Tue Sep 01 2015 Vinay Kulkarni <kulkarniv@vmware.com> 2.1.26-3
98 101
 -	Enable CRAM.
99 102
 *	Thu Jul 16 2015 Divya Thaluru <dthaluru@vmware.com> 2.1.26-2
... ...
@@ -10,8 +10,6 @@ Vendor:		VMware, Inc.
10 10
 Distribution:	Photon
11 11
 Source0:	ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.40.tgz
12 12
 %define sha1 openldap=0cfac3b024b99de2e2456cc7254481b6644e0b96
13
-Source1:	http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-20140919.tar.bz2
14
-%define sha1 blfs-bootscripts=762b68f79f84463a6b1dabb69e9dbdc2c43f32d8
15 13
 Patch0:		openldap-2.4.40-blfs_paths-1.patch
16 14
 Patch1:		openldap-2.4.40-symbol_versions-1.patch
17 15
 Patch2:		openldap-2.4.40-gssapi-1.patch
... ...
@@ -37,7 +35,6 @@ libraries, and documentation for OpenLDAP.
37 37
 %patch0 -p1
38 38
 %patch3 -p1
39 39
 %patch4 -p1
40
-tar xf %{SOURCE1}
41 40
 %build
42 41
 
43 42
 autoconf