6 Commits

Author SHA1 Message Date
858d44b5ca Bump version to v1.0.1
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-21 15:45:25 +02:00
e18136e43c Makefile: create parent directories if not exists.
Signed-off-by: Nicolas A. Ortega Froysa <nicolas.ortega@babelgroup.com>
2024-05-21 15:41:36 +02:00
d692d4aa59 Makefile: Fix PREFIX handling.
Signed-off-by: Nicolas A. Ortega Froysa <nicolas.ortega@babelgroup.com>
2024-05-21 15:41:36 +02:00
1516ce9ff3 Include section for supported AUR helpers.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-07 18:07:13 +02:00
555ead272e Improve repository check.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-07 18:05:11 +02:00
d616930208 Remove unnecessary sudo.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2024-05-07 17:49:20 +02:00
4 changed files with 31 additions and 14 deletions

View File

@ -20,7 +20,9 @@
# 3. This notice may not be removed or altered from any source
# distribution.
PREFIX=/usr/local
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
pacundo: pacundo.pl
pp -o $@ $^
@ -35,5 +37,7 @@ clean:
$(RM) pacundo.1.gz
install: pacundo pacundo.1.gz
install -d $(PREFIX)/bin
install -m 755 pacundo $(PREFIX)/bin/
install -d $(PREFIX)/share/man/man1
install -m 644 pacundo.1.gz $(PREFIX)/share/man/man1/

View File

@ -45,6 +45,10 @@ There are two modes for undoing pacman transactions:
Look at the man-page (`man pacundo`) for more information.
### Supported AUR Helpers
- [yay](https://github.com/Jguer/yay)
## License
This project is licensed under the terms & conditions of the Zlib license.

View File

@ -1,4 +1,4 @@
.TH PACUNDO "1" "April 2024" "pacundo 1.0" "User Commands"
.TH PACUNDO "1" "April 2024" "pacundo 1.0.1" "User Commands"
.SH "NAME"
pacundo - A time machine to return your ArchLinux machine back to a working state.
.SH "SYNOPSIS"

View File

@ -29,7 +29,7 @@ use feature qw(signatures);
use Getopt::Std;
use File::ReadBackwards;
my $VERSION = '1.0';
my $VERSION = '1.0.1';
my $PROG_NAME = 'pacundo';
sub print_version() {
@ -169,7 +169,8 @@ sub get_pkgmgr() {
my %pkgmgr = (
name => $mgr,
bin => $mgr_bin,
search => "$sudo $mgr_bin -Ss",
search => "$mgr_bin -Ss",
info => "$mgr_bin -Si",
install_remote => "$sudo $mgr_bin -S",
install_local => "$sudo $mgr_bin -U",
remove => "$sudo $mgr_bin -R",
@ -180,23 +181,31 @@ sub get_pkgmgr() {
sub find_local_pkg($pkgmgr, $pkg_name, $pkg_ver='') {
my $pkg_file = '';
my $aur_dir = "$ENV{'XDG_CACHE_HOME'}/yay/$pkg_name";
my $pkg_pat;
my $repo = `$pkgmgr->{info} $pkg_name | awk '{ if (\$1 == "Repository") print \$3; }'`;;
if ($pkgmgr->{name} eq 'yay' && -d $aur_dir) {
if ($pkg_ver ne '') {
$pkg_file = `ls $aur_dir/$pkg_name-$pkg_ver-*.pkg.tar.zst | tail -n1`;
} else {
$pkg_file = `ls $aur_dir/$pkg_name-*.pkg.tar.zst | tail -n1`;
}
if ($pkg_ver ne '') {
$pkg_pat = "$pkg_name-$pkg_ver-*.pkg.tar.zst";
} else {
if ($pkg_ver ne '') {
$pkg_file = `ls /var/cache/pacman/pkg/$pkg_name-$pkg_ver-*.pkg.tar.zst | tail -n1`;
$pkg_pat = "$pkg_name-*.pkg.tar.zst";
}
if ($repo eq 'aur') {
my $aur_dir;
if ($pkgmgr->{name} eq 'yay') {
$aur_dir = "$ENV{'XDG_CACHE_HOME'}/yay/$pkg_name";
} else {
$pkg_file = `ls /var/cache/pacman/pkg/$pkg_name-*.pkg.tar.zst | tail -n1`;
return '';
}
$pkg_file = `ls $aur_dir/$pkg_pat | tail -n1`;
} else {
$pkg_file = `ls /var/cache/pacman/pkg/$pkg_pat | tail -n1`;
}
chomp($pkg_file);
return $pkg_file;
}