bin/tpkg in tpkg-1.23.3 vs bin/tpkg in tpkg-1.25.1

- old
+ new

@@ -29,11 +29,11 @@ @worker_count = 10 @rerun_with_sudo = false @tpkg_options = {} # options for instantiating Tpkg object @init_options = {} # options for how to run init scripts @other_options = {} -@compress = nil +@compress = "gzip" def rerun_with_sudo_if_necessary if Process.euid != 0 && @sudo warn "Executing with sudo" @@ -212,16 +212,23 @@ end opts.on('--qX', '=FILENAME', 'Display tpkg.xml or tpkg.yml of the given package') do |opt| @action = :query_tpkg_metadata @action_value = opt end +opts.on('--history', 'Display package installation history') do |opt| + @action = :query_history +end opts.on('--qenv', "Display machine's information") do |opt| @action = :query_env end opts.on('--source', '=NAME', 'Sources where packages are located', Array) do |opt| @tpkg_options["sources"] = opt end +opts.on('--download', '=PACKAGES', 'Download one or more packages', Array) do |opt| + @action = :download + @action_value = opt +end opts.on('-n', '--no-prompt', 'No confirmation prompts') do |opt| @prompt = opt Tpkg::set_prompt(@prompt) end opts.on('--quiet', 'Reduce informative but non-essential output') do |opt| @@ -250,11 +257,15 @@ opts.on('--deploy-as', '=USERNAME', 'What username to use for deploying to remote server') do |opt| @deploy_options["deploy-as"] = opt @deploy_params = @deploy_params - ['--deploy-as'] end opts.on('--compress', '=[TYPE]', 'Compress files when making packages') do |opt| - @compress = opt + if opt == "no" + @compress= false + else + @compress = opt + end end opts.on('--debug', 'Print lots of messages about what tpkg is doing') do |opt| @debug = opt Tpkg::set_debug(@debug) end @@ -390,10 +401,13 @@ tpkg = instantiate_tpkg(@tpkg_options) ret_val = tpkg.upgrade(@action_value, passphrase_callback, @other_options) when :remove tpkg = instantiate_tpkg(@tpkg_options) ret_val = tpkg.remove(@action_value, @other_options) +when :download + tpkg = instantiate_tpkg(@tpkg_options) + ret_val = tpkg.download_pkgs(@action_value, @other_options) when :verify result = nil # Verify a given .tpkg file if File.exist?(@action_value) Tpkg::verify_package_checksum(@action_value) @@ -612,7 +626,10 @@ puts "File #{@action_value} doesn't exist." end when :query_env puts "Operating System: #{Tpkg::get_os}" puts "Architecture: #{Tpkg::get_arch}" +when :query_history + tpkg = instantiate_tpkg(@tpkg_options) + tpkg.installation_history end exit ret_val