Skip to content

Allow forcing use of dpkg to install deb package #167

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 22 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ begin
install [--sanity-check] [--proxy http://hostname:port] <package-type>
--sanity-check [optional]
--proxy [optional]
package-type: 'rpm', 'deb', or 'auto'
package-type: 'rpm', 'deb', 'debdpkg' or 'auto'

Installs fetches the latest package version of the specified type and
installs it. rpms are installed with yum; debs are installed using gdebi.
The 'debdpkg' option forces the installation of deb packages with the dpkg command.

This program is invoked automatically to update the agent once per day using
the same package manager the codedeploy-agent is initially installed with.
Expand Down Expand Up @@ -385,14 +386,33 @@ end
else
#use -n for non-interactive mode
#use -o to not overwrite config files unless they have not been changed
install_cmd = ['/usr/bin/gdebi', '-n', '-o', 'Dpkg::Options::=--force-confdef', '-o', 'Dkpg::Options::=--force-confold']
install_cmd = ['/usr/bin/gdebi', '-n', '-o', 'Dpkg::Options::=--force-confdef', '-o', 'Dpkg::Options::=--force-confold']
install_from_s3(region, bucket, version_file_key, @type, install_cmd)
do_sanity_check('/usr/sbin/service')
end
when 'zypper'
#use -n for non-interactive mode
install_cmd = ['/usr/bin/zypper', 'install', '-n']
install_from_s3(region, bucket, version_file_key, 'rpm', install_cmd)
when 'debdpkg'
running_agent = `dpkg -s codedeploy-agent`
running_agent_info = running_agent.split
version_index = running_agent_info.index('Version:')
if !version_index.nil?
running_version = running_agent_info[version_index + 1]
else
running_version = "No running version"
end
@log.info("Running version " + running_version)
target_version = get_version_file_from_s3(region, bucket, version_file_key)['deb']
if target_version.include? running_version
@log.info('Running version matches target version, skipping install')
else
#use --force-confdef,confold to ignore existing config files
install_cmd = ['/usr/bin/dpkg', '--install', '--force-confdef,confold']
install_from_s3(region, bucket, version_file_key, "deb", install_cmd)
do_sanity_check('/usr/sbin/service')
end
else
@log.error("Unsupported package type '#{@type}'")
exit(1)
Expand Down