Le 20/10/2016 à 11:08, Carlos E. R. a écrit :
On 2016-10-20 09:14, jdd wrote:
I noticed imagewriter knows if a plugged device is usb pen or not
is there a way to do the same in a script? May be detect if the pen is an iso image before acting?
Telcontar:~ # lsblk lsblk --output NAME,LABEL,MODEL,SERIAL,ROTA,TYPE,TRAN,REV,VENDOR /dev/sde lsblk: lsblk: not a block device NAME LABEL MODEL SERIAL ROTA TYPE TRAN REV VENDOR sde STORE N GO 1 disk usb 1.0 Verbatim └─sde1 STORE N GO 1 part Telcontar:~ #
:-)
I don't know if that is what imagewriter writer uses, but it is a start. You can also detect if the device is mounted, and baulk if it is. Or mount and check contents. List on the screen and ask the user to accept.
I tried (since my mail) several solutions, none works as expected. the solution above detects also my 5 Tb disk I don't want to format :-)) I can detect the openSUSE branded USB pen by id ls /dev/disk/by-id/ | grep Flash_D seems to detect any of them, whatever is written on it #ls /dev/disk/by-id/ | grep Flash_D usb-General_USB_Flash_Disk_0531110000000324-0:0 usb-General_USB_Flash_Disk_0531110000000324-0:0-part1 the best one I found now is blkid -c /dev/null | grep iso9660 that seems to detect iso images. I will probably also detect iso DVD, but these ones can't be erased :-) to be continued :-) thanks jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org