Permalink
Browse files

create dmg for rcouchx

  • Loading branch information...
1 parent 89c269d commit 28f3a8ca5adac3842e0542b8b8635fdc815ccc41 @benoitc benoitc committed Apr 22, 2012
View
@@ -44,3 +44,5 @@ deps
ebin
distdir
package/osxbuild
+package/packages
+
View
@@ -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)-//')
@@ -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
View
@@ -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
View
@@ -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 $< $@
@@ -42,4 +42,6 @@ pkgcheck:
# The heavy lifting is done by the individual packager Makefiles
package: pkgcheck build
+rcouchx: pkgcheck dmg
+
include $(PKGERDIR)/Makefile
View
@@ -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) && \
@@ -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
@@ -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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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}"
@@ -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
+
View
@@ -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,

0 comments on commit 28f3a8c

Please sign in to comment.