summaryrefslogtreecommitdiff
path: root/scripts/publish-macosx.sh
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-05-16 00:33:24 (GMT)
committerMarius Kintel <marius@kintel.net>2013-05-16 00:33:24 (GMT)
commit5f6afe8cbbdd16538b662a0880f7961a9a3aade5 (patch)
tree66d3692f193627de473abd6e7f263480da32fcbd /scripts/publish-macosx.sh
parent2e758fcc82a8a06152f5e89ec9295783b3e889fe (diff)
Update the new javascript with download info
Diffstat (limited to 'scripts/publish-macosx.sh')
-rwxr-xr-xscripts/publish-macosx.sh43
1 files changed, 41 insertions, 2 deletions
diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh
index 3aeeaf9..9d0423d 100755
--- a/scripts/publish-macosx.sh
+++ b/scripts/publish-macosx.sh
@@ -3,6 +3,41 @@
# NB! To build a release build, the VERSION and VERSIONDATE environment variables needs to be set.
# See doc/release-checklist.txt
+human_filesize()
+{
+ awk -v sum=$1 'BEGIN {
+ hum[1024**3]="GB"; hum[1024**2]="MB"; hum[1024]="KB";
+ for (x=1024**3; x>=1024; x/=1024) {
+ if (sum>=x) { printf "%.1f %s\n",sum/x,hum[x]; break }
+ }
+ }'
+}
+
+# Pass version=<version> packagefile=<packagefile> filesize=<bytes>
+update_www_download_links()
+{
+ # Make the passed variables available
+ local $*
+ filesize=$(human_filesize $filesize)
+ webdir=../openscad.github.com
+ incfile=inc/mac_snapshot_links.js
+ BASEURL='https://openscad.google.com/files/'
+ DATECODE=`date +"%Y.%m.%d"`
+
+ if [ -f $webdir/$incfile ]; then
+ cd $webdir
+ echo "snapinfo['MAC_SNAPSHOT_URL'] = '$BASEURL$packagefile'" > $incfile
+ echo "snapinfo['MAC_SNAPSHOT_NAME'] = 'OpenSCAD $version'" >> $incfile
+ echo "snapinfo['MAC_SNAPSHOT_SIZE'] = '$filesize'" >> $incfile
+ echo 'modified mac_snapshot_links.js'
+
+ git --no-pager diff
+ echo "Web page updated. Remember to commit and push openscad.github.com"
+ else
+ echo "Web page not found at $incfile"
+ fi
+}
+
if test -z "$VERSIONDATE"; then
VERSIONDATE=`date "+%Y.%m.%d"`
fi
@@ -40,7 +75,8 @@ else
APPCASTFILE=appcast.xml
fi
echo "Creating appcast $APPCASTFILE..."
-sed -e "s,@VERSION@,$VERSION,g" -e "s,@VERSIONDATE@,$VERSIONDATE,g" -e "s,@DSASIGNATURE@,$SIGNATURE,g" -e "s,@FILESIZE@,$(stat -f "%z" OpenSCAD-$VERSION.dmg),g" $APPCASTFILE.in > $APPCASTFILE
+FILESIZE=$(stat -f "%z" OpenSCAD-$VERSION.dmg)
+sed -e "s,@VERSION@,$VERSION,g" -e "s,@VERSIONDATE@,$VERSIONDATE,g" -e "s,@DSASIGNATURE@,$SIGNATURE,g" -e "s,@FILESIZE@,$FILESIZE,g" $APPCASTFILE.in > $APPCASTFILE
cp $APPCASTFILE ../openscad.github.com
if [[ $VERSION == $VERSIONDATE ]]; then
cp $APPCASTFILE ../openscad.github.com/appcast-snapshots.xml
@@ -50,6 +86,9 @@ echo "Uploading..."
LABELS=OpSys-OSX,Type-Executable
if ! $SNAPSHOT; then LABELS=$LABELS,Featured; fi
`dirname $0`/googlecode_upload.py -s 'Mac OS X Snapshot' -p openscad OpenSCAD-$VERSION.dmg -l $LABELS
+if [[ $? != 0 ]]; then
+ exit 1
+fi
# Update snapshot filename on web page
-`dirname $0`/update-web.sh OpenSCAD-$VERSION.dmg
+update_www_download_links version=$VERSION packagefile=OpenSCAD-$VERSION.dmg filesize=$FILESIZE
contact: Jan Huwald // Impressum