diff --git a/bin/crew b/bin/crew index 7bbbfa1ca..c1befbb89 100755 --- a/bin/crew +++ b/bin/crew @@ -1258,7 +1258,7 @@ def install # remove it just before the file copy if @pkg.in_upgrade puts 'Attempting removal since this is an upgrade or reinstall...' - Command.remove(@pkg, verbose: CREW_VERBOSE, force: @opt_force) + Command.remove(@pkg, verbose: CREW_VERBOSE, force: true, only_remove_files: true) end if @pkg.is_fake? diff --git a/commands/remove.rb b/commands/remove.rb index ce0071d5f..9283bdf32 100644 --- a/commands/remove.rb +++ b/commands/remove.rb @@ -6,7 +6,7 @@ require_relative '../lib/package' require_relative '../lib/package_utils' class Command - def self.remove(pkg, verbose: false, force: false) + def self.remove(pkg, verbose: false, force: false, only_remove_files: false) device_json = JSON.load_file(File.join(CREW_CONFIG_PATH, 'device.json')) # Make sure the package is actually installed before we attempt to remove it. @@ -19,8 +19,6 @@ class Command # CREW_ESSENTIAL_PACKAGES is nil if overriding package upgrade list... return if CREW_ESSENTIAL_PACKAGES.nil? if CREW_ESSENTIAL_PACKAGES.include?(pkg.name) && !force - return if pkg.in_upgrade - # Exit with failure if attempt to remove an essential package # is made. abort <<~ESSENTIAL_PACKAGE_WARNING_EOF.gsub(/^(?=\w)/, ' ').chomp.lightred @@ -52,7 +50,7 @@ class Command end # Perform any operations required prior to package removal. - pkg.preremove + pkg.preremove unless only_remove_files # Use gem to first try to remove gems... if pkg.name.start_with?('ruby_') @@ -128,7 +126,7 @@ class Command ConvenienceFunctions.save_json(device_json) # Perform any operations required after package removal. - pkg.postremove + pkg.postremove unless only_remove_files puts "#{pkg.name} removed!".lightgreen end diff --git a/lib/const.rb b/lib/const.rb index eec1603a5..6f2776803 100644 --- a/lib/const.rb +++ b/lib/const.rb @@ -4,7 +4,7 @@ require 'etc' require 'open3' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' -CREW_VERSION ||= '1.64.8' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION +CREW_VERSION ||= '1.64.9' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION # Kernel architecture. KERN_ARCH ||= Etc.uname[:machine] diff --git a/tests/unit_test.sh b/tests/unit_test.sh index 6797bbc22..ceebca141 100755 --- a/tests/unit_test.sh +++ b/tests/unit_test.sh @@ -65,7 +65,7 @@ if [[ -n ${CHANGED_PACKAGES-} ]]; then yes | time crew remove "${pkg}" || true else echo "Testing removal of ${pkg}." - yes | time crew remove "${pkg}" + yes | time crew remove -f "${pkg}" fi else echo "${pkg^} is not compatible."