()
| 76 | } |
| 77 | |
| 78 | private void doInstall() { |
| 79 | logger.l1("[+] Creating database data"); |
| 80 | SystemInfo info = MainHandler.getCurrentInstance().getInfo(); |
| 81 | |
| 82 | // robots |
| 83 | Robot areafix = new Robot(); |
| 84 | areafix.setClassName(AreaFix.class.getCanonicalName()); |
| 85 | areafix.setRobot("areafix"); |
| 86 | ORMManager.get(Robot.class).save(areafix); |
| 87 | Robot filefix = new Robot(); |
| 88 | filefix.setClassName(FileFix.class.getCanonicalName()); |
| 89 | filefix.setRobot("filefix"); |
| 90 | ORMManager.get(Robot.class).save(filefix); |
| 91 | |
| 92 | Robot scriptfix = new Robot(); |
| 93 | scriptfix.setClassName(ScriptFix.class.getCanonicalName()); |
| 94 | scriptfix.setRobot("scriptfix"); |
| 95 | ORMManager.get(Robot.class).save(scriptfix); |
| 96 | |
| 97 | logger.l1("[+] Robots created"); |
| 98 | |
| 99 | // owner's point |
| 100 | String ownAddr = FtnTools.getPrimaryFtnAddress().toString(); |
| 101 | if (!ownAddr.contains(".")) { |
| 102 | ownAddr += ".1"; |
| 103 | } |
| 104 | Link owner = ORMManager.get(Link.class).getFirstAnd("ftn_address", "=", |
| 105 | ownAddr); |
| 106 | if (owner == null) { |
| 107 | owner = new Link(); |
| 108 | owner.setLinkName(info.getSysop()); |
| 109 | owner.setLinkAddress(ownAddr); |
| 110 | owner.setProtocolHost("-"); |
| 111 | owner.setProtocolPort(0); |
| 112 | owner.setPaketPassword(FtnTools.generate8d()); |
| 113 | owner.setProtocolPassword(owner.getPaketPassword()); |
| 114 | ORMManager.get(Link.class).save(owner); |
| 115 | logger.l1("[+] owner point account created"); |
| 116 | logger.l1(String.format("\n\tFTN: %s\n\tAka: %s\n\tPassword: %s\n", |
| 117 | owner.getLinkAddress(), owner.getLinkName(), |
| 118 | owner.getPaketPassword())); |
| 119 | long nice = 1; |
| 120 | Rewrite rw = new Rewrite(); |
| 121 | rw.setType(Type.NETMAIL); |
| 122 | rw.setLast(true); |
| 123 | rw.setNice(nice++); |
| 124 | rw.setOrig_from_addr("^" |
| 125 | + ownAddr.replace(".", "\\.").replace("/", "\\/") + "$"); |
| 126 | rw.setNew_from_addr(FtnTools.getPrimaryFtnAddress().toString()); |
| 127 | ORMManager.get(Rewrite.class).save(rw); |
| 128 | |
| 129 | for (FtnAddress address : info.getAddressList()) { |
| 130 | Rewrite rw2 = new Rewrite(); |
| 131 | rw2.setType(Type.NETMAIL); |
| 132 | rw2.setLast(true); |
| 133 | rw2.setNice(nice++); |
| 134 | rw2.setOrig_to_addr("^" |
| 135 | + address.toString().replace(".", "\\.") |
no test coverage detected