mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-07 22:54:11 -05:00
crew: Fix remove on reinstall/upgrade (#12520)
* Fix container test workflow Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Set `force: true` when reinstalling/upgrading Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Bump version Signed-off-by: SupeChicken666 <supechicken666@gmail.com> * Do not remove user configs on reinstallation Signed-off-by: SupeChicken666 <supechicken666@gmail.com> --------- Signed-off-by: SupeChicken666 <supechicken666@gmail.com>
This commit is contained in:
2
bin/crew
2
bin/crew
@@ -1258,7 +1258,7 @@ def install
|
|||||||
# remove it just before the file copy
|
# remove it just before the file copy
|
||||||
if @pkg.in_upgrade
|
if @pkg.in_upgrade
|
||||||
puts 'Attempting removal since this is an upgrade or reinstall...'
|
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
|
end
|
||||||
|
|
||||||
if @pkg.is_fake?
|
if @pkg.is_fake?
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require_relative '../lib/package'
|
|||||||
require_relative '../lib/package_utils'
|
require_relative '../lib/package_utils'
|
||||||
|
|
||||||
class Command
|
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'))
|
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.
|
# 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...
|
# CREW_ESSENTIAL_PACKAGES is nil if overriding package upgrade list...
|
||||||
return if CREW_ESSENTIAL_PACKAGES.nil?
|
return if CREW_ESSENTIAL_PACKAGES.nil?
|
||||||
if CREW_ESSENTIAL_PACKAGES.include?(pkg.name) && !force
|
if CREW_ESSENTIAL_PACKAGES.include?(pkg.name) && !force
|
||||||
return if pkg.in_upgrade
|
|
||||||
|
|
||||||
# Exit with failure if attempt to remove an essential package
|
# Exit with failure if attempt to remove an essential package
|
||||||
# is made.
|
# is made.
|
||||||
abort <<~ESSENTIAL_PACKAGE_WARNING_EOF.gsub(/^(?=\w)/, ' ').chomp.lightred
|
abort <<~ESSENTIAL_PACKAGE_WARNING_EOF.gsub(/^(?=\w)/, ' ').chomp.lightred
|
||||||
@@ -52,7 +50,7 @@ class Command
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Perform any operations required prior to package removal.
|
# Perform any operations required prior to package removal.
|
||||||
pkg.preremove
|
pkg.preremove unless only_remove_files
|
||||||
|
|
||||||
# Use gem to first try to remove gems...
|
# Use gem to first try to remove gems...
|
||||||
if pkg.name.start_with?('ruby_')
|
if pkg.name.start_with?('ruby_')
|
||||||
@@ -128,7 +126,7 @@ class Command
|
|||||||
ConvenienceFunctions.save_json(device_json)
|
ConvenienceFunctions.save_json(device_json)
|
||||||
|
|
||||||
# Perform any operations required after package removal.
|
# Perform any operations required after package removal.
|
||||||
pkg.postremove
|
pkg.postremove unless only_remove_files
|
||||||
|
|
||||||
puts "#{pkg.name} removed!".lightgreen
|
puts "#{pkg.name} removed!".lightgreen
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ require 'etc'
|
|||||||
require 'open3'
|
require 'open3'
|
||||||
|
|
||||||
OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
|
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.
|
# Kernel architecture.
|
||||||
KERN_ARCH ||= Etc.uname[:machine]
|
KERN_ARCH ||= Etc.uname[:machine]
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ if [[ -n ${CHANGED_PACKAGES-} ]]; then
|
|||||||
yes | time crew remove "${pkg}" || true
|
yes | time crew remove "${pkg}" || true
|
||||||
else
|
else
|
||||||
echo "Testing removal of ${pkg}."
|
echo "Testing removal of ${pkg}."
|
||||||
yes | time crew remove "${pkg}"
|
yes | time crew remove -f "${pkg}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "${pkg^} is not compatible."
|
echo "${pkg^} is not compatible."
|
||||||
|
|||||||
Reference in New Issue
Block a user