lib/vagrant/util/subprocess.rb in vagrant-unbundled-2.1.2.0 vs lib/vagrant/util/subprocess.rb in vagrant-unbundled-2.1.4.0
- old
+ new
@@ -91,11 +91,11 @@
process.io.stderr = stderr_writer
process.duplex = true
# Special installer-related things
if Vagrant.in_installer?
- installer_dir = ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"].to_s.downcase
+ installer_dir = Vagrant.installer_embedded_dir.to_s.downcase
# If we're in an installer on Mac and we're executing a command
# in the installer context, then force DYLD_LIBRARY_PATH to look
# at our libs first.
if Platform.darwin?
@@ -120,9 +120,21 @@
internal = [installer_dir, Vagrant.user_data_path.to_s.downcase].
any? { |path| @command[0].downcase.include?(path) }
if !internal
@logger.info("Command not in installer, restoring original environment...")
jailbreak(process.environment)
+ end
+
+ # If running within an AppImage and calling external executable. When
+ # executable is external set the LD_LIBRARY_PATH to host values.
+ if ENV["VAGRANT_APPIMAGE"]
+ embed_path = Pathname.new(Vagrant.installer_embedded_dir).expand_path.to_s
+ exec_path = Pathname.new(@command[0]).expand_path.to_s
+ if !exec_path.start_with?(embed_path) && ENV["VAGRANT_APPIMAGE_LD_LIBRARY_PATH"]
+ @logger.info("Detected AppImage environment and request to external binary. Updating library path.")
+ @logger.debug("Setting LD_LIBRARY_PATH to #{ENV["VAGRANT_APPIMAGE_LD_LIBRARY_PATH"]}")
+ process.environment["LD_LIBRARY_PATH"] = ENV["VAGRANT_APPIMAGE_LD_LIBRARY_PATH"].to_s
+ end
end
else
@logger.info("Vagrant not running in installer, restoring original environment...")
jailbreak(process.environment)
end