1 package com.memoire.vainstall; 2 3 import java.io.File ; 4 import java.io.IOException ; 5 import java.io.PrintWriter ; 6 7 19 20 public class AbstractCustomPrePost { 21 22 35 36 public static boolean preInstall(PrintWriter filelog, 37 VAInstallStep step) throws Exception { 38 step.details(":-)"); 39 VAGlobals.printDebug("AbstractCustomPrePost.preInstall"); 40 return true; 41 } 42 43 56 57 public static boolean postInstall(PrintWriter filelog, 58 VAInstallStep step) 59 throws Exception { 60 step.details(";-)"); 61 VAGlobals.printDebug("AbstractCustomPrePost.postInstall"); 62 return true; 63 } 64 65 79 80 public static boolean preUpgrade(String oldversion, 81 PrintWriter filelog, 82 VAInstallStep step) 83 throws Exception { 84 step.details(":-)"); 85 VAGlobals.printDebug("AbstractCustomPrePost.preUpgrade"); 86 return true; 87 } 88 89 90 public static boolean postUpgrade(String oldversion, 91 PrintWriter filelog, 92 VAInstallStep step) 93 throws Exception { 94 step.details(";-)"); 95 VAGlobals.printDebug("AbstractCustomPrePost.postUpgrade"); 96 return true; 97 } 98 99 105 106 public static boolean preUninstall(VAInstallStep step) 107 throws Exception { 108 step.details(":-)"); 109 VAGlobals.printDebug("AbstractCustomPrePost.preUninstall"); 110 return true; 111 } 112 113 119 120 public static boolean postUninstall(VAInstallStep step) 121 throws Exception { 122 step.details(";-)"); 123 VAGlobals.printDebug("AbstractCustomPrePost.postUninstall"); 124 return true; 125 } 126 127 129 146 protected static final int runCommand(File workdir, String [] args, 149 VAInstallStep step) 150 throws IOException , InterruptedException { 151 VAGlobals.printDebug("AbastractCustomPrePost.runCommand"); 152 VAGlobals.printDebug("\tworking dir = " 153 + workdir.getAbsolutePath()); 154 for (int idx = 0; idx < args.length; idx ++) { 155 VAGlobals.printDebug("\targ " + idx + " = " +args[idx]); 156 } 157 Process proc = Runtime.getRuntime().exec(args, null, workdir); 158 InputStreamToDetails relay = new 159 InputStreamToDetails(proc.getInputStream(), step); 160 relay.start(); 161 proc.waitFor(); 162 int rc = proc.exitValue(); 163 VAGlobals.printDebug("AbstractCustomPrepost.runCommand cmd" 164 + " returned " + rc); 165 return rc; 166 } 167 168 } 169
| Popular Tags
|