1 13 14 package installer; 15 16 import java.util.Vector ; 17 18 21 public class NonInteractiveInstall 22 { 23 public NonInteractiveInstall(String [] args) 24 { 25 String installDir = args[1]; 26 27 installer = new Install(); 28 29 OperatingSystem os = OperatingSystem.getOperatingSystem(); 30 OperatingSystem.OSTask[] osTasks = os.getOSTasks(installer); 31 32 for(int i = 2; i < args.length; i++) 33 { 34 String arg = args[i]; 35 int index = arg.indexOf('='); 36 if(index == -1) 37 { 38 System.err.println("Invalid parameter: " + arg); 39 continue; 40 } 41 42 String taskName = arg.substring(0,index); 43 String taskDir = arg.substring(index + 1); 44 for(int j = 0; j < osTasks.length; j++) 45 { 46 OperatingSystem.OSTask osTask = osTasks[j]; 47 if(osTask.getName().equals(taskName)) 48 { 49 if(taskDir.equals("off")) 50 osTask.setEnabled(false); 51 else 52 { 53 osTask.setEnabled(true); 54 osTask.setDirectory(taskDir); 55 } 56 break; 57 } 58 } 59 } 60 61 int compCount = installer.getIntegerProperty("comp.count"); 62 Vector components = new Vector (compCount); 63 64 for(int i = 0; i < compCount; i++) 65 { 66 String fileset = installer.getProperty("comp." + i + ".fileset"); 67 68 String osDep = installer.getProperty("comp." + i + ".os"); 69 if(osDep != null) 70 { 71 if(!os.getClass().getName().endsWith(osDep)) 72 { 73 continue; 74 } 75 } 76 77 components.addElement(fileset); 78 } 79 80 82 ConsoleProgress progress = new ConsoleProgress(); 83 InstallThread thread = new InstallThread( 84 installer,progress,installDir,osTasks, 85 0 ,components); 86 thread.start(); 87 } 88 89 private Install installer; 91 } 92
| Popular Tags
|