Browse code

Fix service file creation in spec file

Change-Id: I12a3311713ec2aff8807febfcce1a338b9d2df1e
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3331
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Priyesh Padmavilasom <ppadmavilasom@vmware.com>

DheerajSShetty authored on 2017/07/25 04:16:01
Showing 8 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 Summary:	Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6. 
3 3
 Name:		net-snmp   
4 4
 Version:	5.7.3
5
-Release:	6%{?dist}
5
+Release:	7%{?dist}
6 6
 License:	BSD (like)  
7 7
 URL:		http://net-snmp.sourceforge.net/
8 8
 Group:		Productivity/Networking/Other
... ...
@@ -10,6 +10,8 @@ Vendor:		VMware, Inc.
10 10
 Distribution:	Photon
11 11
 Source0:	http://sourceforge.net/projects/%{name}/files/%{name}/%{version}/%{name}-%{version}.tar.gz
12 12
 %define sha1 net-snmp=97dc25077257680815de44e34128d365c76bd839
13
+Source1:	snmpd.service
14
+Source2:	snmptrapd.service
13 15
 Patch1: 	net-snmp-5.7.2-systemd.patch
14 16
 Patch2:         net-snmp-remove-u64-typedef.patch
15 17
 Patch3:         net-snmp-fix-perl-module-compilation.patch
... ...
@@ -52,33 +54,8 @@ make
52 52
 %install
53 53
 make install DESTDIR=%{buildroot}
54 54
 mkdir -p %{buildroot}/lib/systemd/system
55
-cat << EOF >> %{buildroot}/lib/systemd/system/snmpd.service
56
-[Unit]
57
-Description=Simple Network Management Protocol (SNMP) Daemon.
58
-After=syslog.target network.target
59
-
60
-[Service]
61
-Type=notify
62
-ExecStart=/usr/sbin/snmpd -LS0-6d -f
63
-ExecReload=/bin/kill -HUP $MAINPID
64
-
65
-[Install]
66
-WantedBy=multi-user.target
67
-EOF
68
-
69
-cat << EOF >> %{buildroot}/lib/systemd/system/snmptrapd.service
70
-[Unit]
71
-Description=Simple Network Management Protocol (SNMP) Trap Daemon.
72
-After=syslog.target network.target
73
-
74
-[Service]
75
-Type=notify
76
-ExecStart=/usr/sbin/snmptrapd -Lsd -f
77
-ExecReload=/bin/kill -HUP $MAINPID
78
-
79
-[Install]
80
-WantedBy=multi-user.target
81
-EOF
55
+install -m 0644 %{SOURCE1} %{buildroot}/lib/systemd/system/snmpd.service
56
+install -m 0644 %{SOURCE2} %{buildroot}/lib/systemd/system/snmptrapd.service
82 57
 
83 58
 %check
84 59
 make %{?_smp_mflags} test
