Просмотр исходного кода

Fix a syntax error in release.sh

makeInstallerOSX.sh will now use mkisofs for its HFS creation if available. (This also allows blessing of folders! Just need to properly figure out the compression now)
	=> Currently generates the same size as the old method, but doesn't require the awful hacks (possibly repeatedly resizing, needing an fstab line)
Issue 954


git-svn-id: http://svn.dmdirc.com/trunk@4160 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 лет назад
Родитель
Сommit
a82d750a9d
2 измененных файлов: 99 добавлений и 156 удалений
  1. 98
    73
      installer/osx/makeInstallerOSX.sh
  2. 1
    83
      installer/release.sh

+ 98
- 73
installer/osx/makeInstallerOSX.sh Просмотреть файл

@@ -39,7 +39,9 @@ LINUXIMAGEDIR=${PWD}/dmg
39 39
 # fstab entry should read:
40 40
 # ${LINUXIMAGE} ${LINUXIMAGEDIR} auto users,noauto,loop 0 0
41 41
 
42
-
42
+MKISOFS=`which mkisofs`
43
+MKISOFS_WORKS="0"
44
+PREFER_MKISOFS="1"
43 45
 MKHFS=`which mkfs.hfs`
44 46
 MKHFSPLUS=`which mkfs.hfsplus`
45 47
 HDIUTIL=`which hdiutil`
@@ -60,10 +62,23 @@ if [ ! -e "${JNIName}" ]; then
60 62
 	fi;
61 63
 fi;
62 64
 
65
+USE_MKISOFS="0"
66
+if [ "" != "${MKISOFS}" ]; then
67
+	MKISOFS_TEST=`${MKISOFS} --help 2>&1 | grep apple`
68
+	if [ "" != "${MKISOFS_TEST}" ]; then
69
+		MKISOFS_WORKS="1"
70
+		USE_MKISOFS="${PREFER_MKISOFS}"
71
+	fi;
72
+fi
73
+
63 74
 if [ "" = "${HDIUTIL}" ]; then
64 75
 	if [ "" = "${MKHFS}" -a "" = "${MKHFSPLUS}" ]; then
65
-		echo "This machine is unable to produce dmg images. Aborting."
66
-		exit 1;
76
+		if [ "1" != "${MKISOFS_WORKS}" ]; then
77
+			echo "This machine is unable to produce dmg images. Aborting."
78
+			exit 1;
79
+		else
80
+			USE_MKISOFS="1"
81
+		fi;
67 82
 	fi;
68 83
 fi;
69 84
 
@@ -371,86 +386,96 @@ if [ "" = "${HDIUTIL}" ]; then
371 386
 	IMGBLOCKSIZE=4096 # OSX Default = 4096
372 387
 	MVRES=0
