|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
automount penne usb con udev+hotplug
Il problema è il seguente: vorrei riuscire a fare in modo che, appena si inserisce una penna usb (o dispositivi simili) essa venga montata in una cartella creata sul momento, con nome "model - vendor" della periferica in questione. Cercando su google non sono riuscito a trovare niente (che usasse udev + hotplug), ma in compenso ho capito qualcosa:[list=1][*]Aggiungere in /etc/hotplug/usb/ uno script chiamato come il moduel che si occupa del device (dovrebbe essere usb-storage)[*]Lo script deve (credo) agire in base alle variabili ACTION (add o remove) e DEVPATH (che dovrebbe essere il device che è stato montato)[*]model e vendor si trovano tramite /sys o /proc/bus/usb/device[/list=1]Nessuno sa come fare ? (o lo ha già fatto)
ps. la mia distro è una gentoo con kernel 2.6.9-gentoo-r4
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
SE prendi il numero 15 d Linux Pratico c'e' un articolo esattamente su questo....
D contro t posso dire ke io l'ho provato e nn mi ha funzionato nel senso ke andava a metà (caricava tutto ma dentro /mnt/pendrive nn vedevo i miei files)...
__________________
Powered by Apple Macbook Pro Retina |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
è ancora in edicola?
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Iscritto dal: Apr 2003
Città: Rimini
Messaggi: 3970
|
Quote:
Al massimo, se nn lo trovo, fai 1 fischio ^_^
__________________
Powered by Apple Macbook Pro Retina |
|
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
è già uscito il 18; dubito che qualcuno che conosco lo abbia comprato se mi fai il favore di postare un sunto dell'articolo ti ringrazio ( e magari lo metto a posto per farlo andare bene del tutto
![]()
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#6 |
Senior Member
Iscritto dal: Oct 1999
Città: Tra Como e Varese
Messaggi: 2798
|
prova con questo, ma devi sostituire 000/000/000 con quello che leggi nel file tmp/usb-storage-vars
la riga di mount del dispositivo usb deve essere presente nel file fstab con l'opzione sync. A me nn funziona benissimo però almeno fa il mount in automatico. Prova tu, magari riesci a sistemarlo #!/bin/bash set > /tmp/usb-storage-vars case "$ACTION" in add) case "$PRODUCT" in 000/000/000) [ -e /dev/usbmp3 ] && rm /dev/usbmp3 mknod /dev/usbmp3 b 8 1 chmod 660 /dev/usbmp3 mkdir /mnt/usbmp3 sleep 2 mount /dev/usbmp3 echo "#!/bin/bash" > $REMOVER echo "umount /dev/usbmp3" >> $REMOVER echo "rm /dev/usbmp3" >> $REMOVER echo "rmdir /mnt/usbmp3" >> $REMOVER chmod 775 $REMOVER ;; esac ;; esac
__________________
https://www.duckintour.it |
![]() |
![]() |
![]() |
#7 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Da quel che ho letto finora, non si deve tentare di creare il dev nello script ma usare quello che creano udev+hotplug (che dovrebbe essere in $DEVPATH). Avrei anche qualche problema nel prendere il nome del modello e del venditore, ma facendo il giusto "cat /purc/bus/usb/devices | grep " dovrei prendere entrambi, o almeno spero
![]()
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#8 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Allora, ho rimediato qualcosa (ovviamente nnon è ancora funzionante, ma ho appena scritto qualcosa.....) ma mi sono trovato un problema che non so esattamente come aggirare: il sistema hotplug mi passa in DEVPATH la cartella in cui si trovano le informazioni (del tipo /sys/bus/usb/devices/1-1:2.0/) se è un dispositivo di massa, si trova la dir host + un numero (penso) da 1 a 9, dentro ad essa una cartella n:0:0:0, poi block e dentro i vari sda1, sda2 eccetera (alla fine la stringa è /sys/bus/usb/devices/1-1:2.0/host1/1:0:0:0/block/sda1/) da cui estrarre il dev sda1. Non c'è un modo più semplice per montare un dev sapendo solo fino a /sys/bus/usb/devices/1-1:2.0/ (perchè penso sarebbe uno spreco cercare tutti gli host*) ?
edit: mory scusa ma non me ne ero accorto, io volevo fare che montasse automaticamente le penne usb anche non presenti in fstab
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. Ultima modifica di SilverXXX : 15-12-2004 alle 16:41. |
![]() |
![]() |
![]() |
#9 | |
Senior Member
Iscritto dal: Oct 1999
Città: Tra Como e Varese
Messaggi: 2798
|
Quote:
![]() mount -t auto -o sync /dev/.... ecc. dovrebbe andare senza riga nel fstab
__________________
https://www.duckintour.it |
|
![]() |
![]() |
![]() |
#10 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Purtroppo è più complesso di quel che credevo; cmq posto una versione incompleta (e già abbastanza incasinata) tanto per darvi un'idea.
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Iscritto dal: Oct 1999
Città: Tra Como e Varese
Messaggi: 2798
|
Quote:
__________________
https://www.duckintour.it |
|
![]() |
![]() |
![]() |
#12 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Nello script lo ho aggiunto; cmq sto pensando anche alla possibilità di controllare anche fstab, per monare i device se è presente una riga che li punti (ma dopo dovrò anche risolvere i symlink)
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#13 | |
Senior Member
Iscritto dal: Oct 1999
Città: Tra Como e Varese
Messaggi: 2798
|
Quote:
![]()
__________________
https://www.duckintour.it |
|
![]() |
![]() |
![]() |
#14 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Non fosse che con le penne usb che non avevo settato in fstab non andava, si, direi di si, cmq io uso kde
![]() ![]()
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#15 |
Member
Iscritto dal: May 2002
Messaggi: 35
|
Scusate, mi inserisco visto che si parla di automount. Io riesco a montare una partizione Dati che o messo in mnt, ma non ho i permessi per scriverci da utente.
In fstab ho modificato da root la riga aggiungendo umask=022 ma non combia nulla.... Grazie per l'aiuto! |
![]() |
![]() |
![]() |
#16 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Che fs usi? se ne usi uno unix, basta impostare i permessi della cartella su cui vuoi scrivere da root. Se usi un fs win mi sembra che umask=000 sia meglio (da tutti i permessi, per stare sul sicuro)
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#17 |
Member
Iscritto dal: May 2002
Messaggi: 35
|
Fat32. Ci provo e ti dico....
Ma ci devo mettere anche defaults,umask=000? Ultima modifica di Antipop : 16-12-2004 alle 08:18. |
![]() |
![]() |
![]() |
#18 |
Member
Iscritto dal: May 2002
Messaggi: 35
|
Non funzia!
Io che ho fatto: ho nella cartella mnt una cartella dati su cui non ho il permesso giusto? Per far ciò ho aggiunto una riga al file. L'aggiunta di umask=000 deve essere fatta su quella riga? |
![]() |
![]() |
![]() |
#19 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Premetto che di solito io uso l'opzione users, così lo posso montare tranquillamente da utente, ma mi pare defaults non ci debba andare in fstab
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
#20 |
Senior Member
Iscritto dal: Jan 2004
Città: Gatteo
Messaggi: 2955
|
Allora, ho trovato qualcosa per lo script, che semplifica molto il tutto, ma richiede udev come device manager (niente dev statici o devfs); in pratica udev dopo aver creato i device richiama uno script passando il device come variabile DEVNAME. Adesso dovrei implementare il tutto abbastanza in fretta.
__________________
And so at last the beast fell and the unbelievers rejoiced. But all was not lost, for from the ash rose a great bird. The bird gazed down upon the unbelievers and cast fire and thunder upon them. For the beast had been reborn with its strength renewed, and the followers of Mammon cowered in horror. |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 12:23.