Created
January 4, 2018 09:43
-
-
Save mithro/f8c9010deeda5d6001de881403c5c835 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "`whoami`" = "root" ] | |
then | |
echo "Running the script as root is not permitted" | |
exit 1 | |
fi | |
CALLED=$_ | |
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && SOURCED=1 || SOURCED=0 | |
SCRIPT_SRC=$(realpath ${BASH_SOURCE[0]}) | |
SCRIPT_DIR=$(dirname $SCRIPT_SRC) | |
TOP_DIR=$(realpath $SCRIPT_DIR/..) | |
if [ $SOURCED = 1 ]; then | |
echo "You must run this script, rather then try to source it." | |
echo "$SCRIPT_SRC" | |
return | |
fi | |
if [ -z "$PLATFORM" ]; then | |
echo "You must set the platform you want to get firmware for." | |
echo "examples:" | |
echo "PLATFORM=opsis $0" | |
echo "PLATFORM=atlys $0" | |
exit 1 | |
fi | |
if command -v svn >/dev/null ; then | |
: | |
else | |
echo "Downloading needs the svn tool." | |
echo | |
echo "On Debian/Ubuntu try 'sudo apt-get install subversion'." | |
echo | |
exit 1 | |
fi | |
: ${GITHUB_USER:=timvideos} | |
: ${GITHUB_REPO:=HDMI2USB-firmware-prebuilt} | |
set -e | |
echo "" | |
echo " Repository: $GITHUB_USER/$GITHUB_REPO" | |
echo " Platform: $PLATFORM" | |
GITHUB_URL="https://github.com/$GITHUB_USER/$GITHUB_REPO" | |
GITSVN_TRACK_URL="$GITHUB_URL/trunk/$PLATFORM/firmware" | |
TARGET_DIR="$PWD/firmware/$PLATFORM" | |
echo "" | |
echo " Checking out" | |
echo " from '$GITSVN_TRACK_URL'" | |
echo " to '$TARGET_DIR'" | |
echo "---------------------------------------" | |
mkdir -p $TARGET_DIR | |
# archive/master/v0.0.3-696-g2f815c1/minispartan6/base/lm32 | |
svn checkout --force $GITSVN_TRACK_URL $TARGET_DIR | |
export VER_FILTER='sed -es-^.*/master/-- -es-/.*$--' | |
( | |
cd firmware/$PLATFORM/ | |
svn revert -R . | |
OLD_LINK=$(readlink testing) | |
cp -a unstable testing | |
NEW_LINK=$(readlink testing) | |
echo "---------------------------------------" | |
echo "" | |
echo "Testing firmware for $PLATFORM changed from:" | |
echo " $(echo $OLD_LINK | $VER_FILTER)" | |
echo "to" | |
echo " $(echo $NEW_LINK | $VER_FILTER)" | |
svn status | |
svn commit -m "Updating testing to $(echo $NEW_LINK | $VER_FILTER)" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment