1#!/bin/bash 2 3# Works with Mac OS X and Linux cross-compiling for windows using 4# mingw-cross-env (use like: OS=LINXWIN update-web.sh file1.zip file2.exe). 5 6file1=$1 7if [ -z "$file1" ]; then 8 echo "Usage: $0 <file1> [<file2>]" 9 exit 1 10fi 11 12if [[ $OSTYPE =~ "darwin" ]]; then 13 OS=MACOSX 14elif [[ $OSTYPE == "linux-gnu" ]]; then 15 OS=LINUX 16fi 17 18indexfile=../openscad.github.com/index.html 19if [ -f $indexfile ]; then 20 if [ $OS == MACOSX ]; then 21 sed -i .backup -e "s/^\(.*mac-snapshot.*\)\(OpenSCAD-.*\.dmg\)\(.*\)\(OpenSCAD-.*dmg\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile 22 elif [ $OS == LINXWIN ]; then 23 file2=$2 24 sed -i .backup -e "s/^\(.*win-snapshot-zip.*\)\(OpenSCAD-.*\.zip\)\(.*\)\(OpenSCAD-.*zip\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile 25 sed -i .backup -e "s/^\(.*win-snapshot-exe.*\)\(OpenSCAD-.*-Installer\.exe\)\(.*\)\(OpenSCAD-.*-Installer.exe\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile 26 elif [ $OS == LINUX ]; then 27 file2=$2 28 sed -i .backup -e "s/^\(.*linux-snapshot-32.*\)\(openscad-.*-32\.tar\.gz\)\(.*\)\(openscad-.*-32\.tar\.gz\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile 29 sed -i .backup -e "s/^\(.*linux-snapshot-64.*\)\(openscad-.*-64\.tar\.gz\)\(.*\)\(openscad-.*-64\.tar\.gz\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile 30 fi 31 echo "Web page updated. Remember to commit and push openscad.github.com" 32else 33 echo "Web page not found at $indexfile" 34fi 35