... ...
@@ -119,6 +96,8 @@ rm -rf %{buildroot}/*
119 119
 %exclude /usr/lib/perl5/5.22.1/x86_64-linux-thread-multi/perllocal.pod
120 120
 
121 121
 %changelog
122
+*	Mon Jul 24 2017 Dheeraj Shetty <dheerajs@vmware.com> 5.7.3-7
123
+-	Make service file a different source
122 124
 *	Tue Apr 04 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.7.3-6
123 125
 -	Patch to remove U64 typedef
124 126
 *       Mon Oct 04 2016 ChangLee <changLee@vmware.com> 5.7.3-5
125 127
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+[Unit]
1
+Description=Simple Network Management Protocol (SNMP) Daemon.
2
+After=syslog.target network.target
3
+
4
+[Service]
5
+Type=notify
6
+ExecStart=/usr/sbin/snmpd -LS0-6d -f
7
+ExecReload=/bin/kill -HUP $MAINPID
8
+
9
+[Install]
10
+WantedBy=multi-user.target
0 11
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+[Unit]
1
+Description=Simple Network Management Protocol (SNMP) Trap Daemon.
2
+After=syslog.target network.target
3
+
4
+[Service]
5
+Type=notify
6
+ExecStart=/usr/sbin/snmptrapd -Lsd -f
7
+ExecReload=/bin/kill -HUP $MAINPID
8
+
9
+[Install]
10
+WantedBy=multi-user.target
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        Free version of the SSH connectivity tools
2 2
 Name:           openssh
3 3
 Version:        7.5p1
4
-Release:        2%{?dist}
4
+Release:        3%{?dist}
5 5
 License:        BSD
6 6
 URL:            https://www.openssh.com/
7 7
 Group:          System Environment/Security
... ...
@@ -11,6 +11,8 @@ Source0:        https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/%{name}-%{v
11 11
 %define sha1    openssh=5e8f185d00afb4f4f89801e9b0f8b9cee9d87ebd
12 12
 Source1:        http://www.linuxfromscratch.org/blfs/downloads/systemd/blfs-systemd-units-20140907.tar.bz2
13 13
 %define sha1    blfs-systemd-units=713afb3bbe681314650146e5ec412ef77aa1fe33
14
+Source2:        sshd.service
15
+Source3:        sshd-keygen.service
14 16
 Patch0:         blfs_systemd_fixes.patch
15 17
 Patch1:         openssh-7.5p1-fips.patch
16 18
 Patch2:         openssh-7.5p1-configure-fips.patch
... ...
@@ -76,37 +78,8 @@ pushd blfs-systemd-units-20140907
76 76
 make DESTDIR=%{buildroot} install-sshd
77 77
 popd
78 78
 
79
-cat << EOF > %{buildroot}/lib/systemd/system/sshd.service
80
-[Unit]
81
-Description=OpenSSH Daemon
82
-After=network.target sshd-keygen.service
83
-
84
-[Service]
85
-ExecStart=%{_sbindir}/sshd -D
86
-ExecReload=/bin/kill -HUP $MAINPID
87
-KillMode=process
88
-Restart=always
89
-
90
-[Install]
91
-WantedBy=multi-user.target
92
-EOF
93
-
94
-cat << EOF >> %{buildroot}/lib/systemd/system/sshd-keygen.service
95
-[Unit]
96
-Description=Generate sshd host keys
97
-ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
98
-ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
99
-ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key
100
-Before=sshd.service
101
-
102
-[Service]
103
-Type=oneshot
104
-RemainAfterExit=yes
105
-ExecStart=%{_bindir}/ssh-keygen -A
106
-[Install]
107
-WantedBy=multi-user.target
108
-EOF
109
-
79
+install -m644 %{SOURCE2} %{buildroot}/lib/systemd/system/sshd.service
80
+install -m644 %{SOURCE3} %{buildroot}/lib/systemd/system/sshd-keygen.service
110 81
 install -m755 contrib/ssh-copy-id %{buildroot}/%{_bindir}/
111 82
 install -m644 contrib/ssh-copy-id.1 %{buildroot}/%{_mandir}/man1/
112 83
 
... ...
@@ -195,6 +168,8 @@ rm -rf %{buildroot}/*
195 195
 %{_mandir}/man8/ssh-pkcs11-helper.8.gz
196 196
 
197 197
 %changelog
198
+*   Mon Jul 24 2017 Dheeraj Shetty <dheerajs@vmware.com> 7.5p1-3
199
+-   Seperate the service file from the spec file
198 200
 *   Wed May 3  2017 Bo Gan <ganb@vmware.com> 7.5p1-2
199 201
 -   Fixed openssh-server dependency on coreutils
200 202
 *   Tue Mar 28 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 7.5p1-1
201 203
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+[Unit]
1
+Description=Generate sshd host keys
2
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
3
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
4
+ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key
5
+Before=sshd.service
6
+
7
+[Service]
8
+Type=oneshot
9
+RemainAfterExit=yes
10
+ExecStart=/usr/bin/ssh-keygen -A
11
+[Install]
12
+WantedBy=multi-user.target
0 13
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+[Unit]
1
+Description=OpenSSH Daemon
2
+After=network.target sshd-keygen.service
3
+
4
+[Service]
5
+ExecStart=/usr/sbin/sshd -D
6
+ExecReload=/bin/kill -HUP $MAINPID
7
+KillMode=process
8
+Restart=always
9
+
10
+[Install]
11
+WantedBy=multi-user.target
0 12
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+[Unit]
1
+Description=Connection poller for PostgreSQL.
2
+After=syslog.target network.target
3
+
4
+[Service]
5
+Type=forking
6
+ExecStart=/usr/bin/pgbouncer --quiet --user pgbouncer /etc/pgbouncer.ini
7
+ExecReload=/bin/kill -USR2 $MAINPID
8
+User=pgbouncer
9
+Group=pgbouncer
10
+RuntimeDirectory=pgbouncer
11
+RuntimeDirectoryMode=0755
12
+Restart=always
13
+
14
+[Install]
15
+WantedBy=multi-user.target
... ...
@@ -1,11 +1,12 @@
1 1
 Summary:	Connection pooler for PostgreSQL.
2 2
 Name:		pgbouncer
3 3
 Version:	1.7.2
4
-Release:	5%{?dist}
4
+Release:	6%{?dist}
5 5
 License:	BSD
6 6
 URL:		https://wiki.postgresql.org/wiki/PgBouncer
7 7
 Source0:        https://pgbouncer.github.io/downloads/files/1.7.2/%{name}-%{version}.tar.gz
8 8
 %define sha1 pgbouncer=d9bb29da15d90713e2399af3ebf5019da5cbe2d6
9
+Source1:        pgbouncer.service
9 10
 Group:		Application/Databases.
10 11
 Vendor:		VMware, Inc.
11 12
 Distribution:	Photon
... ...
@@ -35,24 +36,7 @@ install -p -d %{buildroot}%{_sysconfdir}/
35 35
 install -p -d %{buildroot}%{_sysconfdir}/sysconfig
36 36
 install -p -m 644 etc/pgbouncer.ini %{buildroot}%{_sysconfdir}/
37 37
 mkdir -p %{buildroot}/etc/systemd/system/
38
-cat << EOF >> %{buildroot}/etc/systemd/system/%{name}.service
39
-[Unit]
40
-Description=Connection poller for PostgreSQL.
41
-After=syslog.target network.target
42
-
43
-[Service]
44
-Type=forking
45
-ExecStart=/usr/bin/pgbouncer --quiet --user pgbouncer /etc/pgbouncer.ini
46
-ExecReload=/bin/kill -USR2 $MAINPID
47
-User=pgbouncer
48
-Group=pgbouncer
49
-RuntimeDirectory=pgbouncer
50
-RuntimeDirectoryMode=0755
51
-Restart=always
52
-
53
-[Install]
54
-WantedBy=multi-user.target
55
-EOF
38
+install -m 0644 %{SOURCE1} %{buildroot}/etc/systemd/system/%{name}.service
56 39
 
57 40
 %check
58 41
 pushd test
... ...
@@ -95,6 +79,8 @@ fi
95 95
 /usr/share/doc/pgbouncer/*
96 96
 
97 97
 %changelog
98
+*   Mon Jul 24 2017 Dheeraj Shetty <dheerajs@vmware.com> 1.7.2-6
99
+-   Seperate the service file from the spec file
98 100
 *   Wed May 31 2017 Rongrong Qiu <rqiu@vmware.com> 1.7.2-5
99 101
 -   Add RuntimeDirectory and Type=forking
100 102
 *   Thu Apr 13 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.7.2-4