Beispiel #1
0
				sys.exit()
				
	# Note: at this point it is all-right to overwrite the file if it exists
	
	if options.automaticRun is False:
		choice = raw_input('Ready to produce "%s" from the volume "%s".\n\tContinue? (Y/N):' % (chosenFileName, chosenMount.getWorkingPath()))
		if not choice.lower() in ['y', 'yes']:
			print("Canceling")
			sys.exit()
	
	myStatusHandler = displayTools.statusHandler(taskMessage='Creating image from disc at: %s' % chosenMount.getWorkingPath())
	
	diskFormat = 'UDZO' # default to zlib
	if options.compressionType == "bzip2":
		diskFormat = 'UDBZ'
	
	diskutilArguments = ['/usr/bin/hdiutil', 'create', '-ov', '-srcowners', 'on', '-srcfolder', chosenMount.getWorkingPath(), '-format', diskFormat]
	if options.compressionType == "zlib":
		# go for more compression
		diskutilArguments.append('-imagekey')
		diskutilArguments.append('zlib-level=6')
	diskutilArguments.append(targetPath)
	
	diskutilProcess = managedSubprocess(diskutilArguments)
	
	myStatusHandler.update(taskMessage='Image "%s" created in %s' % (chosenFileName, displayTools.secondsToReadableTime(time.time() - startTime)))
	myStatusHandler.finishLine()
	sys.exit(0)

if __name__ == "__main__":
	main()
Beispiel #2
0
				#print("\tfsck'ing command: " + " ".join(command))
				#process = subprocess.Popen(command)
				#if process.wait() != 0:
				#	raise Exception('Processes: %s\nReturned: %i with output:\n%s\nAnd error: %s' % (' '.join(command), process.returncode, process.stdout.read(), process.stderr.read()))	
			
			for thisOutputOption in outputOptions:
				
				# make sure that there is something at the output location
				open(hdiutilOutfilePath, "w").close()
				
				command = thisSourceOption["command"] + thisOutputOption["command"]
				print("\t" + thisSourceOption["message"] + thisOutputOption["message"] + ": " + " ".join(command))
				
				startTime = time.time()
				managedSubprocess(command)
				print("\t\tConversion took: %s\n" % secondsToReadableTime(time.time() - startTime))
				
				asrTargetFile = None
				
				if thisOutputOption == outputOptions[len(outputOptions) - 1]:
					# since this is the last one we can just use the raw file
					asrTargetFile = hdiutilOutfilePath
					
				else:
					# because there are others that want to use this file, we need to make a copy
					
					asrTargetFile = tempFolderManager.getNewTempFile(prefix="targetFile.", suffix=".dmg")
					print('\t\tCopying: %s to %s' % (hdiutilOutfilePath, asrTargetFile))
					shutil.copyfile(hdiutilOutfilePath, asrTargetFile)
				
				# asr scan the image
Beispiel #3
0
                #	raise Exception('Processes: %s\nReturned: %i with output:\n%s\nAnd error: %s' % (' '.join(command), process.returncode, process.stdout.read(), process.stderr.read()))

            for thisOutputOption in outputOptions:

                # make sure that there is something at the output location
                open(hdiutilOutfilePath, "w").close()

                command = thisSourceOption["command"] + thisOutputOption[
                    "command"]
                print("\t" + thisSourceOption["message"] +
                      thisOutputOption["message"] + ": " + " ".join(command))

                startTime = time.time()
                managedSubprocess(command)
                print("\t\tConversion took: %s\n" %
                      secondsToReadableTime(time.time() - startTime))

                asrTargetFile = None

                if thisOutputOption == outputOptions[len(outputOptions) - 1]:
                    # since this is the last one we can just use the raw file
                    asrTargetFile = hdiutilOutfilePath

                else:
                    # because there are others that want to use this file, we need to make a copy

                    asrTargetFile = tempFolderManager.getNewTempFile(
                        prefix="targetFile.", suffix=".dmg")
                    print('\t\tCopying: %s to %s' %
                          (hdiutilOutfilePath, asrTargetFile))
                    shutil.copyfile(hdiutilOutfilePath, asrTargetFile)
Beispiel #4
0
    myStatusHandler = displayTools.statusHandler(
        taskMessage='Creating image from disc at: %s' %
        chosenMount.getWorkingPath())

    diskFormat = 'UDZO'  # default to zlib
    if options.compressionType == "bzip2":
        diskFormat = 'UDBZ'

    diskutilArguments = [
        '/usr/bin/hdiutil', 'create', '-ov', '-srcowners', 'on', '-srcfolder',
        chosenMount.getWorkingPath(), '-format', diskFormat
    ]
    if options.compressionType == "zlib":
        # go for more compression
        diskutilArguments.append('-imagekey')
        diskutilArguments.append('zlib-level=6')
    diskutilArguments.append(targetPath)

    diskutilProcess = managedSubprocess(diskutilArguments)

    myStatusHandler.update(
        taskMessage='Image "%s" created in %s' %
        (chosenFileName,
         displayTools.secondsToReadableTime(time.time() - startTime)))
    myStatusHandler.finishLine()
    sys.exit(0)


if __name__ == "__main__":
    main()