Skip to content

Commit

Permalink
create dmg for rcouchx
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Apr 22, 2012
1 parent 89c269d commit 28f3a8c
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -44,3 +44,5 @@ deps
ebin
distdir
package/osxbuild
package/packages

7 changes: 6 additions & 1 deletion Makefile
@@ -1,3 +1,4 @@
ARCH= $(shell uname -m)
REPO=rcouch
RCOUCH_TAG= $(shell git describe --tags --always)
REVISION?= $(shell echo $(RCOUCH_TAG) | sed -e 's/^$(REPO)-//')
Expand Down Expand Up @@ -71,14 +72,18 @@ rcouchxbuild: rcouchxclean
@cp -R contrib/rcouchx rcouchx-build
@cp -R rel/rcouch rcouchx-build/
@xcodebuild -project rcouchx-build/rcouchx.xcodeproj
@cp -R rcouchx-build/rcouch rcouchx-build/build/Release/rcouchx.app/Contents/Resources/
@cp -R rcouchx-build/rcouch rcouchx-build/build/Release/rcouchx.app/Contents/Resources/
@cp -R rcouchx-build/build/Release/rcouchx.app .

rcouchxclean:
@rm -rf rcouchx-build
@rm -rf contrib/rcouchx/build
@rm -rf rcouchx.app

rcouchxdmg: dist
$(MAKE) -C package rcouchx


.PHONY: package

export PKG_VERSION REPO REVISION RCOUCH_TAG
Expand Down
3 changes: 3 additions & 0 deletions NOTICE
Expand Up @@ -14,4 +14,7 @@ third parties attributions
under Apache 2 license
2010 (c) Basho Technologies

- packages/osx/makedmg.sh
under BSD license
2011 (c) Coucbase

4 changes: 3 additions & 1 deletion package/Makefile
Expand Up @@ -26,7 +26,7 @@ endif
APP = $(shell echo "$(REPO)" | sed -e 's/_/-/g')
# Assumes CURDIR is .../$(APP)/package/$(APP)/
RCOUCH_PATH ?= ..
RELEASE ?=
RELEASE ?=

$(APP)-$(REVISION).tar.gz: ../$(RCOUCH_TAG).tar.gz
ln -s $< $@
Expand All @@ -42,4 +42,6 @@ pkgcheck:
# The heavy lifting is done by the individual packager Makefiles
package: pkgcheck build

rcouchx: pkgcheck dmg

include $(PKGERDIR)/Makefile
38 changes: 36 additions & 2 deletions package/osx/Makefile
@@ -1,8 +1,11 @@
ARCH = $(shell uname -m)
PKGNAME = $(APP)-$(REVISION)-osx-$(ARCH).tar.gz
DMGNAME = rcouchx-$(REVISION).dmg
ZIPNAME = rcouchx-$(REVISION).zip
DMGFOLDER = packages/$(APP)-$(REVISION)

# simply tar up the rel directory and sha the file
build: buildrel
build: buildrel
@echo "Building package $(PKGNAME)"
mkdir -p packages
cd $(BUILDDIR)/$(APP)-$(REVISION) && \
Expand All @@ -11,12 +14,43 @@ build: buildrel
cd packages && \
for tarfile in `ls *.gz`; do \
shasum -a 256 $${tarfile} > $${tarfile}.sha \
; done
; reldone

dmg: cleanrcouchx buildrcouchx
@echo "Building package $(PKGNAME)"
mkdir -p packages
cd $(BUILDDIR)/$(APP)-$(REVISION) && \
ditto -ck --keepParent "rcouchx.app" ../../packages/$(ZIPNAME)
cp -f osx/README.txt $(BUILDDIR)/$(APP)-$(REVISION)/
cp -f ../LICENSE $(BUILDDIR)/$(APP)-$(REVISION)/LICENSE.txt
cp -f osx/dmg-background.png $(BUILDDIR)/$(APP)-$(REVISION)
cp -f osx/setviewoptions.applescript $(BUILDDIR)/$(APP)-$(REVISION)
cp -f osx/makedmg.sh $(BUILDDIR)/$(APP)-$(REVISION)/
cp -f "../contrib/rcouchx/rcouch.icns" $(BUILDDIR)/$(APP)-$(REVISION)/
(cd $(BUILDDIR)/$(APP)-$(REVISION) && \
./makedmg.sh "$(DMGNAME)" "rcouchx.app" "rcouchx" dmg-background.png rcouch.icns)
cp -f $(BUILDDIR)/$(APP)-$(REVISION)/$(DMGNAME) packages/
ditto -ck --keepParent "packages/$(DMGNAME)" packages/$(ZIPNAME)
cd packages && \
shasum -a 256 $(DMGNAME) > $(DMGNAME).sha
cd packages && \
shasum -a 256 $(ZIPNAME) > $(ZIPNAME).sha


