fixup install.sh path insertion, Adds fixup section to crew to run during crew update. (#8807)

* fixup install.sh path insertion

* Add version to path env.d file

* add fixups.rb

* add more verbose comment

* change require to load

* change fixup path

* change fixup path

* bump version

* add more verbose message to fixup.rb

* fix escaping

* bump version

* add crew version check in fixup

* fixup

* fixup

* fixup

* Make LD_LIBRARY_PATH setting i686 only

* remove musl path from installer

* suggested changes

* suggested changes
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2023-10-19 22:35:05 -04:00
committed by GitHub
parent 5646a803f4
commit fc43ffde1e
4 changed files with 23 additions and 9 deletions

View File

@@ -619,9 +619,6 @@ end
def update
abort "'crew update' is used to update crew itself. Use 'crew upgrade <package1> [<package2> ...]' to update specific packages.".orange if @pkgName
# remove deprecated directory
FileUtils.rm_rf "#{HOME}/.cache/crewcache/manifest"
# update package lists
Dir.chdir(CREW_LIB_PATH) do
# Set sparse-checkout folders.
@@ -641,6 +638,9 @@ def update
puts 'Package lists, crew, and library updated.'
# Do any fixups necessary after crew has updated from git.
load "#{CREW_LOCAL_REPO_ROOT}/lib/fixup.rb"
# update compatible packages
generate_compatible
# check for outdated installed packages

View File

@@ -294,12 +294,12 @@ echo_out "Set up and synchronize local package repo..."
# Set LD_LIBRARY_PATH so crew doesn't break on i686 and
# the mandb postinstall doesn't fail.
echo "LD_LIBRARY_PATH=$CREW_PREFIX/lib:$CREW_PREFIX/lib$LIB_SUFFIX" >> "$CREW_PREFIX"/etc/env.d/00-library
export LD_LIBRARY_PATH=$CREW_PREFIX/lib:$CREW_PREFIX/lib$LIB_SUFFIX
if [[ "$ARCH" == "i686" ]]; then
echo "LD_LIBRARY_PATH=$CREW_PREFIX/lib:/lib" >> "$CREW_PREFIX"/etc/env.d/00-library
export LD_LIBRARY_PATH=$CREW_PREFIX/lib:/lib
fi
# Add the CREW_PREFIX bin and musl bin directories to PATH.
echo "PATH=$CREW_PREFIX/bin:$CREW_PREFIX/sbin:$CREW_PREFIX/share/musl/bin:$PATH" >> "$CREW_PREFIX"/etc/env.d/path
export PATH=$CREW_PREFIX/bin:$CREW_PREFIX/share/musl/bin:$PATH
echo -e "## Inserted by Chromebrew's install.sh\nPATH=$CREW_PREFIX/bin:$CREW_PREFIX/sbin:$CREW_PREFIX/share/musl/bin:\$PATH" > "$CREW_PREFIX"/etc/env.d/path
echo "export CREW_PREFIX=${CREW_PREFIX}" >> "${CREW_PREFIX}/etc/env.d/profile"

View File

@@ -1,5 +1,5 @@
# Defines common constants used in different parts of crew
CREW_VERSION = '1.36.3'
CREW_VERSION = '1.36.4'
# kernel architecture
KERN_ARCH = `uname -m`.chomp

14
lib/fixup.rb Normal file
View File

@@ -0,0 +1,14 @@
# Add fixups to be run during crew update here.
# remove deprecated directory
FileUtils.rm_rf "#{HOME}/.cache/crewcache/manifest"
# Fix missing $PATH not added in install.sh
if !system("grep -q '$PATH' #{CREW_PREFIX}/etc/env.d/path") || Gem::Version.new(CREW_VERSION.to_s) < Gem::Version.new('1.36.4')
puts 'Fixing path env.d file...'.orange
puts "Please run 'source ~/.bashrc'".lightblue
File.write "#{CREW_PREFIX}/etc/env.d/path", <<~ENVD_PATH_EOF
## Inserted by Chromebrew version #{CREW_VERSION}
PATH=#{CREW_PREFIX}/bin:#{CREW_PREFIX}/sbin:#{CREW_PREFIX}/share/musl/bin:$PATH
ENVD_PATH_EOF
end