Skip to content

Commit

Permalink
Fixing package update pre/post/un section in SPECS Addressing review …
Browse files Browse the repository at this point in the history
…comments

Change-Id: I9d819123565f0f855043a5a7eca179623954ea97
Reviewed-on: http://photon-jenkins.eng.vmware.com/814
Tested-by: jenkins-photon <[email protected]>
Reviewed-by: Priyesh Padmavilasom <[email protected]>
Reviewed-by: Sharath George
  • Loading branch information
Kumar Kaushik authored and Sharath George committed May 6, 2016
1 parent f66608a commit d45b740
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 67 deletions.
12 changes: 9 additions & 3 deletions SPECS/git/git.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Fast distributed version control system
Name: git
Version: 2.8.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
URL: http://git-scm.com/
Group: System Environment/Programming
Expand Down Expand Up @@ -59,8 +59,12 @@ make DESTDIR=%{buildroot} install
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}

%post
git config --system http.sslCAPath /etc/ssl/certs
exit 0
if [$1 -eq 1];then
# This is first installation.
git config --system http.sslCAPath /etc/ssl/certs
exit 0
fi

%clean
rm -rf %{buildroot}/*
%files
Expand All @@ -83,6 +87,8 @@ rm -rf %{buildroot}/*
%defattr(-,root,root)

%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 2.8.1-2
- Handling the upgrade scenario.
* Fri Apr 15 2016 Anish Swaminathan <[email protected]> 2.8.1-1
- Updated to version 2.8.1
* Tue Feb 23 2016 Harish Udaiya Kumar <[email protected]> 2.7.1-1
Expand Down
13 changes: 9 additions & 4 deletions SPECS/go/go.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Summary: Go
Name: go
Version: 1.4.2
Release: 2%{?dist}
Release: 3%{?dist}
License: BSD
URL: https://golang/org
Group: System Environment/Security
Expand Down Expand Up @@ -88,9 +88,12 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}

%postun
/sbin/ldconfig
rm /etc/profile.d/go-exports.sh
rm -rf /opt/%{name}
exit 0
if[ $1 -eq 0 ]; then
#This is uninstall
rm /etc/profile.d/go-exports.sh
rm -rf /opt/%{name}
exit 0
fi

%clean
rm -rf %{buildroot}/*
Expand All @@ -112,6 +115,8 @@ rm -rf %{buildroot}/*
%{_bindir}/*

%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 1.4.2-3
- Handling upgrade scenario pre/post/un scripts.
* Wed Dec 09 2015 Anish Swaminathan <[email protected]> 1.4.2-2
- Edit post script.
* Mon Aug 03 2015 Vinay Kulkarni <[email protected]> 1.4.2-1
Expand Down
55 changes: 32 additions & 23 deletions SPECS/httpd/httpd.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: The Apache HTTP Server
Name: httpd
Version: 2.4.18
Release: 2%{?dist}
Release: 3%{?dist}
License: Apache License 2.0
URL: http://httpd.apache.org/
Group: Applications/System
Expand Down Expand Up @@ -92,39 +92,46 @@ WantedBy=multi-user.target
EOF
ln -s /usr/sbin/httpd %{buildroot}/usr/sbin/apache2
ln -s /etc/httpd/conf/httpd.conf %{buildroot}/etc/httpd/httpd.conf

%post
/sbin/ldconfig
if ! getent group apache >/dev/null; then
groupadd -g 25 apache
fi
if ! getent passwd apache >/dev/null; then
useradd -c "Apache Server" -d /srv/www -g apache \
-s /bin/false -u 25 apache
fi

if [ -h /etc/mime.types ]; then
mv /etc/mime.types /etc/mime.types.orig
if [ $1 -eq 1 ]; then
# this is initial installation
if ! getent group apache >/dev/null; then
groupadd -g 25 apache
fi
if ! getent passwd apache >/dev/null; then
useradd -c "Apache Server" -d /srv/www -g apache \
-s /bin/false -u 25 apache
fi

if [ -h /etc/mime.types ]; then
mv /etc/mime.types /etc/mime.types.orig
fi
fi

ln -sf /etc/httpd/conf/mime.types /etc/mime.types
/bin/systemctl enable httpd.service
%systemd_post httpd.service

%preun
/bin/systemctl stop httpd.service
/bin/systemctl disable httpd.service
%systemd_preun httpd.service

%postun
/sbin/ldconfig
if getent passwd apache >/dev/null; then
userdel apache
fi
if getent group apache >/dev/null; then
groupdel apache
fi

if [ -f /etc/mime.types.orig ]; then
mv /etc/mime.types.orig /etc/mime.types
if [ $1 -eq 0 ]; then
# this is delete operation
if getent passwd apache >/dev/null; then
userdel apache
fi
if getent group apache >/dev/null; then
groupdel apache
fi

if [ -f /etc/mime.types.orig ]; then
mv /etc/mime.types.orig /etc/mime.types
fi
fi
%systemd_postun_with_restart httpd.service

%files devel
%defattr(-,root,root)
Expand Down Expand Up @@ -157,6 +164,8 @@ fi
%{_bindir}/dbmmanage

%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 2.4.18-3
- Adding upgrade support in pre/post/un script.
* Mon Mar 21 2016 Mahmoud Bassiouny <[email protected]> 2.4.18-2
- Fixing systemd service
* Fri Jan 22 2016 Xiaolin Li <[email protected]> 2.4.18-1
Expand Down
14 changes: 11 additions & 3 deletions SPECS/iptables/iptables.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Linux kernel packet control tool
Name: iptables
Version: 1.6.0
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
URL: http://www.netfilter.org/projects/iptables
Group: System Environment/Security
Expand Down Expand Up @@ -56,12 +56,18 @@ find %{buildroot} -name '*.la' -delete
%{_fixperms} %{buildroot}/*
%check
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}

%preun
%systemd_preun iptables.service

%post
/sbin/ldconfig
systemctl enable iptables.service
%systemd_post iptables.service

%postun
/sbin/ldconfig
systemctl disable iptables.service
%systemd_postun_with_restart iptables.service

%clean
rm -rf %{buildroot}/*
%files
Expand All @@ -79,6 +85,8 @@ rm -rf %{buildroot}/*
%{_mandir}/man3/*
%{_mandir}/man8/*
%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 1.6.0-3
- Adding package support in pre/post/un scripts section.
* Thu Apr 21 2016 Divya Thaluru <[email protected]> 1.6.0-2
- Enabled iptable service. Added iptable rule to accept ssh connections by default.
* Fri Jan 15 2016 Xiaolin Li <[email protected]> 1.6.0-1
Expand Down
8 changes: 7 additions & 1 deletion SPECS/irqbalance/irqbalance.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Irqbalance daemon
Name: irqbalance
Version: 1.1.0
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
URL: https://github.com/Irqbalance/irqbalance
Group: System Environment/Services
Expand Down Expand Up @@ -29,10 +29,14 @@ make DESTDIR=%{buildroot} install
install -D -m 0644 misc/irqbalance.env %{buildroot}/etc/sysconfig/irqbalance
sed -i 's#/path/to/irqbalance.env#/etc/sysconfig/irqbalance#' misc/irqbalance.service
install -D -m 0644 misc/irqbalance.service %{buildroot}%{_prefix}/lib/systemd/system/irqbalance.service

%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service

%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/*
Expand All @@ -42,5 +46,7 @@ install -D -m 0644 misc/irqbalance.service %{buildroot}%{_prefix}/lib/systemd/sy
%{_datadir}/*

%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 1.1.0-2
- Adding package upgrade support.
* Fri Jan 15 2016 Alexey Makhalov <[email protected]> 1.1.0-1
- Initial version
24 changes: 18 additions & 6 deletions SPECS/kubernetes/kubernetes.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Summary: Kubernetes cluster management
Name: kubernetes
Version: 1.1.8
Release: 1%{?dist}
Release: 2%{?dist}
License: ASL 2.0
URL: https://github.com/GoogleCloudPlatform/kubernetes
Source0: https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v%{version}/%{name}-v%{version}.tar.gz
Expand Down Expand Up @@ -65,9 +65,19 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
rm -rf %{buildroot}/*

%pre
getent group kube >/dev/null || groupadd -r kube
getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
-c "Kubernetes user" kube
if [$1 -eq 1]; then
# Initial installation.
getent group kube >/dev/null || groupadd -r kube
getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
-c "Kubernetes user" kube
fi

%postun
if [$1 -eq 0]; then
# Package deletion
userdel kube
groupdel kube
fi

%files
%defattr(-,root,root)
Expand All @@ -89,8 +99,10 @@ getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
%config(noreplace) %{_sysconfdir}/%{name}/scheduler

%changelog
* Tue Feb 23 2016 Harish Udaiya Kumar <[email protected]> 1.1.8-1
- Upgraded to version 1.1.8
* Thu May 05 2016 Kumar Kaushik <[email protected]> 1.1.8-2
- Adding support to pre/post/un scripts for package upgrade.
* Tue Feb 23 2016 Harish Udaiya Kumar <[email protected]> 1.1.8-1
- Upgraded to version 1.1.8
* Mon Aug 3 2015 Tom Scanlan <[email protected]> 1.0.2-1
- bump up to latest release
* Thu Jul 23 2015 Vinay Kulkarni <[email protected]> 1.0.1-1
Expand Down
12 changes: 7 additions & 5 deletions SPECS/lldpad/lldpad.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Intel LLDP Agent
Name: lldpad
Version: 1.0.1
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2
URL: http://open-lldp.org/
Source: %{name}-%{version}.tar.gz
Expand Down Expand Up @@ -42,13 +42,13 @@ mv %{buildroot}/%{_libdir}/systemd/system/lldpad.socket \
%{buildroot}/lib/systemd/system/lldpad.socket

%preun
/bin/systemctl disable lldpad.socket
%systemd_preun lldpad.socket
%post
/sbin/ldconfig
/bin/systemctl enable lldpad.socket

%systemd_post lldpad.socket
%postun
/sbin/ldconfig
%systemd_postun_with_restart lldpad.socket

%files
%defattr(-,root,root)
Expand All @@ -65,9 +65,11 @@ mv %{buildroot}/%{_libdir}/systemd/system/lldpad.socket \


%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 1.0.1-3
- Adding support in pre/post/un scripts for upgrade.
* Thu Dec 10 2015 Xiaolin Li <[email protected]> 1.0.1-2
- Add systemd to Requires and BuildRequires.
- The source is based on git://open-lldp.org/open-lldp commit 036e314
- Use systemctl to enable/disable service.
* Tue Nov 24 2015 Xiaolin Li <[email protected]> 1.0.1-1
* Tue Nov 24 2015 Xiaolin Li <[email protected]> 1.0.1-1
- Initial build. First version
30 changes: 21 additions & 9 deletions SPECS/lvm2/lvm2.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Userland logical volume management tools
Name: lvm2
Version: 2.02.141
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
Group: System Environment/Base
URL: http://sources.redhat.com/dm
Expand Down Expand Up @@ -122,14 +122,21 @@ This package contains the dmeventd daemon for monitoring the state
of device-mapper devices.

%post -n device-mapper-event
%systemd_post dm-event.socket
systemctl enable dm-event.service
systemctl enable dm-event.socket
systemctl start dm-event.socket

%systemd_post dm-event.service dm-event.socket
if [ $1 -eq 1 ];then
# This is initial installation
systemctl start dm-event.socket
fi
%preun -n device-mapper-event
if [ $1 -eq 0];then
# This is erase operation
systemctl stop dm-event.socket
fi
%systemd_preun dm-event.service dm-event.socket

%postun -n device-mapper-event
%systemd_postun_with_restart dm-event.service dm-event.socket

%package -n device-mapper-event-libs
Summary: Device-mapper event daemon shared library
License: LGPLv2
Expand Down Expand Up @@ -204,14 +211,17 @@ make install_systemd_units DESTDIR=%{buildroot}
make install_systemd_generators DESTDIR=%{buildroot}
make install_tmpfiles_configuration DESTDIR=%{buildroot}
cp %{SOURCE1} %{buildroot}/lib/systemd/system/lvm2-activate.service

%preun
%systemd_preun lvm2-lvmetad.service lvm2-monitor.service lvm2-activate.service

%post
/sbin/ldconfig
systemctl enable lvm2-lvmetad.service
systemctl enable lvm2-monitor.service
systemctl enable lvm2-activate.service
%systemd_post lvm2-lvmetad.service lvm2-monitor.service lvm2-activate.service

%postun
/sbin/ldconfig
%systemd_postun_with_restart lvm2-lvmetad.service lvm2-monitor.service lvm2-activate.service

%files devel
%defattr(-,root,root,-)
Expand Down Expand Up @@ -414,6 +424,8 @@ systemctl enable lvm2-activate.service
/etc/lvm/profile/cache-smq.profile

%changelog
* Thu May 05 2016 Kumar Kaushik <[email protected]> 2.02.141-4
- Adding upgrade support in pre/post/un scripts.
* Thu Jan 28 2016 Anish Swaminathan <[email protected]> 2.02.141-3
- Fix post scripts for lvm
* Thu Jan 28 2016 Anish Swaminathan <[email protected]> 2.02.141-2
Expand Down
Loading

0 comments on commit d45b740

Please sign in to comment.