Skip to content

Commit 27ef8f9

Browse files
committed
place SS flash script into gnome home dir
1 parent 628ec0d commit 27ef8f9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

sensorgnome/flash-ss.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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

sensorgnome/gen-package.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ DEST=$DESTDIR/etc/sensorgnome
88
install -d $DEST
99
TZ=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
1216
cp -r DEBIAN $DESTDIR
1317
# get version of sg-control package 'cause it's not in this repo

0 commit comments

Comments
 (0)