--- a/src/Pure/System/isabelle_tool.scala Tue Oct 11 10:43:27 2016 +0200
+++ b/src/Pure/System/isabelle_tool.scala Tue Oct 11 11:30:02 2016 +0200
@@ -106,6 +106,7 @@
Doc.isabelle_tool,
ML_Process.isabelle_tool,
Options.isabelle_tool,
+ Remote_DMG.isabelle_tool,
Update_Cartouches.isabelle_tool,
Update_Header.isabelle_tool,
Update_Then.isabelle_tool,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/Tools/remote_dmg.scala Tue Oct 11 11:30:02 2016 +0200
@@ -0,0 +1,64 @@
+/* Title: Pure/Tools/remote_dmg.scala
+ Author: Makarius
+
+Build dmg on remote Mac OS X system.
+*/
+
+package isabelle
+
+
+object Remote_DMG
+{
+ def remote_dmg(session: SSH.Session, tar_gz_file: Path, dmg_file: Path, volume_name: String = "")
+ {
+ session.with_tmp_dir(remote_dir =>
+ using(session.sftp())(sftp =>
+ {
+ val cd = "cd " + File.bash_string(remote_dir) + "; "
+
+ sftp.write_file(remote_dir + "/dmg.tar.gz", tar_gz_file)
+ session.execute(cd + "mkdir root && tar -C root -xzf dmg.tar.gz").check
+ session.execute(
+ cd + "hdiutil create -srcfolder root" +
+ (if (volume_name == "") "" else " -volname " + File.bash_string(volume_name)) +
+ " dmg.dmg").check
+ sftp.read_file(remote_dir + "/dmg.dmg", dmg_file)
+ }))
+ }
+
+
+ /* Isabelle tool wrapper */
+
+ val isabelle_tool = Isabelle_Tool("remote_dmg", "build dmg on remote Mac OS X system", args =>
+ {
+ Command_Line.tool0 {
+ var port = SSH.default_port
+ var volume_name = ""
+
+ val getopts = Getopts("""
+Usage: isabelle remote_dmg [OPTIONS] USER@HOST TAR_GZ_FILE DMG_FILE
+
+ Options are:
+ -p PORT alternative SSH port (default: """ + SSH.default_port + """)
+ -V NAME specify volume name
+
+ Turn the contents of a tar.gz file into a dmg file -- produced on a remote
+ Mac OS X system.
+""",
+ "p:" -> (arg => port = Value.Int.parse(arg)),
+ "V:" -> (arg => volume_name = arg))
+
+ val more_args = getopts(args)
+ val (user, host, tar_gz_file, dmg_file) =
+ more_args match {
+ case List(SSH.User_Host(user, host), tar_gz_file, dmg_file) =>
+ (user, host, Path.explode(tar_gz_file), Path.explode(dmg_file))
+ case _ => getopts.usage()
+ }
+
+ val ssh = SSH.init(Options.init)
+ using(ssh.open_session(user = user, host = host, port = port))(
+ remote_dmg(_, tar_gz_file, dmg_file, volume_name))
+ }
+ })
+}
--- a/src/Pure/build-jars Tue Oct 11 10:43:27 2016 +0200
+++ b/src/Pure/build-jars Tue Oct 11 11:30:02 2016 +0200
@@ -124,6 +124,7 @@
Tools/ml_statistics.scala
Tools/news.scala
Tools/print_operation.scala
+ Tools/remote_dmg.scala
Tools/simplifier_trace.scala
Tools/task_statistics.scala
Tools/update_cartouches.scala