Compare commits

..

2 Commits

Author SHA1 Message Date
641163a495 Implement dry-run mode.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-02 13:17:02 +02:00
75c663eb1e Update help information.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-02 13:12:34 +02:00
2 changed files with 20 additions and 11 deletions

View File

@ -21,19 +21,22 @@ is especially helpful if the last update broke your system for some reason.
.SH "OPTIONS" .SH "OPTIONS"
.TP .TP
\fB\-i\fR \fB\-i\fR
Interactively select the transactions to undo (default behavior) Enter interactive mode to select package operations to undo (default behavior)
.TP .TP
\fB\-r\fR \fB\-r\fR
Non-interactively undo transactions Non-interactively undo entire transactions
.TP .TP
\fB\-t\fR <\fInum\fR> \fB\-t\fR <\fInum\fR>
Select number of transactions to include (default: 1) Specify the number of transactions to include (default: 1)
.TP
\fB\-d\fR
Dry run, i.e. don't actually do anything
.TP .TP
\fB\-h\fR \fB\-h\fR
Show help information Show this help information
.TP .TP
\fB\-v\fR \fB\-v\fR
Show program version Print program version
.SH "AUTHOR" .SH "AUTHOR"
Written by Nicolás A. Ortega Froysa. Written by Nicolás A. Ortega Froysa.

View File

@ -47,9 +47,9 @@ USAGE:
$PROG_NAME -v $PROG_NAME -v
OPTIONS: OPTIONS:
-i Enter interactive mode to select packages to downgrade [default behavior] -i Enter interactive mode to select package operations to undo (default behavior)
-r Automatically downgrade all packages from last upgrade -r Non-interactively undo entire transactions
-t <num> Specify the number of transactions to include for undoing selection [default 1] -t <num> Specify the number of transactions to include (default: 1)
-d Dry run, i.e. don't actually do anything -d Dry run, i.e. don't actually do anything
-h Show this help information -h Show this help information
-v Print program version\n"); -v Print program version\n");
@ -239,6 +239,12 @@ foreach my $tx (@undo_txs) {
} }
} }
system("$pkgmgr->{remove} $remove_pkgs") if ($remove_pkgs ne ''); if ($dry_run) {
system("$pkgmgr->{install_remote} $remote_install_pkgs") if ($remote_install_pkgs ne ''); print("$pkgmgr->{remove} $remove_pkgs\n") if ($remove_pkgs ne '');
system("$pkgmgr->{install_local} $local_install_pkgs") if ($local_install_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 '');
}