You are not logged in.
Pages: 1
Topic closed
I'm running pacman from a script and it would be preferable if it didn't abort because of missing packages.
Is there a way of configuring pacman so that it installs everything it can first, and notifies the user about missing targets only at the very end? (assuming of course that the missing targets are not dependencies of other packages)
Offline
Maybe you can run a 'for' loop instead of 'pacman -Syu foo bar baz'.
Please post the exact command you're using.
Offline
Or, perhaps, for a simpler output, first run a `pacman -Ss pkgname` for each one in a for loop, and append only those that are found to a variable (ie $pkglist). Then `pacman -Syu $pkglist`.
This wouldn't be any quicker, but it would avoid errors, and it would allow the final installation to run in one shot.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
*If* your list of packages are all _actual_ package names, (e.g. python-setuptools, NOT python-distribute which python-setuptools now provides), something like this will do:
pkgs=(foo bar baz)
pkgs_200=($(comm -12 <(pacman -Slq|sort -u) <(printf '%s\n' "${pkgs[@]}"|sort -u)))
pkgs_404=($(comm -23 <(printf '%s\n' "${pkgs[@]}"|sort -u) <(printf '%s\n' "${pkgs_200[@]}")))
pacman -S "${pkgs_200[@]}"
printf "404 Not Found:\n" >&2
printf "%s\n" "${pkgs_404[@]}" >&2
This silver ladybug at line 28...
Offline
Or, perhaps, for a simpler output, first run a `pacman -Ss pkgname` for each one in a for loop
pacman -Sp pkgname might be easier to work with.
Offline
FWIW, I actually tried posting a feature request for this before:
Offline
Incorporating cookies' idea (-Sp), here is a proper version that should work with any package list; even more HTTP code abuse:
#!/bin/bash
declare -a pkgs pkgs_200 pkgs_202 pkgs_404
declare -A pkgs_301
pkgs=(foo bar baz)
pkgs=($(printf '%s\n' "${pkgs[@]}"|sort -u))
pkgs_200=($(comm -12 <(pacman -Slq|sort -u) <(printf '%s\n' "${pkgs[@]}")))
pkgs_202=($(comm -23 <(printf '%s\n' "${pkgs[@]}") <(printf '%s\n' "${pkgs_200[@]}")))
for pkg in "${pkgs_202[@]}"; do
pkgname=$(pacman -Spdd --print-format %n "$pkg" 2> /dev/null)
if [[ -n $pkgname ]]; then
pkgs_301[$pkg]=$pkgname
else
pkgs_404+=("$pkg")
fi
done
pacman -S "${pkgs_200[@]}" "${pkgs_301[@]}"
printf "\n301 Moved Permanently:\n" >&2
paste -d : <(printf "%s\n" "${!pkgs_301[@]}") <(printf "%s\n" "${pkgs_301[@]}") >&2
printf "\n404 Not Found:\n" >&2
printf "%s\n" "${pkgs_404[@]}" >&2
Edit: use `pacman -Spdd` to prevent listing of dependencies.
Last edited by lolilolicon (2013-09-10 23:34:13)
This silver ladybug at line 28...
Offline
This is what I did:
for P in $( </tmp/package-list-one-per-line )
do
if ! (pacman -Q | grep ${P} > /dev/null)
then
pacman -S ${P} --noconfirm
fi
done
Offline
This is what I did:
I doubt the OP is still looking for an answer two and a half years later. Please pay attention to the dates and follow the forum rules.
https://wiki.archlinux.org/index.php/Fo … bumping.22
Offline
Using this opportunity to close this old thread.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed