You are not logged in.
Pages: 1
Guys is there a way of installing packages using pacman in such a way that it prompts you about all the optional dependencies before installing just like pamac does?
Offline
I think it writes it during the installation process.
Archi3
Offline
You could probably write a wrapper using ``expac -S '%O\n' $pkg''. You might want to take care of cases where there is more than one package of a single name.
Offline
That should be a small %o in the expac format. And there'd be no need to deduplicate the output as pacman will handle this itself:
# install all optional dependencies (as explicit) for pkgs 1-3 that are already installed:
expac -Q %o $pkg1 $pkg2 $pkg3 | pacman -S -
# install package and all of it's optional dependencies:
expac -S "%n %o" $pkg | pacman -S -
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
If prompts for individual optional dependencies are desired, some more complexity is required, i believe.
Such as
typeset -a os
for o in `expac -S '%o\n' $pkgs`
do
read -p "Install ${o}? " r
[[ ${r,,} =~ ^y(|e|es)$ ]] && os+=( $o )
done
pacman -S $pkgs ${os[@]}
This assumes that no package name exists twice in the configured repositories.
A capital %O could be used to additionally list the respective reason on each prompt.
Edit: Fixed usage of whole array. Alternatively, a normal variable with spaces would suffice.
Last edited by respiranto (2021-01-01 17:13:42)
Offline
Thanks i will try this
Offline
Pages: 1