Commit 9a040bbf authored by Robert Ricci's avatar Robert Ricci

Add a simple shell script to fetch code for a profile

parent efc7df1a
#!/bin/sh
BASEURL="https://www.cloudlab.us/profile-source.php"
PROJECT=$1
PROFILE=$2
URL="$BASEURL?project=$PROJECT&profile=$PROFILE"
DIR="code-samples/profile/$PROJECT"
FILE="$DIR/$PROFILE.py"
TMPFILE="$FILE.tmp"
mkdir -p $DIR
wget -q -O $TMPFILE $URL
if [ ! -f $FILE ] ; then
echo "########## $PROJECT/$PROFILE is new!"
mv $TMPFILE $FILE
else
cmp -s $TMPFILE $FILE;
if [ $? -eq 0 ] ; then
echo "********** $PROJECT/$PROFILE is unchanged!"
rm $TMPFILE
else
echo "########## $PROJECT/$PROFILE has changed!"
diff -u $FILE $TMPFILE
mv $TMPFILE $FILE
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment