1

I need to display a progress bar with zenity or yad with pacaur/pacman or yaourt in Arch Linux/Manjaro.

The problem is that I can't capture the actual process with pacaur or other, only with pkcon, but packagekit failed with Arch Linux. This is my actual line with pacaur but doesn't work.

pacaur -S clementine >> /tmp/pacaur-url-tmp |
  tail --lines=1 /tmp/pacaur-url-tmp |
  yad --progress \
    --title="MyProgram - Installing ffdiaporama" \
    --width=300 \
    --height=200 \
    --text="A test my friend" \
    --pulsate \
    --auto-close \
    --button="Cancel (Not recommended):0"

Other problem, it ever ask when needs password root, I can't capture it also with zenity/yad...

This is the result with packagekit, yes is a simple gui installer and works in all distributions but Arch Linux doesn't work with packagekit.

You can see the output with pacaour Here.

4
  • Please give an example of the pacaur output so that non-Arch users can have an idea of what you are trying to process. Also please give more detail on what you expect to get with yad
    – Graeme
    Mar 18, 2014 at 20:18
  • Ok :) , i60.tinypic.com/30usb34.png
    – davidva
    Mar 18, 2014 at 20:32
  • Your not going to get anything as detailed that, this code will give you a progress bar and that's it. If you post an example of the text output from pacaur, I can suggest a fix for this.
    – Graeme
    Mar 18, 2014 at 20:36
  • @Graeme Ok, thanks. check my pastebin: pastebin.com/nm9F9dwD
    – davidva
    Mar 18, 2014 at 20:54

1 Answer 1

4

This should work, I have tested it on the output you posted. Note that I have used zenity since yad isn't in the Debian repositories. Also this is bash only.

(
  exec {fd}>&1
  stdbuf -oL pacaur -S clementine |
    stdbuf -oL tee /dev/fd/$fd |
    stdbuf -oL sed -n '/\.\.\.$/ s/^/# /p' |
    zenity --progress --title="pacaur progress" --pulsate \
      --width=450 --auto-close
)

One thing that might go wrong is that pacaur might print progress data to stderr instead of stdout, in which case the second line will probably need to be:

 stdbuf -eL -oL pacaur -S clementine 2>&1 |

I have added the exec {fd}>&1 and tee /dev/fd/$fd lines so that output will also be printed to the terminal. Without this this script will simply be:

  stdbuf -oL pacaur -S clementine |
    stdbuf -oL sed -n '/\.\.\.$/ s/^/# /p' |
    zenity --progress --title="pacaur progress" --pulsate \
      --width=450 --auto-close

Btw in my opinion the terminal is the best place to look for the installation progress, but since you asked, zenity is a nice thing to play with.

1
  • Yad is in Ubuntu 16.04 now: sudo apt install yad. May 29, 2018 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .