Skip to content

Instantly share code, notes, and snippets.

@aaronsnoswell
Last active April 9, 2018 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronsnoswell/12f91060604d469df15ad6ad54e157fd to your computer and use it in GitHub Desktop.
Save aaronsnoswell/12f91060604d469df15ad6ad54e157fd to your computer and use it in GitHub Desktop.
Bash script to download packages locally, then install them on a Kinova MOVO robot
#!/bin/bash
# Acts as a proxy for apt-get - downloads packages on the local (devlopment)
# machine, then copies them to movo1 and movo2 and installs them
# It is suggested you run this in a temporary folder, as it downloads packages
# to the current working directory
# Caveat: Your movo-dev machine must be running the same ubuntu version and
# architecture as the movo machines (14.x, x86_64), otherwise it won't grab the
# correct packages
# Iterate over given packages
for PACKAGE in "$@"
do
echo "$PACKAGE: Checking for dependancies..."
DEPS=$(sudo apt-get install --print-uris -qq $PACKAGE | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/\1/p")
while read -r DEP; do
wget -c $DEP
done <<< "$DEPS"
done
echo "Pushing all .debs to movo1:/home/movo/tmp"
rsync -avP ./*.deb movo@movo1:/home/movo/tmp
echo "Installing all .debs at movo1:/home/movo/tmp"
ssh movo@movo1 "sudo dpkg -i /home/movo/tmp/*.deb"
echo "Cleaning all .debs from movo1:/home/movo/tmp"
ssh movo@movo1 "rm /home/movo/tmp/*.deb"
echo "Pushing all .debs to movo2:/home/movo/tmp"
rsync -avP ./*.deb movo@movo2:/home/movo/tmp
echo "Installing all .debs at movo2:/home/movo/tmp"
ssh movo@movo2 "sudo dpkg -i /home/movo/tmp/*.deb"
echo "Cleaning all .debs from movo2:/home/movo/tmp"
ssh movo@movo2 "rm /home/movo/tmp/*.deb"
echo "Cleaning up current directory"
rm ./*.deb
# To remove installed packages:
# sudo apt-get --purge -y remove nethack-common nethack-console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment