| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Make sure that old hiera cruft is removed |
| 4 |
# This also allows us to downgrade hiera as |
| 5 |
# it's more likely that installing old versions |
| 6 |
# over new will cause issues. |
| 7 |
# |
| 8 |
# ${3} is the destination volume so that this works correctly |
| 9 |
# when being installed to volumes other than the current OS. |
| 10 |
|
| 11 |
<%- ["@apple_libdir", "@apple_sbindir", "@apple_bindir", "@apple_docdir", "@package_name"].each do |i| -%> |
| 12 |
<%- val = instance_variable_get(i) -%> |
| 13 |
<%- raise "Critical variable #{i} is unset!" if val.nil? or val.empty? -%> |
| 14 |
<%- end -%> |
| 15 |
|
| 16 |
# remove ruby library files |
| 17 |
<%- Dir.chdir("lib") do -%> |
| 18 |
<%- [@apple_old_libdir, @apple_libdir].compact.each do |libdir| -%> |
| 19 |
<%- Dir["**/*"].select{ |i| File.file?(i) }.each do |file| -%> |
| 20 |
/bin/rm -f "${3}<%= libdir %>/<%= file %>" |
| 21 |
<%- end -%> |
| 22 |
<%- end -%> |
| 23 |
<%- end -%> |
| 24 |
|
| 25 |
# remove bin files |
| 26 |
<%- Dir.chdir("bin") do -%> |
| 27 |
<%- Dir["**/*"].select{ |i| File.file?(i) }.each do |file| -%> |
| 28 |
/bin/rm -f "${3}<%= @apple_bindir %>/<%= file %>" |
| 29 |
<%- end -%> |
| 30 |
<%- end -%> |
| 31 |
|
| 32 |
# remove old doc files |
| 33 |
/bin/rm -Rf "${3}<%= @apple_docdir %>/<%= @package_name %>" |