View Single Post
  #12   Spotlight this post!  
Unread 17-02-2011, 21:42
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 803
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Universal C++ Project - C++ programming for Linux, and more

I found myself in need of the latest version of WPILib, and didn't want to go through the process of installing the update. So, I came up with a workaround. Here's some shell code that will get the latest version of WPILib. I present it here in the hopes that you will find it useful.

Code:
#!/bin/bash

wget -q http://firstforge.wpi.edu/sf/frs/do/viewSummary/projects.wpilib/frs -O - | grep 'WPILib C++ update' | sed "s/.*<a href=\"\([^\"]*\)\">.*/http:\/\/firstforge.wpi.edu\1/" | uniq | sed "s/;.*//" > wpilib_page1.url
wget `cat wpilib_page1.url` -q -O - | grep "rel[0-9][0-9]*" | grep href | sed "s/.*\(rel[0-9]*\)/\1/" | sort -r | head -n 1 | sed "s/.*<a href=\"\([^\"]*\).*/http:\/\/firstforge.wpi.edu\1/" | sed "s/;.*//" > wpilib_page2.url
wget `cat wpilib_page2.url` -q -O - | grep "\.exe\s*<\/a>" | sed "s/.*<a href=\"\([^\"]*\)\".*/http:\/\/firstforge.wpi.edu\1/" | sed "s/;.*//" > wpilib_page3.url
wget `cat wpilib_page3.url` -q -O wpilibupdate.exe

mkdir wpilibinstaller

cd wpilibinstaller
unzip ../wpilibupdate.exe | tee unziplog.txt

cat unziplog.txt | grep "inflating: WPILib/.*\.zip" | sed "s/.*\(WPILib\/.*\.zip\).*/\1/" | xargs -I '{}' cp '{}' ../
cat unziplog.txt | grep "inflating: WPILib/.*\.zip" | sed "s/.*WPILib\/\(.*\.zip\).*/\1/" | xargs -I '{}' ln -s '{}' ../WPILib.zip

cd ../
rm -r wpilibinstaller

rm -f wpilib_page1.url wpilib_page2.url wpilib_page3.url