i am creating a simple updater for a program which will be ran on an Odroid C1 with Ubuntu 14.04 Server..
Preamble
1) i want the updater.run downloaded from my server and placed into an USB; then the user will have just to plug the USB in , and a bash script will have to do the rest 2) the user will have no access to the device, neither UI or ssh or whichever else
Question
How can i copy the updater.run from a plugged (and mounted) USB to the Odroid?
I read so much infos about udev rules, but udev rules need to have the USB vendor/model already known.. my problem is that i have no idea of which USB will be plugged in by the user.. so i need a "general" script to search into a generic USB for the updater.run and copy it to the Odroid..
One more consideration
The Odroid will have just one USB plugged/mounted per time because im going to disable all USB ports but one.. considering this, i wrote a bash script which gives me which /dev/sd* is the current plugged USB
#!/bin/bash
usb=$(lsscsi -t | grep usb) #output: [15:0:0:0] disk usb: 2-1.3:1.0 /dev/sdb
sd=${usb#*/dev/} # catch the output above and keep just "sdb"
dev="/dev/"
full=$dev$sd # append "/dev/" to "sdb"
echo "$full" # the result is now "/dev/sdb"
read -p "Wait the user to close the terminal" mainmenuinput -n 1
Well.. knowing only that i have an USB with a partition /dev/sdb mounted in media (i dont know yet which is the device name, otherwise i could just cd to /media/user/usb-name), how can i get his name and/or search and copy the updater.run ?
thanks
EDIT
What a tard.. i've just found this: Running a Script on connecting USB device
basically (now is so obvious) i just need to put **** into vendor and model in udev rules, and the script will run for all USB keys..
But i still have the problem of get the USB name and copy the updater.run into the Odroid