[Request]Automagically mount USB drives + add rox bookmarks

What features/apps/bugfixes needed in a future Puppy
Message
Author
User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

[Request]Automagically mount USB drives + add rox bookmarks

#1 Post by ecomoney »

I run a netbooted puppy linux cybercafe based on puppy 4.2.1. Its clientel are non-linux initiates (seafarers and sailors to be precise), who use the cybercafe to keep in contact with their families back home. Mostly they use digital cameras/pendrives to store pictures, which they upload and download to/from social networks, and send around as email attachments.

Under linux, they find it very difficult to find their files, and it requires a trained member of staff to supervise them when they are doing this. This is not only time consuming for the staff there, but raises privacy concerns.

What I would work to allay these issues is this...

1. Pendrives, when inserted, should preferably automount (or at least show a dialogue saying "USB storage has been inserted, do you wish to mount and view its contents?).

2. When mounted, I wish to set firefox's default upload, and download, location to the pendrive (mostly /mnt/sda1). This way, clicking on the browse button, or "right-click/save as" will by default download to/upload from the pendrive.

3. Its common policy to "unmount" or "eject" the pendrive before removing it physically. However, with the level of technical knowledge of the clientel, I cannot assume they will always do this. Will I need to automatically "sync" any unperformed writes to the pendrive, so as if this does occur there will be less chance of data corruption.

4. It would be nice, when uploading pictures, for a preview thumbnail of the pictures to appear in the file selection windows when "browse..." is clicked on the webpage. Currently puppies gtk/rox dialogues do not have this feature.

Thanks in advance for any pointers/advice on how this may be achieved.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

4-stroke
Posts: 114
Joined: Fri 07 Aug 2009, 14:15
Location: Sweden

#2 Post by 4-stroke »

1. This works on Puppy 4.3 beta 1. Menu -> System -> Puppy event manager -> icon handler, tick box for auto-launch 'handler' when plugged in.

restart x.

When i insert my usb-stick p-mount opens and if i click mount, rox opens with the contents of the usb-stick.

The rest is beyond my knowledge...

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#3 Post by mikeb »

1.Try what the man said first...I made an auto detecting pmount that refreshed when drives are plugged in and out...would not be a major trauma to have it mount as well.
2..my experience is that firefox remembers where the file browser last was so after once downloaded to sda1 it will go there again...If you are dealing with only one stick at a time then should work ok for you.
3. Trick and no real solution that comes to mind for any OS. I also noticede that when a transfer is finished the drive is still not unmountable for a while....someone mention cache size and kernels somewhere ...perhaps this could be changed so that once a transfer is done it is really done so unlugging mounted is relatively harmless. Otherwise some obvious warning message before disaster rather than after as windows does...a blinking message whilst mounted...something subtle but eye catching. I think manually mounting does give a better awareness that unmounting is required. Definately some human psychology needed.
4.Thumbnails...ummm..yes long standing limitation.Since firefox uses the native browser I'm trying to remember if kde gave this(oh for a memory). Gtk2 can have thumbnails in its file chooser.(xfce4 does it and the gimp as 2 examples)..this would mean altering the firefox sources to call this option up..perhaps ttuuxxx could shed some light on this as it would be very useful.

mike

edit..for file sharing I have it unmount the share when the rox window is closed as it is spawned as a separate instance....only thing is it isn't 100% reliable..not sure why.

MagicZaurus
Posts: 107
Joined: Mon 05 Jan 2009, 17:35

#4 Post by MagicZaurus »

In Firefox you can set the location to which to download. Go to 'Tools' > 'Options' > 'Main' > 'Downloads'. Here you could for example specify /mnt/pendrive. Then when a pendrive is automounted it should link to /mnt/pendrive. As soon as you have a SATA drive in your box, then the pendrive will be sda2 or sda3. So directly to set it to /mnt/sda1 might be not so good.

I'm still using Firefox 3.0, but 3.5 should be same.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#5 Post by mikeb »

Actually on further thought perhaps if pendrives are the only items that need to be handled a custom flash stick only daemon would make more sense. (or do you need cd as well?) For a cybercafe hard drive access is not perticularily desirable.
Or perhaps admin custom choice of what is accessible.
I recently dumped puppy_frontend_d as it's slow and not reliable. A simple script with mut as a backend is much more efficient.

So plug in...automount and rox launched with message of 'close this window before unplugging' sort of idea

mike

User avatar
Ray MK
Posts: 774
Joined: Tue 05 Feb 2008, 09:10
Location: UK

#6 Post by Ray MK »

Hi Rob

Have a really good look at John's TeenPup 2008.

It does most if not all of the things that you often ask for in a Puppy.

Very n00bie friendly and runs very well as a frugal install on an old 6/7 year old acer laptop (233mb ram. 2.5Ghz celeron proc. 512ish swap partition. ext2/ext3)

I've also run it frugal on my othr laptop (96mb ram. 1Ghz celeron proc. 250ish swap partition. ext2)
However it is slow and would obviously run better as a full HD install (with a swap partition) on that type of machine.

On startup it recognises my touchpad automagically - it also does the same with the wired ethernet internet connection.

Click on internet - and it runs - online straight away.
(No save file - running live in ram)

The built-in help and tips are second to none - just try.

Plug in a USB - up pops Pdrive and a folder opens showing your files.

Ok - it is a big download - similar size to Ecopup but when you look at what it comes with you will be astounded.

Well worth a look.

Hope that helps - Very best regards - Ray.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

I wrote a script years ago that did exactly this.
Mounted an inserted USB and unmounted it when it`s removed.
It popped up ROX file window for the USB. and ROX auto closes itself.

The app. is called: "usbauto" or maybe "usb-auto" ( I can`t remember ).
Do a search here for it and with luck you may find it, it may still be here.

