summaryrefslogtreecommitdiff
path: root/scripts/update-web.sh
blob: c611d2880287534ccc6abd3eac3839e73e9548d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

# Works with Mac OS X and Linux cross-compiling for windows using
# mingw-cross-env (use like: OS=LINXWIN update-web.sh file1.zip file2.exe).

file1=$1
if [ -z "$file1" ]; then
  echo "Usage: $0 <file1> [<file2>]"
  exit 1
fi

if [[ $OSTYPE =~ "darwin" ]]; then
  OS=MACOSX
elif [[ $OSTYPE == "linux-gnu" ]]; then
  OS=LINUX
fi

indexfile=../openscad.github.com/index.html
if [ -f $indexfile ]; then
  if [ $OS == MACOSX ]; then
    sed -i .backup -e "s/^\(.*mac-snapshot.*\)\(OpenSCAD-.*\.dmg\)\(.*\)\(OpenSCAD-.*dmg\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile
  elif [ $OS == LINXWIN ]; then
    file2=$2
    sed -i .backup -e "s/^\(.*win-snapshot-zip.*\)\(OpenSCAD-.*\.zip\)\(.*\)\(OpenSCAD-.*zip\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile
    sed -i .backup -e "s/^\(.*win-snapshot-exe.*\)\(OpenSCAD-.*-Installer\.exe\)\(.*\)\(OpenSCAD-.*-Installer.exe\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile
  elif [ $OS == LINUX ]; then
    file2=$2
    sed -i .backup -e "s/^\(.*linux-snapshot-32.*\)\(openscad-.*-32\.tar\.gz\)\(.*\)\(openscad-.*-32\.tar\.gz\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile
    sed -i .backup -e "s/^\(.*linux-snapshot-64.*\)\(openscad-.*-64\.tar\.gz\)\(.*\)\(openscad-.*-64\.tar\.gz\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile
  fi
  echo "Web page updated. Remember to commit and push openscad.github.com"
else
  echo "Web page not found at $indexfile"
fi
contact: Jan Huwald // Impressum