# I usually put this in my rc5.d directory, as it'll it in a ctrl-c trap until you
# either manually sync the drive and reboot, or enter the right USB key. 
# Very makeshift. Based on Maker of USB device, VendorID, ProductID and that's it.
#!/usr/bin/perl
sub startcheck {
print "\nEnter Valid USB Key and Press Enter...\n";
$continue = <STDIN>;
checkit();
}
sub checkit {
print "Checking MID...";
$usbmanuf = `cat /proc/bus/usb/devices | grep Manuf | awk '{print \$2}'`;
sleep 2;
print " >> $usbmanuf\n";
if ( $usbmanuf =~ "Authenex" ) {
print "MID Check Passed. Authenex.\n\n";
$contboot = $contboot + 1;
} else {
print "MID Check Failed.\n";
}
print "Checking VID...";
$usbvid = `cat /proc/bus/usb/devices | grep Vendor | tail -1 | awk '{print \$2}'`;
sleep 2;
print ">> $usbvid\n";
if ( $usbvid =~ "07a6" ) {
print "VID Check Passed. 07a6.\n\n";
$contboot = $contboot + 1;
} else {
print "VID Check Failed.\n"
}
print "Checking ProdID...";
$usbprodid = `cat /proc/bus/usb/devices | grep ProdID | tail -1 | awk '{print \$3}'`;
sleep 2;
print " >> $usbprodid\n";
if ( $usbprodid =~ "1580" ) {
print "ProdID Check Passed. 1580.\n\n";
$contboot = $contboot + 1;
checkboot();
} else {
print "ProdID Check Failed.\n";
startcheck();
}
}
sub checkboot {
if ( $contboot =~ "3" ) {
print "User Validated, Access Granted. Thank You.\n\n";
} else {
print "Please Enter a Valid USB Key and Press Enter...";
startcheck();
}
}
startcheck();
