Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux path, variabilize script_generator and install #333

Merged
merged 1 commit into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/mixlib/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
require_relative "install/generator"
require_relative "install/generator/bourne"
require_relative "install/generator/powershell"
require_relative "install/dist"

module Mixlib
class Install
Expand Down Expand Up @@ -119,7 +120,7 @@ def root
# This only works for chef and chefdk but they are the only projects
# we are supporting as of now.
if options.for_ps1?
"$env:systemdrive\\opscode\\#{options.product_name}"
"$env:systemdrive\\#{Mixlib::Install::Dist::WINDOWS_INSTALL_DIR}\\#{options.product_name}"
else
"/opt/#{options.product_name}"
end
Expand All @@ -136,7 +137,7 @@ def current_version
# chef-server -> /opt/opscode). But this is OK for now since
# chef & chefdk are the only supported products.
version_manifest_file = if options.for_ps1?
"$env:systemdrive\\opscode\\#{options.product_name}\\version-manifest.json"
"$env:systemdrive\\#{Mixlib::Install::Dist::WINDOWS_INSTALL_DIR}\\#{options.product_name}\\version-manifest.json"
else
"/opt/#{options.product_name}/version-manifest.json"
end
Expand Down
2 changes: 2 additions & 0 deletions lib/mixlib/install/dist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Dist
MACOS_VOLUME = "chef_software".freeze
# Windows install directory name
WINDOWS_INSTALL_DIR = "opscode".freeze
# Linux install directory name
LINUX_INSTALL_DIR = "/opt"
end
end
end
5 changes: 3 additions & 2 deletions lib/mixlib/install/script_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

require_relative "util"
require_relative "generator/powershell"
require_relative "dist"
require "cgi"

module Mixlib
Expand Down Expand Up @@ -83,9 +84,9 @@ def initialize(version, powershell = false, opts = {})
@sudo_command = "sudo -E"

@root = if powershell
"$env:systemdrive\\opscode\\chef"
"$env:systemdrive\\#{Mixlib::Install::Dist::WINDOWS_INSTALL_DIR}\\#{Mixlib::Install::Dist::DEFAULT_PRODUCT}"
else
"/opt/chef"
"#{Mixlib::Install::Dist::LINUX_INSTALL_DIR}/#{Mixlib::Install::Dist::DEFAULT_PRODUCT}"
end

parse_opts(opts)
Expand Down