From 641163a4950ecc258acceefe10615978588a4eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Thu, 2 May 2024 13:17:02 +0200 Subject: [PATCH] Implement dry-run mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Ortega Froysa --- pacundo.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pacundo.pl b/pacundo.pl index c3cef92..1fe5852 100755 --- a/pacundo.pl +++ b/pacundo.pl @@ -239,6 +239,12 @@ foreach my $tx (@undo_txs) { } } -system("$pkgmgr->{remove} $remove_pkgs") if ($remove_pkgs ne ''); -system("$pkgmgr->{install_remote} $remote_install_pkgs") if ($remote_install_pkgs ne ''); -system("$pkgmgr->{install_local} $local_install_pkgs") if ($local_install_pkgs ne ''); +if ($dry_run) { + print("$pkgmgr->{remove} $remove_pkgs\n") if ($remove_pkgs ne ''); + print("$pkgmgr->{install_remote} $remote_install_pkgs\n") if ($remote_install_pkgs ne ''); + print("$pkgmgr->{install_local} $local_install_pkgs\n") if ($local_install_pkgs ne ''); +} else { + system("$pkgmgr->{remove} $remove_pkgs") if ($remove_pkgs ne ''); + system("$pkgmgr->{install_remote} $remote_install_pkgs") if ($remote_install_pkgs ne ''); + system("$pkgmgr->{install_local} $local_install_pkgs") if ($local_install_pkgs ne ''); +}