public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
public static Statement extractTargzIntoDirectory(URI targz, String directory) { return extractTargzIntoDirectory("GET", targz, ImmutableMultimap.<String, String> of(), directory); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("mkdir /tmp/$$")) .add(extractTargzIntoDirectory(tgz, "/tmp/$$")) .add(exec("mkdir -p " + dest)) .add(exec("mv /tmp/$$/*/* " + dest)) .add(exec("rm -rf /tmp/$$")).build()); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("mkdir /tmp/$$")) .add(extractTargzIntoDirectory(tgz, "/tmp/$$")) .add(exec("mkdir -p " + dest)) .add(exec("mv /tmp/$$/*/* " + dest)) .add(exec("rm -rf /tmp/$$")).build()); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("mkdir /tmp/$$")) .add(extractTargzIntoDirectory(tgz, "/tmp/$$")) .add(exec("mkdir -p " + dest)) .add(exec("mv /tmp/$$/*/* " + dest)) .add(exec("rm -rf /tmp/$$")).build()); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("export TAR_TEMP=\"$(mktemp -d)\"")) .add(extractTargzIntoDirectory(tgz, "\"${TAR_TEMP}\"")) .add(exec("mkdir -p " + dest)) .add(exec("mv \"${TAR_TEMP}\"/*/* " + dest)) .add(exec("rm -rf \"${TAR_TEMP}\"")) .build()); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("export TAR_TEMP=\"$(mktemp -d)\"")) .add(extractTargzIntoDirectory(tgz, "\"${TAR_TEMP}\"")) .add(exec("mkdir -p " + dest)) .add(exec("mv \"${TAR_TEMP}\"/*/* " + dest)) .add(exec("rm -rf \"${TAR_TEMP}\"")) .build()); }
/** * like {@link #extractTargzIntoDirectory(URI, String)} except that it * flattens the first directory in the archive * * For example, {@code apache-maven-3.0.4-bin.tar.gz} normally extracts * directories like {@code ./apache-maven-3.0.4/bin}. This command eliminates * the intermediate directory, in the example {@code ./apache-maven-3.0.4/} * * @param tgz remote ref to download * @param dest path where the files in the intermediate directory will end */ public static Statement extractTargzAndFlattenIntoDirectory(URI tgz, String dest) { return new StatementList(ImmutableSet.<Statement> builder() .add(exec("export TAR_TEMP=\"$(mktemp -d)\"")) .add(extractTargzIntoDirectory(tgz, "\"${TAR_TEMP}\"")) .add(exec("mkdir -p " + dest)) .add(exec("mv \"${TAR_TEMP}\"/*/* " + dest)) .add(exec("rm -rf \"${TAR_TEMP}\"")) .build()); }
public void testExtractTargzIntoDirectoryUNIX() { Statement save = Statements .extractTargzIntoDirectory( URI.create("https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.tar.gz"), "/opt/minecraft"); assertEquals( save.render(OsFamily.UNIX), "curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.tar.gz |(mkdir -p /opt/minecraft &&cd /opt/minecraft &&tar -xpzf -)\n"); }
public void testExtractTargzIntoDirectoryUNIX() { Statement save = Statements .extractTargzIntoDirectory( URI.create("https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.tar.gz"), "/opt/minecraft"); assertEquals( save.render(OsFamily.UNIX), "curl -q -s -S -L --connect-timeout 10 --max-time 600 --retry 20 -X GET https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.tar.gz |(mkdir -p /opt/minecraft &&cd /opt/minecraft &&tar -xpzf -)\n"); }
/** * build a shell script that invokes the contents of the http request in bash. * * @return a shell script that will invoke the http request */ public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) { return Statements .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory); }
/** * build a shell script that invokes the contents of the http request in bash. * * @return a shell script that will invoke the http request */ public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) { return Statements .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory); }
/** * build a shell script that invokes the contents of the http request in bash. * * @return a shell script that will invoke the http request */ public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) { return Statements .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory); }
/** * build a shell script that invokes the contents of the http request in bash. * * @return a shell script that will invoke the http request */ public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) { return Statements .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory); }