-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRUNME.Xcode-OSX
executable file
·177 lines (143 loc) · 4.56 KB
/
RUNME.Xcode-OSX
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/sh
#
# Copyright (C) 2011-2020 Neil McGill
#
# This game is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This game is distributed in the hope that it will be fun,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this game; if not, write to the Free
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. scripts/common.sh
cat <<%%
.d8888b. 888 d8b 888
d88P Y88b 888 Y8P 888
888 888 888 888
888 .d88b. 888d888 888 888 88888b. 888 888 .d8888b 88888b.
888 88888 d88""88b 888P" 888 888 888 "88b 888 888 d88P" 888 "88b
888 888 888 888 888 888 888 888 888 888 888 888 888 888
Y88b d88P Y88..88P 888 Y88b 888 888 888 888 888 Y88b. 888 888
"Y8888P88 "Y88P" 888 "Y88888 888 888 888 888 "Y8888P 888 888
888
Y8b d88P
"Y88P"
%%
NAME="gorynlich"
APP="gorynlichOSX.app"
DMG="gorynlichOSX.dmg"
SCHEME="gorynlichOSX"
DMG_TMP=".gorynlichOSX.dmg"
APP_DIR="/Users/$LOGNAME/Library/"
log_info "Cleaning"
xcodebuild -project xcode/gorynlich/$NAME.xcodeproj -scheme $SCHEME clean
if [ $? -ne 0 ]
then
log_die "Clean failed"
fi
LOG=.xcode-log
log_info "Compiling"
xcodebuild -project xcode/gorynlich/$NAME.xcodeproj -scheme $SCHEME build > $LOG
ERR=$?
cat $LOG
cat $LOG | egrep "warning:|error:"
echo Logfile: $LOG
if [ $ERR -ne 0 ]
then
log_die "Build failed"
fi
/bin/rm -f $DMG
XCODE_APP=`find $APP_DIR 2>/dev/null | grep "$APP$" | grep -v Archive | tail -1`
log_info "App dir: $XCODE_APP"
if [ ! -d "$XCODE_APP" ]
then
log_err "Did not find $APP dir in $APP_DIR"
exit 1
fi
#
# Create the DMG
#
log_info "Package $APP"
/bin/rm -f $DMG_TMP
log "hdiutil create -srcfolder "$XCODE_APP" -volname "$NAME" -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW -size 500m $DMG_TMP"
hdiutil create -srcfolder "$XCODE_APP" -volname "$NAME" -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW -size 500m $DMG_TMP
if [ $? -ne 0 ]
then
log_err "Failed to create $DMG_TMP"
exit 1
fi
#
# Mount the DMG
#
log_info "Mounting $DMG_TMP"
log "hdiutil attach -readwrite -noverify -noautoopen $DMG_TMP > .tmp 2>&1"
hdiutil attach -readwrite -noverify -noautoopen $DMG_TMP > .tmp 2>&1
if [ $? -ne 0 ]
then
cat .tmp
log_err "Failed to mount $DMG_TMP"
exit 1
fi
DEVICE=`cat .tmp | egrep '^/dev/' | sed 1q | awk '{print $1}'`
log_info "Mounted $DMG_TMP as $DEVICE"
ls /Volumes/$NAME
if [ $? -ne 0 ]
then
log_err "Did /Volumes/$NAME mount ?"
exit 1
fi
echo '
tell application "Finder"
tell disk "'$NAME'"
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 icon size of theViewOptions to 100
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'${APP}'" of container window to {100, 100}
set position of item "Applications" of container window to {375, 100}
close
open
update without registering applications
end tell
end tell
' | osascript
sync
sync
#
# Unmount the DMG
#
log_info "Unmounting $DEVICE"
hdiutil detach $DEVICE > .tmp 2>&1
if [ $? -ne 0 ]
then
cat .tmp
log_err "Failed to unmount $DEVICE"
exit 1
fi
#
# Compress the DMG
#
log_info "Compressing $DEVICE"
hdiutil convert "$DMG_TMP" -format UDZO -imagekey zlib-level=9 -o "$DMG" > .tmp 2>&1
if [ $? -ne 0 ]
then
cat .tmp
log_err "Failed to compress $DMG_TMP"
exit 1
fi
/bin/rm -rf $DMG_TMP
#cp -f $DMG ~/Desktop/
echo
log_info "Launch $DMG to start"