cleanrcouchx:
@rm -rf packages/$(DMGNAME)
@rm -rf packages/$(DMGNAME).sha
@rm -rf packages/$(ZIPNAME)
@rm -rf packages/$(ZIPNAME).sha

# Build the release we need to package
buildrel: $(BUILDDIR)/$(APP)-$(REVISION)
cd $^ && $(MAKE) deps compile rel


buildrcouchx: $(BUILDDIR)/$(APP)-$(REVISION)
cd $^ && $(MAKE) deps rcouchx

$(BUILDDIR)/$(APP)-$(REVISION): $(BUILDDIR) $(APP)-$(REVISION).tar.gz
tar xz -C $(BUILDDIR) -f $(APP)-$(REVISION).tar.gz

Expand Down
15 changes: 15 additions & 0 deletions package/osx/README.txt
@@ -0,0 +1,15 @@
rcouchx Preview

In order to run the appliction please drag and drop the "rcouchx" icon
into the "Applications" folder. You can start the rcouchx application
from within the "/Applications" directory.

Notes:

1- Please do make sure you have erased the previous nstallation from
"~/Library/Application Support/rcouchx"

2- The application will not start if you attempt to run the server without
copying to a writeable disk. The dmg file which contains "rcouchx.app"
is a read-only format and the server needs to be deployed on a writable volume.
3- rcouch console is available here: /Applications/rcouch.app/Resources/rcouch/bin/rcouch
Binary file added package/osx/dmg-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions package/osx/makedmg.sh
@@ -0,0 +1,51 @@
#! /bin/bash

DMG_NAME=$1
SRC_FOLDER=$2
VOLUME_NAME=$3
BACKGROUND_FILE=$4
VOLUME_ICON_FILE=$5
DMG_TEMP_NAME="rw.${DMG_NAME}"
echo DMG_TEMP_NAME = "${DMG_TEMP_NAME}"

ACTUAL_SIZE=`du -sm "$SRC_FOLDER" | sed -e 's/ .*//g'`
DISK_IMAGE_SIZE=$(expr $ACTUAL_SIZE + 20)
hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"

# mount it
echo "Mounting disk image..."
MOUNT_DIR="/Volumes/${VOLUME_NAME}"
echo "Mount directory: $MOUNT_DIR"
echo hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}"
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
echo "Device name: $DEV_NAME"

echo "Copying background file..."
mkdir "$MOUNT_DIR/.background"
cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE"

echo "Copying README.txt"
cp README.txt "$MOUNT_DIR/README.txt"

echo "Running Applescript: /usr/bin/osascript setviewoptions.applescript \"${VOLUME_NAME}\""
"/usr/bin/osascript" setviewoptions.applescript "${VOLUME_NAME}"
echo "Done running the applescript..."
sleep 10

# make sure it's not world writeable
echo "Fixing permissions..."
chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
echo "Done fixing permissions."

echo tell the volume that it has a special file attribute

SetFile -a C "$MOUNT_DIR"

# unmount
echo "Unmounting disk image..."
hdiutil detach "${DEV_NAME}"

# compress image
echo "Compressing disk image..."
hdiutil convert "${DMG_TEMP_NAME}" -format UDZO -imagekey zlib-level=9 -o "${DMG_NAME}"
rm -f "${DMG_TEMP_NAME}"
25 changes: 25 additions & 0 deletions package/osx/setviewoptions.applescript
@@ -0,0 +1,25 @@
on run (volumeName)
tell application "Finder"
tell disk (volumeName as string)
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 430}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set background picture of theViewOptions to file ".background:dmg-background.png"
set icon size of theViewOptions to 72
set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "rcouchx.app" of container window to {100, 200}
set position of item "README.txt" of container window to {250, 200}
set position of item "Applications" of container window to {375, 200}
close
open
update without registering applications
delay 10
end tell
end tell
end run

2 changes: 1 addition & 1 deletion rel/reltool.config
Expand Up @@ -4,7 +4,7 @@
{sys, [
{lib_dirs, ["../deps", "../deps/refuge_spatial/apps",
"../deps/couch_core/apps"]},
{rel, "rcouch", "0.4.2",
{rel, "rcouch", "0.5.2",
[
kernel,
stdlib,
Expand Down

0 comments on commit 28f3a8c

Please sign in to comment.