]> Pileus Git - ~andy/csm213a-hw/blob - hw2/install.sh
Make control script more configurable
[~andy/csm213a-hw] / hw2 / install.sh
1 #!/bin/bash
2
3 function install
4 {
5         bin=$1
6         dev=$2
7         mnt=$3
8
9         if [ -b "$dev" ]; then
10                 echo "Installing: $bin -> $mnt"
11                 mount "$mnt"
12                 cp "$bin" "$mnt"
13                 umount "$mnt"
14         else
15                 echo Error: No USB found
16         fi
17 }
18
19 if [ -z "$1" ] || [ "$1" = "-h" ]; then
20         echo "usage: install.sh image.bin"
21         exit 0
22 fi
23
24 if [ "$2" ]; then
25         install "$1" "$2" "$3"  &
26 else
27         install "$1" /dev/sdb1 /mnt/mbed1 &
28         install "$1" /dev/sdc1 /mnt/mbed2 &
29 fi
30
31 wait