It`s been years, I thought Dougal had fixed Puppy to do this sort of thing.
But it seems that stuff goes in and out of Puppy and does not stay ( sad ).

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#8 Post by ecomoney »

@ MZ

If a pendrive is not plugged in (i.e. they dont have one) then I would really like the files to download to a location for which there is a comprehensible location (currently all downloads automatically go to "/root/Downloads", and there is a shortcut off the desktop for this. I really need to change the default download location automatically (or at least make it very easy to pick it using a ROX shortcut). There is a string for this in firefox's setting file ~/.mozilla/firefox/<profile folder>/???? (I cant remember the exact filename). I must test to see if changing this text file will alter it while it is running (hopefiully a firefox restart will not be required).

@ MikeB, this is very useful information, I now at least know the names of the scripts I would need to hack to achieve this. Youve given me a start for my research thank you.

@ Sunburnt
But it seems that stuff goes in and out of Puppy and does not stay
I know I have seen the same thing! Its Barry that has the say of what goes in or stays out, I believe he is simply not aware of all of the new innovations and improvements that take place or the same issues would not keep coming up. I suppose its up to us to keep him informed.

Unfortunately, I cant find your script with either of the two forms you suggest. :cry: It certainly would be very useful to have something already developed and tested. Would you suggest some other places where I might find it?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#9 Post by mikeb »

@ MikeB, this is very useful information, I now at least know the names of the scripts I would need to hack to achieve this. Youve given me a start for my research thank you.
I was going to do this but on balance it was simpler to extend pmount...hope you get to know bash as this will enable you to get what you need ...you are more than capable and no one knows your aims better than you :)

mike

ps were's my skegness postcard??

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#10 Post by sunburnt »

ecomoney; Amazingly I just fired up my old development computer with all that stuff on it.
I found my work directory for auto-usb and I`ll try to find the last working copy for you.
I`ll let you know how I`m doing... Terry

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#11 Post by ecomoney »

@ Sunburnt

Many thanks for taking the time to seek it out. If you would like me to host this, or any of your other work I would be happy to provide you with an ftp account on my server. Its important that valuable code from seasoned puppy developers such as yourself does not get lost.

@ MikeB, Im learning bash and trying to put it together with all my old programming expertise (mostly software archetecture). Changing over from M$ Visual Basic (the last language I programmed in) to Bash is quite a leap of syntax however :roll: Im going to hold off while Sunburnt finds the code, its always better not to re-invent the wheel....(especially when it comes to BASH by gum its hard work!).

I only managed a couple of days away camping in the Peak District and had to come home early through lack of funds, so no one got a postcard!
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#12 Post by mikeb »

.(especially when it comes to BASH by gum its hard work!).
don't know what you mean :D . Quite unique is the polite term. I find every other language I've learnt similar in structure but bash is the beastie..I started by modifying scripts and grabbing bits from other scripts....usually driving the various gui widgets.I'm still learning stuff with the help of online man pages (wikipedia are often very clear and easy to learn from) but each hurdle brings a whole pile of new possibilities.

Sorry yer holiday was cut short but hope you got a good blast of fresh air and sunshine to clear the mind

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#13 Post by sunburnt »

ecomoney; Looked on usb-auto, BIG surprise, it didn`t work...
It seems that the utility that it depended on "dmesg" is no longer used in Puppy.
Were we just talking about this sort of thing or what ???
Rather than try to figure out how to fix that, I rewrote it to work different.

It "seems" to work well. YOU are the final tester ecomoney...
As to #2 through #4 of your wish list, I don`t know how to do them.

