Skip to content

Commit

Permalink
Add pre and postun
Browse files Browse the repository at this point in the history
  • Loading branch information
manegron committed Oct 10, 2024
1 parent 05bf51d commit 83c10e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packaging/rpm/cookbook-rb-common.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ chmod -R 0755 %{buildroot}/var/chef/cookbooks/rb-common
install -D -m 0644 README.md %{buildroot}/var/chef/cookbooks/rb-common/README.md

%pre
if [ -d /var/chef/cookbooks/rb-common ]; then
rm -rf /var/chef/cookbooks/rb-common
fi

%post
case "$1" in
Expand All @@ -38,7 +41,9 @@ esac

%postun
# Deletes directory when uninstall/update the package
rm -rf /var/chef/cookbooks/rb-common
if [ "$1" = 0 ] && [ -d /var/chef/cookbooks/rb-common ]; then
rm -rf /var/chef/cookbooks/rb-common
fi

%files
%defattr(0755,root,root)
Expand Down

0 comments on commit 83c10e8

Please sign in to comment.