Author Topic: makethumb - Zenity script for burning images to USB  (Read 5702 times)

statmonkey

  • Posts: 330
    • View Profile
makethumb - Zenity script for burning images to USB
« on: September 26, 2013, 06:56:03 PM »
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

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Vsido Zenity Collection
« Reply #1 on: September 27, 2013, 02:03:19 AM »
^ Yes... I am most interested in this thread and will get to them when I can...

Thanks for sharing statmonkey!
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

Digit

  • Techno Hippie
  • Posts: 295
  • savant (alegedly), polymath (wannabe)
    • View Profile
    • wastedartist.com
Re: Vsido Zenity Collection
« Reply #2 on: September 27, 2013, 07:54:02 AM »
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

  • Posts: 330
    • View Profile
A little method of burning an iso
« Reply #3 on: September 29, 2013, 07:49:43 PM »
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

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Vsido Zenity Collection
« Reply #4 on: September 29, 2013, 07:54:25 PM »
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 Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

PackRat

  • Posts: 1987
    • View Profile
Re: Vsido Zenity Collection
« Reply #5 on: September 30, 2013, 01:49:22 PM »
@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

  • Posts: 330
    • View Profile
Re: Vsido Zenity Collection
« Reply #6 on: September 30, 2013, 06:34:32 PM »
What!? It works? .... just kidding.  Glad you found it useful.

statmonkey

  • Posts: 330
    • View Profile
Re: Vsido Zenity Collection
« Reply #7 on: November 11, 2013, 07:49:16 AM »
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:
Code: [Select]
# 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

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Vsido Zenity Collection
« Reply #8 on: November 11, 2013, 02:14:32 PM »
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

Code: [Select]
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 Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

statmonkey

  • Posts: 330
    • View Profile
Re: Vsido Zenity Collection
« Reply #9 on: November 11, 2013, 05:43:40 PM »
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.
Code: [Select]
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

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Vsido Zenity Collection
« Reply #10 on: November 11, 2013, 11:35:09 PM »
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 Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

jedi

  • DEFCON 1
  • Posts: 1556
  • Not all those who wander are lost.
    • View Profile
    • NixNut.com
Re: Vsido Zenity Collection
« Reply #11 on: November 12, 2013, 04:12:18 AM »
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

  • Posts: 330
    • View Profile
Re: Vsido Zenity Collection
« Reply #12 on: November 12, 2013, 06:07:30 AM »
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

  • Posts: 1987
    • View Profile
Re: Vsido Zenity Collection
« Reply #13 on: November 13, 2013, 02:25:36 AM »
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

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Vsido Zenity Collection
« Reply #14 on: November 13, 2013, 02:30:27 AM »
^ Now that is slick thinking... well done PackRat   8)

Where and what was the symlink for those that may inquire?
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO