File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+ # Flash a SensorStation (Compute Module) attached via USB
3+
4+ if [[ -z $1 ]]; then echo " usage: $0 <url>" ; exit 1; fi
5+
6+ url=$1
7+ zip=$( basename $1 )
8+ img=$( basename $1 zip) img
9+ cd /data
10+ if ! [[ -f $zip ]]; then
11+ echo Downloading $url
12+ wget -nv -O $zip $url
13+ fi
14+ echo Unmounting
15+ umount /run/media/$USER /* 2> /dev/null || true
16+
17+ if ! [[ -f /usr/bin/rpiboot ]]; then
18+ echo " rpiboot not found, installing"
19+ sudo apt-get update
20+ sudo apt-get install -y rpiboot
21+ fi
22+
23+ dev=$( lsblk -d -o NAME,VENDOR,SIZE | grep -E ' RPi-MSD.*[2356][0-9]\.[0-9]G' | cut -d" " -f1)
24+ if [[ -z $dev ]]; then
25+ echo " No device found, running rpiboot"
26+ sudo rpiboot
27+ sleep 5
28+ dev=$( lsblk -d -o NAME,VENDOR,SIZE | grep -E ' RPi-MSD.*[2356][0-9]\.[0-9]G' | cut -d" " -f1)
29+ if [[ -z $dev ]]; then echo " No device found." ; exit 1; fi
30+ fi
31+ dev=/dev/$dev
32+
33+ echo " Flashing $dev : $( lsblk -dn -o VENDOR,MODEL,SIZE $dev ) "
34+ echo " Takes 15-20 minutes!"
35+ sleep 5
36+ 7z e -so $zip $img | sudo dd of=$dev bs=10M
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ DEST=$DESTDIR/etc/sensorgnome
88install -d $DEST
99TZ=PST8PDT date +' SG %Y-%j' > $DEST /version
1010
11+ # Place SS flash file into gnome home dir
12+ install -d $DESTDIR /home/gnome
13+ install -m 755 flash-ss.sh $DESTDIR /home/gnome
14+
1115# Figure out exact versions of sensorgnome dependencies
1216cp -r DEBIAN $DESTDIR
1317# get version of sg-control package 'cause it's not in this repo
You can’t perform that action at this time.
0 commit comments