1 6 7 package com.quikj.application.utilities.postinstall; 8 9 13 public class Install 14 { 15 public static final int ACTION_POSTINSTALL = 0; 16 public static final int ACTION_BACKUP = 1; 17 public static final int ACTION_UPGRADE = 2; 18 19 20 public Install() 21 { 22 } 23 24 27 public static void main(String args[]) 28 { 29 boolean text_install = false; 30 int action = ACTION_POSTINSTALL; 31 String home = null; 32 33 for (int i = 0; i < args.length; i++) 34 { 35 if (args[i].equals("-text") == true) 36 { 37 text_install = true; 38 } 39 else if (args[i].equals("-action=postinstall") == true) 40 { 41 action = ACTION_POSTINSTALL; 42 } 43 else if (args[i].equals("-action=backup") == true) 44 { 45 action = ACTION_BACKUP; 46 } 47 else if (args[i].equals("-action=upgrade") == true) 48 { 49 action = ACTION_UPGRADE; 50 } 51 else if (args[i].startsWith("-home=") == true) 52 { 53 home = args[i].substring(("-home=").length()); 54 } 55 } 56 57 switch (action) 58 { 59 case ACTION_POSTINSTALL: 60 if (text_install == false) 61 { 62 try 63 { 64 PostInstaller ins = new PostInstaller(); 65 ins.show(); 66 new HelpFrame(ins); 67 } 68 catch (Exception ex) 69 { 70 System.err.println(ex.getClass().getName() + ": " + ex.getMessage()); 71 } 72 } 73 else 74 { 75 TextPostInstaller ins = new TextPostInstaller(); 76 ins.install(); 77 } 78 break; 79 80 case ACTION_UPGRADE: 81 break; 82 83 case ACTION_BACKUP: 84 if (text_install == false) 85 { 86 try 87 { 88 Backup backup = new Backup(home); 89 backup.show(); 90 } 91 catch (Exception ex) 92 { 93 System.err.println(ex.getClass().getName() + ": " + ex.getMessage()); 94 } 95 } 96 else 97 { 98 TextBackup backup = new TextBackup(home); 99 backup.backup(); 100 } 101 break; 102 103 default: 104 System.err.println ("Unspecified action"); 105 break; 106 } 107 } 108 109 } 110 | Popular Tags |