Compare commits
No commits in common. "795a06f4be060f14b3e307aa5a36fcb0c92510ca" and "d4f0f15341dd78f23837dc7a1c93609ce21ff24a" have entirely different histories.
795a06f4be
...
d4f0f15341
@ -11,13 +11,12 @@ to boot from a USB depending on just how broken it is).
|
||||
|
||||
- Perl 5
|
||||
- `File::ReadBackwards` module
|
||||
- cURL
|
||||
- GNU Makefile
|
||||
|
||||
You can install these packages with the following command:
|
||||
|
||||
```console
|
||||
# pacman -S perl perl-file-readbackwards curl
|
||||
# pacman -S perl perl-file-readbackwards
|
||||
```
|
||||
|
||||
### Compiling & Installing
|
||||
|
51
pacundo.pl
51
pacundo.pl
@ -183,7 +183,6 @@ sub find_local_pkg($pkgmgr, $pkg_name, $pkg_ver='') {
|
||||
my $pkg_file = '';
|
||||
my $pkg_pat;
|
||||
my $repo = `$pkgmgr->{info} $pkg_name | awk '{ if (\$1 == "Repository") print \$3; }'`;;
|
||||
chomp($repo);
|
||||
|
||||
if ($pkg_ver ne '') {
|
||||
$pkg_pat = "$pkg_name-$pkg_ver-*.pkg.tar.zst";
|
||||
@ -200,9 +199,9 @@ sub find_local_pkg($pkgmgr, $pkg_name, $pkg_ver='') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$pkg_file = `ls $aur_dir/$pkg_pat 2> /dev/null | tail -n1`;
|
||||
$pkg_file = `ls $aur_dir/$pkg_pat | tail -n1`;
|
||||
} else {
|
||||
$pkg_file = `ls /var/cache/pacman/pkg/$pkg_pat 2> /dev/null | tail -n1`;
|
||||
$pkg_file = `ls /var/cache/pacman/pkg/$pkg_pat | tail -n1`;
|
||||
}
|
||||
|
||||
chomp($pkg_file);
|
||||
@ -210,44 +209,6 @@ sub find_local_pkg($pkgmgr, $pkg_name, $pkg_ver='') {
|
||||
return $pkg_file;
|
||||
}
|
||||
|
||||
sub find_remote_archive($pkgmgr, $pkg_name, $pkg_ver) {
|
||||
my $repo = `$pkgmgr->{info} $pkg_name | awk '{ if (\$1 == "Repository") print \$3; }'`;;
|
||||
chomp($repo);
|
||||
# TODO: look through git history for version.
|
||||
if ($repo eq 'aur') {
|
||||
return '';
|
||||
}
|
||||
|
||||
# TODO: Probably a better way of managing architectures. There should be a
|
||||
# way of getting the architecture of the package.
|
||||
my @archs = (`uname -m`, 'any');
|
||||
my $ala_url = "https://archive.archlinux.org/packages/" .
|
||||
substr($pkg_name,0,1) . "/" . $pkg_name;
|
||||
my $pkg_file = '';
|
||||
|
||||
foreach my $arch (@archs) {
|
||||
chomp($arch);
|
||||
my $filename = "$pkg_name-$pkg_ver-$arch.pkg.tar.zst";
|
||||
my $pkg_url = "$ala_url/$filename";
|
||||
my $output_file = "/tmp/$filename";
|
||||
|
||||
my $resp = `curl -Lo $output_file -s -w '%{http_code}\n' $pkg_url`;
|
||||
chomp($resp);
|
||||
if ($resp eq '200') {
|
||||
system("curl -Lo $output_file.sig -s $pkg_url.sig");
|
||||
$pkg_file = $output_file;
|
||||
last;
|
||||
} else {
|
||||
unlink $output_file;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pkg_file ne '') {
|
||||
print("Downloaded from archive: $pkg_file\n");
|
||||
}
|
||||
return $pkg_file;
|
||||
}
|
||||
|
||||
getopts("irt:dvh", \my %opts);
|
||||
|
||||
if ($opts{'v'}) {
|
||||
@ -291,12 +252,10 @@ foreach my $tx (@undo_txs) {
|
||||
}
|
||||
} else {
|
||||
my $pkg_file = &find_local_pkg($pkgmgr, $tx->{pkg_name}, $tx->{oldver});
|
||||
$pkg_file = &find_remote_archive($pkgmgr, $tx->{pkg_name}, $tx->{oldver}) if ($pkg_file eq '');
|
||||
|
||||
if ($pkg_file ne '') {
|
||||
$local_install_pkgs .= "$pkg_file ";
|
||||
if ($pkg_file eq '') {
|
||||
$remote_install_pkgs .= "$tx->{pkg_name} ";
|
||||
} else {
|
||||
print(STDERR "Unable to find $tx->{pkg_name} $tx->{pkg_ver}");
|
||||
$local_install_pkgs .= "$pkg_file ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user