makethumb - Zenity script for burning images to USB

statmonkey

Not sure if there will be any interest in this but I have over time collected or put together quite a few zenity (and yad for that matter) scripts.  I thought that we might start something on the order of the bash aliases and collect a few of these that would help people have an idea of how to use them, or inspire some new creation, etc.  If their is interest I will post some of my yad scripts but I think zenity is probably more in regular use and after all there is very little top level difference between the two.

Post any scripts you like, loathe, etc. here.  I would love to see your work and good and bad I think it is how I learn best.

VastOne

^ Yes... I am most interested in this thread and will get to them when I can...

Thanks for sharing statmonkey!
VSIDO      VSIDO Change Blog    

    I dev VSIDO

Digit

me too!   VERY interested.

one of those things i'm itching to go play with, but just so many other things with their own momentum in the way first.

thnx loads for this thread.  :)

statmonkey

#3
I have been meaning to get back to this for some time.  I am triple posting here I guess which is dubious but hope to stir some contributions here.  The following script is something I threw together some time ago to see if I could.  Then as I was doing it wondered more if I should. :) Anyway, I like it as an example because it embraces quite a broad brush of what you can do with zen and uses various (although not close to all) of what zenity can do.  I realized that I really don't have a thread where I got all this or learned zenity.  I have just done all this hit and miss and I am sure that probably shows.

See Attachment later in thread

What is happening here?  Well the script will assume you have put a thumb in the drive but if not you can bail.  It will first check to see what you have mounted, then offer a short list of those mounts for you to grab the /dev location.  Then ask you to enter it.  It will then ask you to select your iso, confirm that you really want to do it.  Burn the thumb and offer you the opp to boot and see what you have done.

One of the things this thread and my self-posting is reminding me is that with zenity I usually use it for little routine things that I want a quick and dirty for.  I write them and then forget them (as in never edit or fix little gotcha's)  I think it psychologically makes it seem finished even if it isn't.  I hope that makes sense.  Anyway, I really need to add to my todo to go through all my zenity scripts and clean them up.  So even if no one else gets anything out of my assorted crap I guess I win.  ::)

VastOne

#4
Hey ZenMan...  8)

I have been a bit busy getting the ISO trimmed and healthy, but now that this is done I can devote some more time to this and I will...

I am also known as a hibernating developer, the colder it gets, the more code I look at and work on..

Have patience and I will get on board with this...
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

@statmonkey

nice script to burn iso's - just used it to burn the latest vsido iso to usb.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

statmonkey

What!? It works? .... just kidding.  Glad you found it useful.

statmonkey

#7
You know if I keep double posting like this I will have to report myself. :)

I have updated the make a thumb script quite a bit.  I wanted to learn how to use an array in a zenity script, I had trouble with this the first time which is why the script makes the user input the first three letters of the drive.  I really wanted the documentation to be such that anyone who picked it up could follow along and see exactly what is going on.  The idea being if there was anyone stumbling in here who wanted an idea of how to do some things in zenity this would serve the purpose but at the same time be a functional script that had some value.  Here's a summary of the updates:
# UPDATES: Adjusted to use an array rather than request user data entry.
#          Added some sanity check so the user can opt out
#          Added a section to clean up after completion.
#          Added a root sanity check
#          Added variable documentation so user can understand what is happening
#          Added progress bar that autocloses
#          Changed script to clean up after itself so it doesn't leave any cruft   


And I am attaching the script for anyone who wants it.  Just put it in your path and make it executable.  As long as you have bash, zenity, an iso you want to burn and a usb/thumb drive it will work.

VastOne

Morning statmonkey

I tried this this morning and wanted to let you know...

VSIDO does not have zenity installed by default, it will now...  :)

I am getting a devnull file created when I run this that shows

ls: cannot access /dev/disk/by-path/*usb*part*: No such file or directory

and a blank list of 'Select items from the list'

Heading out for the day... will see you later on tonight
VSIDO      VSIDO Change Blog    

    I dev VSIDO

statmonkey

#9
Hmm curious.  I just downloaded to a couple of different machines and it ran with no issues.  I now have several thumbs of mrneilypops.dwmX Iso.   :D

Obviously the devnull should be empty, it does nothing but acts as a conduit for the variable.
devs=`ls -al /dev/disk/by-path/*usb*part* 2>\dev\null | awk '{print($11)}'`
all this line of code is doing is passing as a string, the contents of the folder /dev/disk/by-path and filtering on usb and part.  Which is essentially the same command you would run by hand.  There is nothing unique there its just using a variable, ls, awk and print. 

It will fail as a general rule on only two occasions. First if you aren't root it will give you a permission denied. The second is slightly more complicated but if you have no usb drives mounted or the thumb inserted is mounted read-only.  This would explain why the list is empty.

I have been having issues with spacefm (both the daemon and spacefm itself) insisting that any thumb be mounted ro and not allowing the root user to mount it any other way.  Actually have been having quite a few issues with spacefm of late and am now back using thunar. That's another story.  Regardless can you check and see if this is the case. If the thumb is mounted ro then nothing is going to write to it.  If that's the case you'll have to unmount the thumb, kill spacefm and it's daemon if you are running it and mount the thumb rw. I rewrote the options for udevil several times but spacefm keeps overwriting them so I gave up.  It apparently thinks rw 9660 drives are evil. Actually I think this is a consequence of the way systemd is handling the drives and udevil doesn't like that. But that's speculation on my part.

Also in this thread is the original makethumb which we know works (I think Jed and packrat have used it) you could use that as a quick test as well and if it won't run then it is specific to your system. 

Also if anyone else could test this and see if they get the same results it would be a big help.

Note: Have to laugh if my failing script finally gets you on the zenity train :)

VastOne

Well, now I did just wake up... and maybe I do need to read it again, but I missed where it was an absolute need to have a usb mounted...  ::)  :P  :-*

(DOH what a dumb ass I was this morning)

It works perfectly with a usb mounted

Great job!
VSIDO      VSIDO Change Blog    

    I dev VSIDO

jedi

Yes this nice little jewel of a script works great when you plug-in a USB drive first!  Just used it a couple of days ago to burn an ISO.  It even burns "non-VSIDO" ISO's!   :D :D :D
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

statmonkey

#12
VastOne.  Nope, not on you.  I think the documentation was a little unclear.  I made it clearer, I hope, added to the documentation so it should be clearer see attached.

Jedi - I thank you.  I think this version is quite an improvement.  Getting zenity to see and use the array removes the user data entry step of  the drive letters.  This reduces risk of screwing up and I think makes the whole process smoother.

What do you mean?  Are there other iso's besides Vsido you would burn? :)

PackRat

Just used this to burn the latest vsido iso; just confirming that the script works with yad (on slackware) installed. Just had to make a symlink zenity to yad.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

^ Now that is slick thinking... well done PackRat   8)

Where and what was the symlink for those that may inquire?
VSIDO      VSIDO Change Blog    

    I dev VSIDO