Skip to content

Commit

Permalink
In postUpdate, check for internet connection.
Browse files Browse the repository at this point in the history
If no connection, assume update is via USB drive, check in /tmp
directory for external software files.
SOFT-604 SOFT-607
  • Loading branch information
Jake Danczyk committed Mar 10, 2021
1 parent f74e583 commit 9bfa55a
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions postUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,32 @@ fi
./ensureTmpRemotesAdded.sh
./ensurePublicKeysAdded.sh

# Update /opt/scripts/boot to commit b61125c1485bee929340cacc06c85c6fcfd678bc
# This commit changes the ethernet-over-usb protocol used with macOS from ECM
# to NCM, because with v11 macOS no longer supports ECM
cd /opt/scripts/boot
sudo git fetch origin
sudo git checkout b61125c1485bee929340cacc06c85c6fcfd678bc

if ! dpkg -l | grep bb-usb-gadgets; then
sudo apt update
sudo apt install bb-usb-gadgets
# Check for internet connection.
if ping -q -c 1 -W 1 github.com >/dev/null; then
# Update /opt/scripts/boot to commit b61125c1485bee929340cacc06c85c6fcfd678bc
# This commit changes the ethernet-over-usb protocol used with macOS from ECM
# to NCM, because with v11 macOS no longer supports ECM
cd /opt/scripts/boot
sudo git fetch origin
sudo git checkout b61125c1485bee929340cacc06c85c6fcfd678bc

if ! dpkg -l | grep bb-usb-gadgets; then
sudo apt update
sudo apt install bb-usb-gadgets
fi
else #If no connection, assume update is occuring over USB
if [ -d /tmp/boot-scripts/ ]; then
cd /opt/scripts/boot
git remote add tmp /tmp/boot-scripts
sudo git fetch tmp
sudo git checkout b61125c1485bee929340cacc06c85c6fcfd678bc
fi
if [ -d /tmp/ ] && ! dpkg -l | grep bb-usb-gadgets; then
sudo dpkg -i /tmp/debs/bb-usb-gadgets_1.20200504.0-0~stretch+20200504_all.deb
fi
fi


# Prevent shared memory from being cleaned up when pocketnc user closes SSH
sudo sed -i 's/^#RemoveIPC=yes/RemoveIPC=no/' /etc/systemd/logind.conf
# Remove line which is incorrectly setting usb0 as default gateway from /etc/network/interfaces
Expand Down

0 comments on commit 9bfa55a

Please sign in to comment.