I`m posting it in the forum: Cutting Edge / usb-auto
Direct any development talk and bug reports to there.

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#14 Post by ecomoney »

:D Thank you Sunburnt! I asked for it, I will test it (very thoroughly!). I appreciate you going to the time and trouble to re-work the script.

Ive spend the last three hours doing some research, this is what Ive found.

Part 4 - Auto-Bookmarking

Regarding point 2 (Adding Bookmarks automatically), Ive dont a few hours research and found that puppy stores its file location bookmarks in two places

/root/.gtkbookmarks - this is where bookmarks for the file-open dialogs are kept. Its read by the gtk-dialog routings...I believe this to be a set of standard libraries for dialog boxes that applications call to re-use the same code and provide a standard look and feel.

Heres a sample...

Code: Select all

file:///root/spot
file:///root/Startup
Seems fairly explanatory. :)

These correspond to the locations in the left hand pane of the save/open dialogs of most puppy Apps.

/root/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml

This is the location for the bookmarks in ROX (the ones in the drop down bookmarks on the Rox filer window. Its in "XML" format like this

Code: Select all

<?xml version="1.0"?>
<bookmarks>
  <bookmark title="/root">/root</bookmark>
<bookmark title="/root/boot">/root/boot</bookmark>
<bookmark title="/usr">/usr</bookmark></bookmarks>
If the automount script added the location lines to these files (and removed them when unplugged) then this would fix point 2 (I will make a request on your new thread in "Cutting Edge". (I think this would require a "grep"? maybe Im getting ahead of myself :wink: )

Part 2 & 4 - Set Default Download Locations & Filemanager Preview

Apparently this is a gtk function. This thread lead me to this page of gtk documentation. It seems to cover the functions of setting the default download locations and the preview.

I have no idea how these would be used however...as part of the your script Sunburnt?

Part 3 - Coping with unannounced pendrive removal

I havnt found out any info on this, MikeB you say that changing the usb pendrive cache size to zero would mean that all files are written immedietely to the pendrive?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#15 Post by mikeb »

http://www.linux-consulting.com/Amd_AutoFS/autofs.html
any use ?..or is it more for lan booting?

this looks promising for file browsing from the browser
https://addons.mozilla.org/en-US/firefox/addon/3076

ui.allow_platform_file_picke false
in firefox and mozilla and thunderbird switches to its built in file picker...I think this remembers locations.

au'revoir

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

eocmoney; for your requests; # 2 - # 4 lets talk about them here where you made them.
Don`t worry about the one you already posted, but lets deal with it here.
Any bugs or comments about usb-auto itself put on the usb-auto post.
That will keep people from wondering what all the other chatter is.

I don`t know what Rox bookmarks are, I have never used them.
usb-auto pops up Rox for the USB drive, so folks shouldn`t have trouble.

Setting downloads and Firefox`s Save Page path, is a good idea.
When I made GUIs, I always set the dialog`s path in the GUI`s code.
Firefox may have config. files that can be tweaked for this, I don`t know.
If you come up with info about this I can help, I won`t dig into Firefox...
Post for help as I always do, the Users forum usually gets the most replies.

To handle your requests I think I`ll make usb-auto run 2 other scripts.
One script for when a USB is plugged in, and the other for unplugged.
When run the USB device (sda1, sb1, etc.) will be passed to the script.
Then anything that you want to happen can be put in these scripts.
You probably will want only the first USB plugged in to be the path.

I`m watching this thread... So keep me informed about it here.

P.S. Found some coding errors ( big surprise ), I`ll post a fix soon.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#17 Post by sunburnt »

FYI... I posted a bug fix Beta 2 version, it does several USBs now.

I requested dev. help as I don`t have a USB with more than 1 partition on it.
Most Flash drives usually don`t have more than one, but USB HDs do.

Also I put run commands for the 2 files ( plug & unplug ) I spoke of above.
The files are: /usr/sbin/usbauto_mount & /usr/sbin/usbauto_umount
This way all 3 files will be in one place right in a row, nice!

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#18 Post by mikeb »

I requested dev. help as I don`t have a USB with more than 1 partition on it.
I have one stick with 2 partitions....good for testing. I think it's only a problem for some bioses trying to boot from such a setup.

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#19 Post by sunburnt »

mikeb: If you`re willing to try usb-auto out for me I`d appreciate it.
Be sure to get the new Beta 2 version I just uploaded today.
Run it from a Xterm so you can see what the output is.
Let me know if you`re interested, post any comments to the usb-auto thread.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#20 Post by mikeb »

Will do.....was actually trying to volenteer yourself to convert a flash stick :D

now if only the forum will let me get to your thread...

mike

Post Reply