From 45c5612efb86a8e819e3e86ef8accab609f7e220 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Tue, 2 Nov 2021 14:13:09 +0100 Subject: [PATCH] dup: Added --regenerate to print all command necessary to regenerate a container from scratch. --- dup.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dup.rb b/dup.rb index 26a3eaa..482e350 100755 --- a/dup.rb +++ b/dup.rb @@ -155,6 +155,15 @@ def run_cmd(cmd, ignore_returnvalue=false, catch_interrupt=false, ignore_dry_run return returnvalue end +def collect_commands(&block) + $commands = [] + def run_cmd(cmd, ignore_returnvalue=false, catch_interrupt=false, ignore_dry_run: false); $commands</dev/null") + run_cmd(cmd + " >/dev/null") self.connect_to_networks @@ -440,6 +448,7 @@ class Container data[name] = result end + @data = data return data end end @@ -506,6 +515,7 @@ opts.each do |opt, arg| $net_host = true when '--regenerate' action = :regenerate + needs_container = false when '--verbose' $verbose = true when '--all' @@ -533,6 +543,7 @@ elsif action == :update action_update(base_dir) elsif action == :regenerate action_regenerate(container) + container.each {|c| puts c.build_run_command} elsif action == :_completion action_completion($base_dir, completion_str) end