1

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

  • Do you have control over creating the USB (can you give it a well-defined label?) – Fabby Mar 11 '15 at 18:11
  • Yeah that's definitively the solutions i adopted. An sh script will search every 3 seconds for an USB called "XXX" in /media , which is the default directory where USB are auto-mounted in Ubuntu. I will ask to the users to format their USB and call them "XXX" .. thank you however. – Sciakysystem Mar 14 '15 at 12:11
  • 1
    Did you do that before or after I've told you about the label? >:) Otherwise I'll convert that to an answer! ;-) – Fabby Mar 14 '15 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.