Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@koter84
Last active September 20, 2017 21:41
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 koter84/8de23a43af41a89f101d5d4638623ce8 to your computer and use it in GitHub Desktop.
Save koter84/8de23a43af41a89f101d5d4638623ce8 to your computer and use it in GitHub Desktop.
update eagle pcb designer
#!/bin/bash
# get current dir
prog_dir="/opt/$(ls /opt/ | grep eagle | grep -v tar)"
echo "DIR: $prog_dir"
prog_dir_version=$(echo $prog_dir | awk -F- '{ print $2 }')
echo "DIR Version: $prog_dir_version"
# get current url
prog_url=$(curl --head -s https://www.autodesk.com/eagle-download-lin | grep Location | awk '{ print $2 }' | sed s/"\r"/""/ | sed s/"\n"/""/)
echo "URL: $prog_url"
prog_url_version=$(echo $prog_url | awk -F/ '{print $(NF)}' | awk -F_ '{ print $3 }')
echo "URL Version: $prog_url_version"
# check that a current version is found
if [ "$prog_dir_version" == "" ]
then
echo "New Installation! (no old version found)"
new_install="1"
fi
# check that a new version and url are found
if [ "$prog_url" == "" ] || [ "$prog_url_version" == "" ]
then
echo "couldn't find url for new version"
exit
fi
# check current dir version with current url version
if [ "$prog_dir_version" != "$prog_url_version" ]
then
if [ "$new_install" != "1" ]
then
echo "New Version Found!"
fi
cd /opt/
# download
wget --quiet --show-progress -O eagle.tar.gz $prog_url
# unpack zip
tar -zxf eagle.tar.gz
# remove download
rm eagle.tar.gz
# remove old version
if [ "$new_install" != "1" ]
then
rm -r ./eagle-$prog_dir_version
fi
wget -O ./eagle-$prog_url_version/lbr/Arduino-clone.lbr https://raw.githubusercontent.com/cyberlink1/Arduino-Eagle-Cad-Library/master/Arduino-clone.lbr
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment