-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre and postun to clean the cookbook
- Loading branch information
Showing
1 changed file
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,9 @@ chmod -R 0755 %{buildroot}/var/chef/cookbooks/snmp | |
install -D -m 0644 README.md %{buildroot}/var/chef/cookbooks/snmp/README.md | ||
|
||
%pre | ||
if [ -d /var/chef/cookbooks/snmp ]; then | ||
rm -rf /var/chef/cookbooks/snmp | ||
fi | ||
|
||
%post | ||
case "$1" in | ||
|
@@ -36,6 +39,12 @@ case "$1" in | |
;; | ||
esac | ||
|
||
%postun | ||
# Deletes directory when uninstall the package | ||
if [ "$1" = 0 ] && [ -d /var/chef/cookbooks/snmp ]; then | ||
rm -rf /var/chef/cookbooks/snmp | ||
fi | ||
|
||
%files | ||
%defattr(0755,root,root) | ||
/var/chef/cookbooks/snmp | ||
|
@@ -45,5 +54,8 @@ esac | |
%doc | ||
|
||
%changelog | ||
* Wed Dec 14 2016 Alberto Rodríguez <[email protected]> - 1.0.0-1 | ||
* Thu Oct 10 2024 Miguel Negrón <[email protected]> | ||
- Add pre and postun | ||
|
||
* Wed Dec 14 2016 Alberto Rodríguez <[email protected]> | ||
- first spec version |