Sistema host: Manjaro
Guest: qualsiasi (ho provato Ubuntu, Manjaro, Parrot, Arch, Windows 10)
Non riesco a fare il redirect di un hard disk usb, e le ricerche su google non mi hanno aiutato.
Avete qualche idea?







Codice: Seleziona tutto
#!/bin/bash
if [ $# -ne 2 ] || [ $UID -ne 0 ]
then
echo "Usage: $0 <vmname> <usb_vendor:product>"
echo "Root is required."
exit 1
fi
VM=$1
VEND=$(echo $2 | cut -d : -f 1)
PROD=$(echo $2 | cut -d : -f 2)
USBFILE=$VM-$VEND:$PROD.xml
if [ -e /tmp/virtusb/$USBFILE ]
then
virsh detach-device $VM /tmp/virtusb/$USBFILE
rm /tmp/virtusb/$USBFILE
else
mkdir -m 700 -p /tmp/virtusb > /dev/null
cat << EOF > /tmp/virtusb/$USBFILE
<hostdev mode='subsystem' type='usb'>
<source>
<vendor id='0x$VEND'/>
<product id='0x$PROD'/>
</source>
</hostdev>
EOF
virsh attach-device $VM /tmp/virtusb/$USBFILE
if [ $? -ne 0 ]
then
rm /tmp/virtusb/$USBFILE
fi
fiVisualizzano questa sezione: 0 utenti iscritti e 1 ospite