373 388
 	createImage() {
374
-		MVRES=0
375
-		SIZE=${1}
376
-		if [ "" = "${MKHFS}" -a "" != "${MKHFSPLUS}" ]; then
377
-			MKHFS=${MKHFSPLUS}
378
-		fi;
379
-		# mkfs.hfs will only create 512kb+ sized images
380
-		if [ ${SIZE} -lt 524288 ]; then
381
-			echo "Size is less than 512kb"
382
-			SIZE=524288;
383
-		fi;
384
-		dd if=/dev/zero of=${LINUXIMAGE} bs=${SIZE} count=1
385
-		${MKHFS} -b ${IMGBLOCKSIZE} -v 'DMDirc' ${LINUXIMAGE}
386
-		if [ ${?} -ne 0 ]; then
387
-			echo "mkfs.hfs failed to create the image, aborting."
388
-			exit 1;
389
-		fi;
390
-		# Now try and mount
391
-		# This could be a problem, as linux requires either root to mount, or an fstab
392
-		# entry.
393
-		# Try to mount, if this fails, let the user know what to add to fstab.
394
-		if [ -e ${LINUXIMAGEDIR} ]; then
395
-			rm -Rf ${LINUXIMAGEDIR}
396
-		fi;
397
-		mkdir ${LINUXIMAGEDIR}
398
-		mount ${LINUXIMAGEDIR}
399
-		MOUNTRES=${?}
400
-		if [ ${MOUNTRES} -ne 0 ]; then
401
-			# Try using full parameters - could be running as root.
402
-			mount -t hfsplus -o loop ${RUNNAME} ${LINUXIMAGEDIR}
403
-			MOUNTRES=${?}
404
-		fi;
405
-		if [ ${MOUNTRES} -ne 0 ]; then
406
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
407
-			echo "@                               ERROR                               @"
408
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
409
-			echo "You do not have permission to mount the image."
410
-			echo "Please add the following lines to /etc/fstab and re run this script again"
411
-			echo "# DMDirc OSX dmg image"
412
-			echo "${LINUXIMAGE} ${LINUXIMAGEDIR} auto users,noauto,loop 0 0"
413
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
414
-			echo "@                               ERROR                               @"
415
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
416
-			exit 1;
417
-		fi;
418
-		mv -fv ${DMG}/* ${LINUXIMAGEDIR}
419
-		MVRES=${?}
420
-		if [ ${MVRES} -ne 0 ]; then
421
-			echo "Image incorrect size."
389
+		if [ "1" = "${USE_MKISOFS}" ]; then
390
+			# http://lists.apple.com/archives/java-dev/2008/Mar/msg00266.html
391
+			
392
+			${MKISOFS} -V 'DMDirc' -no-pad -r -z -apple -o "${LINUXIMAGE}" -hfs-creator "DMDI" -hfs-bless "/Volumes/DMDirc" "${DMG}"
422 393
 		else
423
-			mv -fv ${DMG}/.[A-Za-z]* ${LINUXIMAGEDIR}
394
+			MVRES=0
395
+			SIZE=${1}
396
+			if [ "" = "${MKHFS}" -a "" != "${MKHFSPLUS}" ]; then
397
+				MKHFS=${MKHFSPLUS}
398
+			fi;
399
+			# mkfs.hfs will only create 512kb+ sized images
400
+			if [ ${SIZE} -lt 524288 ]; then
401
+				echo "Size is less than 512kb"
402
+				SIZE=524288;
403
+			fi;
404
+			dd if=/dev/zero of=${LINUXIMAGE} bs=${SIZE} count=1
405
+			${MKHFS} -b ${IMGBLOCKSIZE} -v 'DMDirc' ${LINUXIMAGE}
406
+			if [ ${?} -ne 0 ]; then
407
+				echo "mkfs.hfs failed to create the image, aborting."
408
+				exit 1;
409
+			fi;
410
+			# Now try and mount
411
+			# This could be a problem, as linux requires either root to mount, or an fstab
412
+			# entry.
413
+			# Try to mount, if this fails, let the user know what to add to fstab.
414
+			if [ -e ${LINUXIMAGEDIR} ]; then
415
+				rm -Rf ${LINUXIMAGEDIR}
416
+			fi;
417
+			mkdir ${LINUXIMAGEDIR}
418
+			mount ${LINUXIMAGEDIR}
419
+			MOUNTRES=${?}
420
+			if [ ${MOUNTRES} -ne 0 ]; then
421
+				# Try using full parameters - could be running as root.
422
+				mount -t hfsplus -o loop ${RUNNAME} ${LINUXIMAGEDIR}
423
+				MOUNTRES=${?}
424
+			fi;
425
+			if [ ${MOUNTRES} -ne 0 ]; then
426
+				echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
427
+				echo "@                               ERROR                               @"
428
+				echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
429
+				echo "You do not have permission to mount the image."
430
+				echo "Please add the following lines to /etc/fstab and re run this script again"
431
+				echo "# DMDirc OSX dmg image"
432
+				echo "${LINUXIMAGE} ${LINUXIMAGEDIR} auto users,noauto,loop 0 0"
433
+				echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
434
+				echo "@                               ERROR                               @"
435
+				echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
436
+				exit 1;
437
+			fi;
438
+			mv -fv ${DMG}/* ${LINUXIMAGEDIR}
424 439
 			MVRES=${?}
425 440
 			if [ ${MVRES} -ne 0 ]; then
426 441
 				echo "Image incorrect size."
442
+			else
443
+				mv -fv ${DMG}/.[A-Za-z]* ${LINUXIMAGEDIR}
444
+				MVRES=${?}
445
+				if [ ${MVRES} -ne 0 ]; then
446
+					echo "Image incorrect size."
447
+				fi;
427 448
 			fi;
449
+			umount ${LINUXIMAGEDIR}
450
+			# If anyone finds out how to compress these nicely, add it here.
428 451
 		fi;
429
-		umount ${LINUXIMAGEDIR}
430
-		# If anyone finds out how to compress these nicely, add it here.
431 452
 	}
432 453
 	
433
-	INCREASE=10
434
-	IMAGESIZE=$(((`du -s --block-size ${IMGBLOCKSIZE} ${DMG} | awk '{print $1}'` + ${INCREASE}) * ${IMGBLOCKSIZE} ))
435
-	createImage ${IMAGESIZE}
436
-	
437
-	# This sucks, but it makes sure the image gets created at a size that contains
438
-	# everything.
439
-	# I can't manage to get du to return the size that the files actually end up
440
-	# using on the image.
441
-	TRIES=0
442
-	while [ ${MVRES} -ne 0 -a ${TRIES} -ne 5 ]; do
443
-		TRIES=$((${TRIES} + 1))
444
-		echo "Previous ImageSize of ${IMAGESIZE} failed"
445
-		INCREASE=$((${INCREASE} + 5))
454
+	if [ "1" = "${USE_MKISOFS}" ]; then
455
+		createImage
456
+	else
457
+		INCREASE=10
446 458
 		IMAGESIZE=$(((`du -s --block-size ${IMGBLOCKSIZE} ${DMG} | awk '{print $1}'` + ${INCREASE}) * ${IMGBLOCKSIZE} ))
447
-		echo "Trying to build with ImageSize ${IMAGESIZE}"
448 459
 		createImage ${IMAGESIZE}
449
-	done;
450
-	
451
-	if [ ${MVRES} -ne 0 ]; then
452
-		echo "OSX Build Failed - Imagesize: ${IMAGESIZE}"
453
-		exit 1;
460
+		
461
+		# This sucks, but it makes sure the image gets created at a size that contains
462
+		# everything.
463
+		# I can't manage to get du to return the size that the files actually end up
464
+		# using on the image.
465
+		TRIES=0
466
+		while [ ${MVRES} -ne 0 -a ${TRIES} -ne 5 ]; do
467
+			TRIES=$((${TRIES} + 1))
468
+			echo "Previous ImageSize of ${IMAGESIZE} failed"
469
+			INCREASE=$((${INCREASE} + 5))
470
+			IMAGESIZE=$(((`du -s --block-size ${IMGBLOCKSIZE} ${DMG} | awk '{print $1}'` + ${INCREASE}) * ${IMGBLOCKSIZE} ))
471
+			echo "Trying to build with ImageSize ${IMAGESIZE}"
472
+			createImage ${IMAGESIZE}
473
+		done;
474
+		
475
+		if [ ${MVRES} -ne 0 ]; then
476
+			echo "OSX Build Failed - Imagesize: ${IMAGESIZE}"
477
+			exit 1;
478
+		fi;
454 479
 	fi;
455 480
 	
456 481
 	if [ "${LINUXIMAGE}" != "${RUNNAME}" ]; then

+ 1
- 83
installer/release.sh Просмотреть файл

@@ -173,72 +173,6 @@ echo "Removing existing releases from output directory"
173 173
 echo "================================================================"
174 174
 rm -Rf output/*.run output/*.exe output/*.dmg
175 175
 
176
-# OSX doesn't use the installer
177
-# and neither does anything else now,
178
-#if [ "osx" != "${BUILDTARGET}" ]; then
179
-#	echo "================================================================"
180
-#	echo "Building Installer JAR "
181
-#	echo "================================================================"
182
-#	mkdir -p installer_temp/build
183
-#	cd installer_temp
184
-#	ln -sf ../../src/com
185
-#	ln -sf ../../src/net
186
-#	# I don't know why, but -d doesn't nicely put ALL generated class files here,
187
-#	# just those that were in the dir of the java file that was requested for compile
188
-#	# So we specify each of the different ones we want built into the jar file here.
189
-#	FILELIST="com/dmdirc/installer/*.java"
190
-#	FILELIST=${FILELIST}" com/dmdirc/installer/cliparser/*.java"
191
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/dialogs/wizard/*.java"
192
-#	FILELIST=${FILELIST}" com/dmdirc/ui/interfaces/MainWindow.java"
193
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/MainFrame.java"
194
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
195
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/UIUtilities.java"
196
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/StandardDialog.java"
197
-#	FILELIST=${FILELIST}" com/dmdirc/util/ListenerList.java"
198
-#	FILELIST=${FILELIST}" com/dmdirc/util/WeakMapList.java"
199
-#	FILELIST=${FILELIST}" com/dmdirc/util/MapList.java"
200
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/EtchedLineBorder.java"
201
-#	FILELIST=${FILELIST}" com/dmdirc/util/EquatableWeakReference.java"
202
-#	FILELIST=${FILELIST}" com/dmdirc/ui/swing/components/JWrappingLabel.java"
203
-#	FILELIST=${FILELIST}" com/dmdirc/util/WeakList.java"
204
-#	FILELIST=${FILELIST}" net/miginfocom/layout/*.java"
205
-#	FILELIST=${FILELIST}" net/miginfocom/swing/*.java"
206
-#	
207
-#	${JAVAC} -d ./build ${FILELIST}
208
-#	
209
-#	if [ $? -ne 0 ]; then
210
-#		echo "================================================================"
211
-#		echo "Building installer failed."
212
-#		echo "================================================================"
213
-#		cd ${THISDIR}
214
-#		rm -Rf installer_temp
215
-#		exit 1;
216
-#	fi
217
-#	
218
-#	cd build
219
-#	echo "Manifest-Version: 1.0" > manifest.txt
220
-#	echo "Created-By: DMDirc Installer" >> manifest.txt
221
-#	echo "Main-Class: com.dmdirc.installer.Main" >> manifest.txt
222
-#	echo "Class-Path: " >> manifest.txt
223
-#	echo "" >> manifest.txt
224
-#	${JAR} cmf manifest.txt installer.jar com net
225
-#	if [ $? -ne 0 ]; then
226
-#		echo "================================================================"
227
-#		echo "Building installer failed."
228
-#		echo "================================================================"
229
-#		cd ${THISDIR}
230
-#		rm -Rf installer_temp
231
-#		exit 1;
232
-#	else
233
-#		rm -Rf ${THISDIR}/common/installer.jar
234
-#		mv installer.jar ${THISDIR}/common/installer.jar
235
-#	fi
236
-#	
237
-#	cd ${THISDIR}
238
-#	rm -Rf installer_temp
239
-#fi;
240
-
241
-
242 176
 # Copy default settings from www to trunk for compile (if they exist, and we are
243 177
 # building a new jar)
244 178
 REVERTLIST=""
@@ -302,22 +236,6 @@ if [ "osx" = "${BUILDTARGET}" -o "" = "${BUILDTARGET}" ]; then
302 236
 	cd ${THISDIR}
303 237
 fi;
304 238
 
305
-#MD5BIN=`which md5sum`
306
-#if [ "${MD5BIN}" != "" ]; then
307
-#	echo "================================================================"
308
-#	echo "Creating MD5SUM files"
309
-#	echo "================================================================"
310
-#	cd output
311
-#	for outputFile in *; do
312
-#		if [ "${outputFile##*.}" != "md5" ]; then
313
-#			if [ -e "${outputFile}.md5" ]; then
314
-#				rm -f "${outputFile}.md5"
315
-#			fi
316
-#			${MD5BIN} "${outputFile}" > "${outputFile}.md5"
317
-#		fi
318
-#	done
319
-#	cd ${THISDIR}
320
-#fi
321 239
 
322 240
 echo "================================================================"
323 241
 echo "Clean Up"
@@ -328,7 +246,7 @@ for updatedir in ${REVERTLIST}; do
328 246
 	${SVN} revert ${updatedir}/*
329 247
 done;
330 248
 
331
-if [ "1" = "${UPLOAD}" && "1" = "${TAG}" ]; then
249
+if [ "1" = "${UPLOAD}" -a "1" = "${TAG}" ]; then
332 250
 	echo "================================================================"
333 251
 	echo "Uploading to GoogleCode"
334 252
 	echo "================================================================"

Загрузка…
Отмена
Сохранить