Hey guys! Quick question. I’m playing with bash, to be more exact Woeusb. I was just wondering is it possible to report the progress in a kidalog progressbar.

Here’s what i have

Blockquote#!/bin/bash
PASSWORD=$(kdialog --title “Enter Root password” --password “Enter your password to run the script as root”)
output=$(kdialog --getopenfilename “Select iso file” “select iso” --title “Select iso file”)
answer=$(kdialog “Select sub drive” --combobox “Select USB Device” $(lsblk --nodeps --paths --output NAME,TRAN | grep usb | awk ‘{print $1}’))
echo “$PASSWORD” | sudo -S bash -c woeusb --device if=$output of=$anaswer

I would love any feedback you can offer.

Regards:

TheYikes

1 Spice up

or if it’s any easier perhaps i could try DD instead of woeusb.

OK i tried using

echo “$PASSWORD” | sudo -S dd if=/dev/sda of=/dev/sdb bs=4M status=progress | kdialog --progressbar “Copying Data” 100

but the progress bar isn’t changing.

i attempted to run “echo “$PASSWORD” | sudo -S bash -c dd if=$output of=$answer bs=4M status=progress | kdialog --progressbar “Copying Data” 100”
but i keep getting this error.
kf.kio.core: KFileFilter::fromMimeType() called with empty input
kf.kio.core: KFileFilter::fromMimeType() called with unknown MIME type “select”
kf.kio.core: KFileFilter::fromMimeType() called with unknown MIME type “iso”
0+1 records in
0+1 records out
7 bytes copied, 5.7094e-05 s, 123 kB/s
org.kde.kdialog-86647 /ProgressDialog

The issue you are having is that dialog (or the K version) doesn’t know how to parse the output of ‘dd’ or ‘woeusb’ (that isn’t one I’ve heard of). Try using ‘pv’ - the progress viewer - it acts like ‘cat’ with statistics.

echo "$PASSWORD" | sudo -S pv -n -s $(du -sb ${output} | awk '{print $1}') ${output} > ${answer} | kdialog --progressbar “Copying Data” 100

A thing to note - this is going to overwrite ${Answer} with the contents of ${Output} - that seems backwards to me.

1 Spice up

Oh my god two things, first thanks for getting back to me so quickly, I’ll play around with you script later. Second… LinuxMonger!!! What a wicked name!!!